import modules

at the risk of possible rtfm responses i have to ask the following… having stated that i’ve read as much documentation as i can stomach and am still found wanting…

i’m beginning to experiment with pyhthon scripts and am having only limited success. i’ve successfully used the lindenmeyer one (very very nice) and thought i’d have a go with the insect walk script. pressing alt-P results in an error message and the highlighting of ‘import math’ in the text window.

now this is obviously telling me that the math module can’t be found. but shouldn’t blender already have it?

i’m using blender 236 on mac os 10.2.8 with macPython2.3…

cheers people

andy g

Hi andy_g,

What does your Blender “Console” window tell you? This is the “command prompt” type of box that is the first blender window that loads up when Blender runs. This should have a message with more specifics as to the problem.

Hi andy_g,

I’m running OS-X 10.2.8, also. I have to add the following code to most python files to get them to work. It tells blender the path to your Python.

import sys
sys.path.extend([’’, ‘/usr/lib/python2.2’, ‘/usr/lib/python2.2/plat-darwin’, ‘/usr/lib/python2.2/lib-tk’, ‘/usr/lib/python2.2/lib-dynload’, ‘/usr/lib/python2.2/site-packages’])

Note: import sys is the first line, the balance is all on line 2. Place the code above import Blender, of the script you want to use in the text editor of Blender.

thanks for the replies people.

the thing is… i’ve often wondered what/where the console window is. i’ve never actually seen it. thought it might be a mac thing that it doesn’t show up. i’ll try and hunt it down.

i’ll try some of those extra lines in the script too.

best

andy g

Hi andy_g,

To locate your Console go to:

Applications>Utilities>Console (on your hard drive).

yeah, cheers. i put my brain into gear and had a look at the osx console - i was originally under the impression that this was another console that was a part of blender.

so having done that i realise the problem is that i am missing most of the python modules/don’t have the complete macpython2.3 etc etc. - i’ll be sorting this out promptly and trying again.

best

andy g

good god - how frusttrating…

i’ve now upgraded to panther and its auomatic python 2.3. i’ve set my pyhton file path to /library/pyhton/2.3 - having also tried pointing it at various other python locations. but i stilll get the error message ‘no module named math’ etc etc.

i have looked at the pyhton path 101 threads on this forum and seen the stuff about terminal commnads to set python paths but another guy i know got it working just fine without doing all this.

anyone have any clue what’s not happening?

best

andy g