From 0caad785d496bddbb264b238d36c386a5c16703a Mon Sep 17 00:00:00 2001 From: looooo Date: Thu, 9 Mar 2017 12:10:02 +0100 Subject: [PATCH] App: FreeCADInit.py: add newStyleModule function FreeCAD._newStyleModule("MyMod") # removes MyMod from the sys.path --- src/App/FreeCADInit.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/App/FreeCADInit.py b/src/App/FreeCADInit.py index bb38600f84..d84ee3c56d 100644 --- a/src/App/FreeCADInit.py +++ b/src/App/FreeCADInit.py @@ -33,10 +33,22 @@ # imports the one and only import FreeCAD +def removeFromPath(module_name): + import sys, os + paths = sys.path + for path in paths: + if module_name in path: + sys.path.remove(path) + return + else: + Wrn(module_name + " not found in sys.path\n") + +FreeCAD._newStyleModule = removeFromPath + def InitApplications(): try: - import sys,os,traceback + import sys,os,traceback,io except ImportError: FreeCAD.Console.PrintError("\n\nSeems the python standard libs are not installed, bailing out!\n\n") raise @@ -279,7 +291,3 @@ del(InitApplications) del(test_ascii) Log ('Init: App::FreeCADInit.py done\n') - - - -