summaryrefslogtreecommitdiff
path: root/scripting/source/pyprov
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-05-20 13:32:05 +0000
committerKurt Zenker <kz@openoffice.org>2008-05-20 13:32:05 +0000
commitdcc0d9150c349147ee570565fb4a1518290cf9aa (patch)
tree6ec769addf47d3a2d157ce6f575a169fd5b241de /scripting/source/pyprov
parent524fa3f8359c1de60a2d069f2455977c5fb90b51 (diff)
INTEGRATION: CWS pyunosystempaths_DEV300 (1.6.32); FILE MERGED
2008/04/23 06:30:40 fs 1.6.32.1: #i86251# committing on behalf of jbu@openoffice.org - proper system path encodings
Diffstat (limited to 'scripting/source/pyprov')
-rw-r--r--scripting/source/pyprov/pythonscript.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripting/source/pyprov/pythonscript.py b/scripting/source/pyprov/pythonscript.py
index f06c98878c..bcc6f6c855 100644
--- a/scripting/source/pyprov/pythonscript.py
+++ b/scripting/source/pyprov/pythonscript.py
@@ -20,6 +20,9 @@ LOG_STDOUT = True # True, writes to stdout (difficult
ENABLE_EDIT_DIALOG=False # offers a minimal editor for editing.
#-------------------------------------------------------------------
+def encfile(uni):
+ return uni.encode( sys.getfilesystemencoding())
+
def lastException2String():
(excType,excInstance,excTraceback) = sys.exc_info()
ret = str(excType) + ": "+str(excInstance) + "\n" + \
@@ -74,7 +77,7 @@ class Logger(LogLevel):
" [" +
logLevel2String( level ) +
"] " +
- msg +
+ encfile(msg) +
"\n" )
self.target.flush()
except Exception,e:
@@ -142,17 +145,18 @@ def ensureSourceState( code ):
code = code.replace( "\r", "" )
return code
+
def checkForPythonPathBesideScript( url ):
if url.startswith( "file:" ):
path = unohelper.fileUrlToSystemPath( url+"/pythonpath.zip" );
log.log( LogLevel.DEBUG, "checking for existence of " + path )
- if 1 == os.access( path, os.F_OK) and not path in sys.path:
+ if 1 == os.access( encfile(path), os.F_OK) and not path in sys.path:
log.log( LogLevel.DEBUG, "adding " + path + " to sys.path" )
sys.path.append( path )
path = unohelper.fileUrlToSystemPath( url+"/pythonpath" );
log.log( LogLevel.DEBUG, "checking for existence of " + path )
- if 1 == os.access( path, os.F_OK) and not path in sys.path:
+ if 1 == os.access( encfile(path), os.F_OK) and not path in sys.path:
log.log( LogLevel.DEBUG, "adding " + path + " to sys.path" )
sys.path.append( path )
@@ -295,7 +299,7 @@ class ProviderContext:
code = None
if url.startswith( "file:" ):
- code = compile( src, uno.fileUrlToSystemPath( url ), "exec" )
+ code = compile( src, encfile(uno.fileUrlToSystemPath( url ) ), "exec" )
else:
code = compile( src, url, "exec" )
exec code in entry.module.__dict__