tags:

views:

47

answers:

1
+1  Q: 

Copy ScriptScope?

Hey folks,

I'm using IronPython 2.6 and I was wondering if there was a way to copy a Microsoft.Scripting.Hosting.ScriptScope to get all the variables and context in another ScriptScope. The reason I want this is I am executing a file, and I want to restore the context to before the start of the execution if an exception occurs.

Thanks.

+1  A: 

There's no built-in way to do this. But you could do this by hand. You can call GetItems() on the ScriptScope and then save all the values and then put all the values back into a new ScriptScope.

Dino Viehland