diff options
Diffstat (limited to 'scripting/source')
-rw-r--r-- | scripting/source/pyprov/pythonscript.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py index 5e14a863e8b8..4955c8c54888 100644 --- a/scripting/source/pyprov/pythonscript.py +++ b/scripting/source/pyprov/pythonscript.py @@ -21,7 +21,7 @@ import uno import unohelper import sys import os -import imp +import types import time import ast import platform @@ -341,7 +341,7 @@ class ScriptContext(unohelper.Base): # code = readTextFromStream( sfa.openFileRead( url ) ) # execute the module -# entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") ) +# entry = ModuleEntry( lastRead, types.ModuleType("ooo_script_framework") ) # entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = g_scriptContext # entry.module.__file__ = url # exec code in entry.module.__dict__ @@ -483,7 +483,7 @@ class ProviderContext: src = ensureSourceState( src ) # execute the module - entry = ModuleEntry( lastRead, imp.new_module("ooo_script_framework") ) + entry = ModuleEntry( lastRead, types.ModuleType("ooo_script_framework") ) entry.module.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = self.scriptContext code = None @@ -577,7 +577,7 @@ class ScriptBrowseNode( unohelper.Base, XBrowseNode , XPropertySet, XInvocation, if event.ActionCommand == "Run": code = self.editor.getControl("EditorTextField").getText() code = ensureSourceState( code ) - mod = imp.new_module("ooo_script_framework") + mod = types.ModuleType("ooo_script_framework") mod.__dict__[GLOBAL_SCRIPTCONTEXT_NAME] = self.provCtx.scriptContext exec(code, mod.__dict__) values = mod.__dict__.get( CALLABLE_CONTAINER_NAME , None ) |