Load own Python scripts with Blender (Mac)

Hey everyone,

at work I work with Blender on the Windows System.

Now I wanted to set up Blender at my MacBook Air at Home with MAC OS X Yosemite.

The installation of Blender and Python went quite well but I cannot import my own scripts from a random folder.

I know how to give blender the “environment variable” (or I think also called Pythonpath) wthin WINDOWS but unfortunately I have no clue how to do that under MAC OS.

Can anyone help me and tell me how I give Blender the right path where it can load the scripts from?

Here’s what I do on 10.7.5, not sure if it works for later or earlier versions.

In your home folder, you create ( if it does not exist ) a folder named .MacOSX. Inside that you put a file named environment.plist.

Here is what mine looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>BLENDER_USER_SCRIPTS</key>
    <string>/Users/dustractor/bpy/scripts</string>
</dict>
</plist>

Thanks for your answer.

I also just found a different solution by using the Terminal and typing in: “launchctl setenv PYTHONPATH Path”

It works fine but now unfortunately I got a different problem. I use scripts written in Windows. Within this script the Python Imaging Library is used and a file called ‘_imaging.pyd’ is used. That gives me the following error: 'ImportError: cannot import name ‘_imaging’ ’

I think it is the problem that MAC os can’t handle a .pyd file? Do you have any idea how I can compile the file or a different solution?

According to this question on stackoverflow:

and this bit in the python(2) docs:

.pyd files are basically dll files

So, no, it’s not going to work on a mac.

What functions are you using the imaging library for? Perhaps pillow ( the PIL fork ) might do the trick?