Users Python script locations on Windows

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
steve.white
Posts: 15
Joined: Tue May 06, 2014 3:58 pm

Users Python script locations on Windows

Post by steve.white »

I am new to FreeCAD and New to Python. I have FreeCAD installed on Windows 7.

I wanted to have a location to store my .py files, but cannot find an easy way to do this with a path setting in Preferences.

Where is the normal place to store users .py files and how do you tell FreeCAD where they are?
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: Users Python script locations on Windows

Post by ulrich1a »

The macro folder is in the python path. Setting the macro path in the preferences and putting the .py files should work.

It is also possible to call a python script from somewhere else in the python console with

Code: Select all

execfile("your_path_to_python_script")
Ulrich
steve.white
Posts: 15
Joined: Tue May 06, 2014 3:58 pm

Re: Users Python script locations on Windows

Post by steve.white »

Thanks for quick reply Ulrich1a,
The execfile command tip was useful.

For the my python file locations on my Windows 7 machine I changed the target shortcut path from
"C:\Program Files (x86)\FreeCAD0.13\bin\FreeCAD.exe"
to
"C:\Program Files (x86)\FreeCAD0.13\bin\FreeCAD.exe" --python-path C:\Users\swhite\Documents\MyPython

If I extended the macro path to
C:\Users\swhite\AppData\Roaming\FreeCAD\;C:\Users\swhite\Documents\MyPython
then saving macros became confused.

I really wanted to keep my macros at C:\Users\swhite\AppData\Roaming\FreeCAD\ separate from my .py files.

Steve
Post Reply