Copy ScriptScope?

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

Thanks.

+4
source share
1 answer

There is no built-in way to do this. But you could do it manually. You can call GetItems () on ScriptScope and then save all the values ​​and then return all the values ​​to the new ScriptScope.

+3
source

Source: https://habr.com/ru/post/1301765/


All Articles