cadfreecad

Cant import FreeCAD to Python


Im having a little problem when I try to import from a Python file, which is placed in an another folder, to FreeCAD. Python file location : c:/users/workspace/main.py FreeCAD : c:/program files (x86)/FreeCAD0.13/bin

when I'm trying to import with the command from FreeCAD import * ( I'm appending FreeCAD's path to sys sys.path.append (" path-To-FreeCADs-BinFolder " ) I get an error :

FreeCAD 0.13, Libs: 0.13R1828
Initialization of FreeCAD failed:
While initializing FreeCAD the  following exception occurred:
''module' object has no attribute 'PrintError''
Please contact the application's support team for more information. "

But when i create a Python file in FreeCAD 's folder it works. I mean with import FreeCAD like I wrote above.

ps : My Python Version is 2.7.5 and FreeCAD is : 0.13


Solution

  • I had the same problem and surfing around I found that Win version doesn't support Python2.7, so you have to install Python 2.6, open a shell and do the same import sys sys.path.append('C://Program Files//FreeCAD0.13/bin') import FreeCAD

    Then it should work