More help needed to get Python working...

I looked through this forum trying to figure out how to get things set up, but I’ve had no luck as yet. Perhaps someone knows hat I’m doing wrong?

I started by installing Python from their site. Then, I found a few simple commands to enter into the script window. But pressing Alt+P did not make it do anything.

Any suggestions?

When Blender luanch, so does another window that lokjs like a command prompt. Any output should be priunted in there. I did the same thing.

Ah, thank you. I think I’m starting to grasp this system a little bit better. :slight_smile:

I was trying to get this working so I could run a Python script which imports and exports OBJ files. which someone was kind enough to link to for me. Running it I get the following output in the Command window:

Traceback (most recent call last):
File “OBJIO.py”, line 144, in EventGUI
File “OBJIO.py”, line 260, in ImportFunction
File “OBJIO.py”, line 465, in ObjImport
UnboundLocalError: Local variable ‘Ks’ referenced before assignment

(And the object is not imported.)

Any suggestions?

Well… I just tried a different OBJ import script. And at the end of this one, it outputs this message:

PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “objimport.py”, line 163, in callbackFile “objimport.py”, line 163, in callback
File “objimport.py”, line 105, in callbackFile “objimport.py”, line 163, in testObjImport
AtrributeError: GetCurrentScreen

Try creating a new python script in blender and typing:
import sys
print sys.path

Hit ALT-P to run the script, then check the DOS/Terminal window and see what’s there. It should list the paths set for python.

Also, pulldown the bar at the top of the Blender window to view the blender settings and in the Python box, add c:\python\lib or whatever the path is to your python installation’s lib directory.

Make sure you’re using Blender 2.23 rather than the 2.25 publisher version. I believe this has a different API which means old plugins/scripts might not work.

Try Python 1.52 instead of the latest one. I found the latest version worked fine for scripts in Blender but wouldn’t work with Lightflow, so I ended up installing both.

Try a few other python scripts and see if they work. If others work but this one doesn’t then it’s something specific to the script. If none of them work then it suggests a problem with your python or blender config.

I spent a while going through various websites and searching the forums to get python scripts running but I got there in the end!

I’ve succesfully run a different script. (Not one that imports OBJs though.)

When I went to change the Python setting on the Info bar, the only Python input box I saw had a tooltip saying “The default directory for Python scripts”. Is this the right one? (I tried giving it the directory, no luck.)

I am using 2.23, and I’ve installed Python 1.52, as you suggested. Still no luck. :-?

This script is not completly ended.
Try this one instead:
http://www.zoo-logique.org/3D.Blender/zip/obj-io-modif.zip

jm

ps: blender 2.23 python is compatible withe python 2.0 not with 1.52.

Thanks, JMS!! This has completely fixed it, and does everything that I’d hoped. :smiley: