trouble running Python scripts

Hi all.
It’s the usual old question I guess.
How do you run Python scripts?
I know it’s Alt-P with the cursor in the text window.
But it only works with the “head” script.
When I run say, the grass3 script I get this:

PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “Grass3”, line 40, in ?
ImportError: No module named random

I installed Python 2.0.1 but I get the same result as with the earlier
version. Nothing.

I have Win '98 SE and Blender 2.23.

Any idea?

Did you set your PYTHONPATH envirronement variable in Autoexec.bat?

If not, you can still do it directly in Blender in one of these two ways:

  • Pull down the top window and type the path to the LIB directory (in the Python folder) in the Python button (on the left)

  • add this code directly in the script at the top:


import sys
sys.path.append("c:/python20/lib")

that is, if you instaled in c:/python20, of course.

Martin

I was just wondering where you could do that directly using blender.

thanks for the info theeth.

I never knew about that pull down at the top… :wink:

Thanks Martin!
That’s what it was.