Skip to content

Commit

Permalink
App: FreeCADInit.py: add newStyleModule function
Browse files Browse the repository at this point in the history
FreeCAD._newStyleModule("MyMod") # removes MyMod from the sys.path
  • Loading branch information
looooo authored and wwmayer committed Mar 18, 2017
1 parent 2a7fdef commit 0caad78
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/App/FreeCADInit.py
Expand Up @@ -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
Expand Down Expand Up @@ -279,7 +291,3 @@ def InitApplications():
del(test_ascii)

Log ('Init: App::FreeCADInit.py done\n')




0 comments on commit 0caad78

Please sign in to comment.