Python Errors?????


(Cujo31) #1

Hey all I am trying to use the OBJ and LWO import scripts and I keep getting the following error:

Traceback (most recent call last):
File: "c:\programfles\blender\objimport.py, line 163,in callback testOBJimport(filename)
File: "c:\programfles\blender\objimport.py, line 105,in testOBJimport scene=Blender.Getcurrentscene<>

AttributeError: getCurrentscene

What the heck does all this mean???

HELP!!!

Cujo31


(acasto) #2

what version of blender you using? I just figured this stuff out last night though, so I may be wrong. In the new API the commands changed, and there is a submodule in the Blender module called Scene, and a function of Scene is getCurrent(), which get the current scene. I printed out some documentation for the new python commands (some may be missing because I got a bunch of extraneous monotenous output, and I organized it quickly to what it is).
http://iptic.com/html/pydoc.html
This link is to the current module info

Have fun!


(Schlops) #3

Change getCurrentscene() to getCurrentScene()


(Xtra) #4

Hi Acasto!

I have the same problem and I’m absolutely not familiar with Python so could you please post the correct syntax for the old getCurrentScene Module?

Thanks
Xtra


(acasto) #5

I got it to go through one time, I just can’t remeber what I did. I think that syntax though (getCurrentScene, getCurrentFrame, etc…) is for the old api. I think for the new one, instead of it all being it’s own call, there’s a function such as ‘Get()’, then in the paretheses you use something like ‘curframe’ or ‘curtime’.

I’m not sure though. The docs I mad was for publisher 2.25, I did a check (print dir(Blender), etc…) on the 2.23 and it did lack quite a few things from the 2.25, so I’m not really sure on what it is.

It gets confusing haveing so many changes and so little documentation, and on top of that there is like 3 different versions of python.


(Schlops) #6

@Xtra: Did you read my above mesg? Did it work? Another Solution: Put the line import Blender210 as Blender in the script (top line).
@acasto: There is also a module called Blender210


(acasto) #7

There still is even in the new api ? I seen in the Blender module an almost redundant module labeled _Blender. I don’t really know what though.


(Xtra) #8

Hi all!

Schlops, you’re right! The line ‘import Blender210 as Blender’ works, but now I get a new error :-?

This ist the error message:

File “vlightexport210.py”, line 211, in removeDot
AttributError: compile

The corresponding code fragment:

def removeDot(name, printResults = 1):
# Blender automatically names duped objects with “.” Virtual light
# does not play well with either that or other non-word characters.
p = re.compile("\W") <---------- THIS IS LINE 211
fixedName = p.sub("_", name)
if p.search(name):
if printResults:
print “%s renamed to %s…” % (name, fixedName)
return fixedName

If this script will not working in the nearest future, I’ll open my window and jump out of it … :wink:

Thanks so far
Xtra


(Cujo31) #9

Hey Extra…

Whose script are you using and what version of Blender???

I can’t even get it that far… It starts running the script then crash Blender with a fatal error???

thanks for the help :stuck_out_tongue:

Cujo


(Xtra) #10

Hello Cujo,

I’m using vlightexport210.py from the virtua light homepage. Please don’t ask wich Blender version I used to test the scripts. I tried it with different combinations (Blender 2.23, 2.11 with Python 2.0 and 2.1 - all this stuff with Linux and Windows) and different script versions (vlightexport.py, vlightexport210.py). I tried it with some changes in the script (unfortunately I am absolutely not familiar with Python). I tried everything but it still don’t work. I’m really tired of Python scripts at the moment. I can’t believe that someone get this script running on his machine.

I really want to have Raytracing with caustics, so I have two possibilities, from my point of view:

    • learn how to use Python
  • get some practice with Python
  • learn how to use Python with the Blender API
  • get some practice with Python/Blender
  • reprogramm the script
    • save some money
  • buy Cinema 4D XL 7 (Art)

Well, both ways will take a couple of months, but the second seems to be more comfortable … :wink:

Oh, I’ve forgotten the third way: to open the window and jump out of it. But even this won’t really help: I’m living on the ground floor :wink:

If somebody will have a solution for this script problem, please send me a mail. If it will work then, you’ll get a beer or - if you’re under 21 years old - something else. :slight_smile:

Regards,
Xtra


(Schlops) #11

Hey Xtra, keep your window closed! And don’t Jump! :wink:
First: Is there a line import re somewhere in the script? If not: add it!
Second: Always use Python 2.0.1 with blender. and set your PYTHONPATH-variable:
Linux (your .bashrc): export PYTHONPATH=.:/usr/local/lib/python2.0:/usr/local/lib/python2.0/site-packages:/usr/local/lib/python2.0/plat-linux2:/usr/local/lib/python2.0/lib-tk:/usr/local/lib/python2.0/lib-dynload:/usr/local/lib/python2.0/lib-old
Windows (autoexec.bat, or that XP-dialog where you do funny things like this):
set PYTHONPATH=.;c:\programme\python;c:\programme\python\dlls;c:\programme\python\lib;c:\programme\python\lib\plat-win;c:\programme\python\lib\lib-tk;c:\programme\python\lib\site-packages
Adjust the path to your needs.