From 9e23a2086cb438f63e54b724d855db3fa5967791 Mon Sep 17 00:00:00 2001 From: looooo Date: Wed, 8 Mar 2017 19:25:37 +0100 Subject: [PATCH] py3: Gui: FreeCADGuiInit.py --- src/Gui/FreeCADGuiInit.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Gui/FreeCADGuiInit.py b/src/Gui/FreeCADGuiInit.py index 69f87f0186..81bac85d31 100644 --- a/src/Gui/FreeCADGuiInit.py +++ b/src/Gui/FreeCADGuiInit.py @@ -98,7 +98,7 @@ class NoneWorkbench ( Workbench ): return "Gui::NoneWorkbench" def InitApplications(): - import sys,os,traceback,cStringIO + import sys,os,traceback # Searching modules dirs +++++++++++++++++++++++++++++++++++++++++++++++++++ # (additional module paths are already cached) ModDirs = FreeCAD.__path__ @@ -109,16 +109,16 @@ def InitApplications(): InstallFile = os.path.join(Dir,"InitGui.py") if (os.path.exists(InstallFile)): try: - #execfile(InstallFile) - exec open(InstallFile).read() - except Exception, inst: + # XXX: This looks scary securitywise... + with open(InstallFile) as f: + exec(f.read()) + except Exception as inst: Log('Init: Initializing ' + Dir + '... failed\n') Log('-'*100+'\n') - output=cStringIO.StringIO() - traceback.print_exc(file=output) + Log(traceback.format_exc()) Log(output.getvalue()) Log('-'*100+'\n') - Err('During initialization the error ' + str(inst).decode('ascii','replace') + ' occurred in ' + InstallFile + '\n') + Err('During initialization the error ' + str(inst) + ' occurred in ' + InstallFile + '\n') else: Log('Init: Initializing ' + Dir + '... done\n') else: