Blender Plugin Not Working

Do you need help? Ask here!

Bug reporting belongs here: http://developer.wz2100.net/newticket
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Blender Plugin Not Working

Post by Audacitor »

Problem Solved!  Solution is as follows:
This problem only affects Macintosh users using a PowerPC (PPC) architecture.  You poor souls.  The default Blender distribution for PPC computers is compiled using Python 2.3.5.  Python is the programming language that Blender was written in.  The PIE model plugin, however, was designed for Python 2.5 or later.  Fear not!  You can download a copy of Blender 2.45 built for Py2.5 here. For future copies of Blender or Python, see Blender's download page and look under custom builds for the PPC architecture.

Hey all.

I'm having trouble getting the Blender plugin for PIE models to work.  I have all have scripts listed in the readme placed in my plugins folder, and no others.  When I try to import a model, the script can't start, and Blender tells me to check the console.  When I try to export, Blender crashes.  I'm using Blender 2.45 on OS X 10.5.  Any ideas?
Last edited by Audacitor on 17 Jan 2008, 21:56, edited 1 time in total.
TANSTAAFL
User avatar
kage
Regular
Regular
Posts: 751
Joined: 05 Dec 2006, 21:45

Re: Blender Plugin Not Working

Post by kage »

open a terminal (you can get to it by pressing option+o, maybe?) and run `blender`. if blender starts, repeat the process, and show us whatever happened in the terminal
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Re: Blender Plugin Not Working

Post by Audacitor »

I don't know how to run Blender from the terminal, though I've tried figuring it out.  Really, the only thing I know how to do from a CLI is change directories.  I'll look it up, but help from here might be faster.

Also, I downloaded all the other scripts from the Blender plugin folder in the repository (including those not listed in the readme) the exporting script is now functional, but no changes to the import script.
TANSTAAFL
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Re: Blender Plugin Not Working

Post by Audacitor »

Well, I figured out how to launch blender via the terminal, but blender didn't output anything to it.  However, when I checked OS X's console, there was this:

[0x0-0x4f04f].org.blenderfoundation.blender[670]   File "", line 115
[0x0-0x4f04f].org.blenderfoundation.blender[670]     menustr += '|'.join("%s %%x%i" % (opt['opts'][j], j) for j in xrange(numopts))
[0x0-0x4f04f].org.blenderfoundation.blender[670] SyntaxError: invalid syntax

Since I don't know which script it's referring too, I'll just include line 115 from any script that looks like it might have been used in the importing process.

Here is line 115 in context from pie_common.py:

112 def append(self, process, draw=None, event=None, scrl_range=None, name=None):
113 if self._index >= 0:
114 raise ValueError("cannot append a beltlink after process has started")
115 if (draw or event) and not (draw and event):
116 raise TypeError("Both draw and event should be callable or both should be None")
117 self._beltlinks.append([process, draw, event, scrl_range])
118 if name: self._linknames[name] = len(self._beltlinks)

I'm not familiar with python, but it looks like a function definition to me.

Line 115 from pie.py is a comment, so prolly nothing there.

levels_to_layers.py doesn't have a line 115.  So that just leaves line 115 (in context) from pie_import.py:
It would take to long for me to add line numbers, so I'll just highlight 115 in blue.

else:
menustr = opt.get('title', "")
if menustr: menustr += "%t|"
menustr += '|'.join("%s %%x%i" % (opt['opts'][j], j) for j in xrange(numopts))
opt['val'] = Draw.Menu(menustr, i, buttonpos, posY, buttonwidth,
buttonheight, val, tooltip)
Draw.Label(opt['label'], rect[0] + margin, posY, labelwidth, buttonheight)

// Kamaze: Added code tags.
// DevUrandom: Removed code tags, since code cannot be coloured. Instead strip the sniped down a bit.
Last edited by DevUrandom on 16 Jan 2008, 13:11, edited 1 time in total.
TANSTAAFL
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Blender Plugin Not Working

Post by DevUrandom »

That last one (pie_import.py) look exactly like it has produced the error.
Which version of Python do you run? "python --version" should tell you, when typed into the OSX terminal.
User avatar
kage
Regular
Regular
Posts: 751
Joined: 05 Dec 2006, 21:45

Re: Blender Plugin Not Working

Post by kage »

that's valid syntax for python 2.4, and i'll bet that since os x doesn't like to bundle anything later than 2.3 (since last i heard), it's getting confused by the generator comprehension i'm using (which probably was added to the language in 2.4).

and yeah, python will always handle import statements gracefully in the debugger, so if you see 'File ""...', it's the main script, which in this case would've been pie_import.py.

try replacing line 115 in pie_import.py with:

menustr += '|'.join(["%s %%x%i" % (opt['opts'][j], j) for j in xrange(numopts)])

but make sure you tab it (tabs, not spaces) back to where it was before, which should aligned with the next line (line 116). if it works, i'll submit a fix (or you can) of that file for the mac users, which everyone else would be able to use as well. the code is a little less efficient after the change, but almost certainly not in a noticable way.
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Re: Blender Plugin Not Working

Post by Audacitor »

My Terminal says I have Python 2.5.1, but when I accidentally compiled pie_import instead of opening it in TextWrangler, the console said it compiled it with 2.3.5.

Kage's fix got roadblock one out of the way, but now it's complaining about line 331:
menustr += ''.join("|%s %%x%i" % (options, i) for i in xrange(numopts))

Sensing a pattern, I searched for similar code throughout the script, but I didn't find any, so hopefully this is that last one. :)

In the meantime, I'm gonna look into upgrading my Python.
TANSTAAFL
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Blender Plugin Not Working

Post by DevUrandom »

I wanted to fix it in SVN, but when I run Blender out of an other directory than trunk/tools/blender/, I get this error:
Traceback (most recent call last):
  File "", line 49, in
ImportError: No module named pie_common
Any idea why? I have set the Python path in Blender's User Preferences...
User avatar
kage
Regular
Regular
Posts: 751
Joined: 05 Dec 2006, 21:45

Re: Blender Plugin Not Working

Post by kage »

DevUrandom wrote: I wanted to fix it in SVN, but when I run Blender out of an other directory than trunk/tools/blender/, I get this error:
Any idea why? I have set the Python path in Blender's User Preferences...
don't know enough about the blender/python quirks in that area, sorry. i'm actually a little surprised it searches for the scripts in the cwd.

as a temporary fix, though, you can actually probably get away with this for a while (in bash -- convert as needed  for other shells)

`alias blender-wz=cd SOME-PATH/trunk/tools/blender; blender; cd -`
`blender-wz`
Audacitor wrote: My Terminal says I have Python 2.5.1, but when I accidentally compiled pie_import instead of opening it in TextWrangler, the console said it compiled it with 2.3.5.

Kage's fix got roadblock one out of the way, but now it's complaining about line 331:
menustr += ''.join("|%s %%x%i" % (options, i) for i in xrange(numopts))

Sensing a pattern, I searched for similar code throughout the script, but I didn't find any, so hopefully this is that last one. :)

In the meantime, I'm gonna look into upgrading my Python.


yeah, every time you get an error like that, just add brackets ('[' and ']') between the first and last parentheses, and it should work. also, when you find any others, if at all, please mention the filename and line number, and i'll be sure to fix them.

your system might have 2.5.1 installed, but blender could have a built-in interpereter (doesn't make sense for mac, though), or it could be linking directly to /usr/bin/python2.3 (or whatever the location is in os x), as until very recently, if even at all yet, apple has more or less forsaken newer python versions (to the great annoyance of many python programmers).
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Re: Blender Plugin Not Working

Post by Audacitor »

Success!  Line 331 (which is actually 311, I made a typo) works.  After that, it complained about 451, but that brackets worked there as well.  So, to wrap things up, line 115 needs to be

Code: Select all

menustr += '|'.join(["%s %%x%i" % (opt['opts'][j], j) for j in xrange(numopts)])
Line 311 needs to be

Code: Select all

menustr += ''.join(["|%s %%x%i" % (options[i], i) for i in xrange(numopts)])
and 451 needs to be

Code: Select all

for p in ([nbPoints - p for p in xrange(1, nbPoints)]):
Thanks, all.
TANSTAAFL
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Re: Blender Plugin Not Working

Post by Audacitor »

I hate to take back that success marker, but I have to.  The plugin will start well enough, it'll let you select which PIE you want to import, select general options, successfully save those options as the default, but after that, it wants me the check the console.  I don't know what to do with this particular error:

Code: Select all

1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381] Compiled with Python version 2.3.5. 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381] Checking for installed Python... got it! 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381] version 2 pie detected 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381] type 512 pie detected 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381] Traceback (most recent call last): 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "/Applications/Computer Generated Imagery/Blender/plugins/pie_common.py", line 173, in _evt 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]     retval = self._process() 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "/Applications/Computer Generated Imagery/Blender/plugins/pie_common.py", line 153, in _process 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]     return func(self) 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "<string>", line 273, in texpage_process 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "<string>", line 63, in seek_to_directive 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "/Applications/Computer Generated Imagery/Blender/plugins/pie.py", line 179, in data_mutator 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]     for i in gen: 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "/Applications/Computer Generated Imagery/Blender/plugins/pie.py", line 139, in parse 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]     vals.extend(_directive_handlers[first](rest[1])) 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]   File "/Applications/Computer Generated Imagery/Blender/plugins/pie.py", line 86, in _handle_texture 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381]     s, x, y = s.rsplit(None, 2) 
1/17/08 2:04:55 AM [0x0-0x115115].org.blenderfoundation.blender[2381] AttributeError: 'str' object has no attribute 'rsplit'
TANSTAAFL
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Blender Plugin Not Working

Post by DevUrandom »

This seems as if Python 2.3 doesn't support the rsplit function either...
Kage: Can you make up a patch for all those issues, so I can commit it to SVN?
User avatar
Buginator
Professional
Professional
Posts: 3285
Joined: 04 Nov 2007, 02:20

Re: Blender Plugin Not Working

Post by Buginator »

DevUrandom wrote: This seems as if Python 2.3 doesn't support the rsplit function either...
Kage: Can you make up a patch for all those issues, so I can commit it to SVN?
I don't know why we just don't require Python 2.5 (or whatever), and be done with it?
This is like the guy who did the changes that require Python 2.5, and now, it is just sitting around waiting to be committed once the server kinks are worked out.

Not trying to be rude, but AFAIK, both windows & linux & most everyone else have already updated to the latest release, so why shouldn't mac people?  Is this a apple specific thing or something? 
and it ends here.
User avatar
Audacitor
Rookie
Rookie
Posts: 17
Joined: 15 Jan 2008, 09:36

Re: Blender Plugin Not Working

Post by Audacitor »

I have Python 2.5.1 installed.  In fact, the updates for Python are delivered automatically through the OS's updating software.  Blender, however, still uses Python 2.3.5. (That's what it says it was compiled with).  I have the latest Blender as well, so... I dunno.
TANSTAAFL
User avatar
DevUrandom
Regular
Regular
Posts: 1690
Joined: 31 Jul 2006, 23:14

Re: Blender Plugin Not Working

Post by DevUrandom »

Buginator wrote: I don't know why we just don't require Python 2.5 (or whatever), and be done with it?
This is like the guy who did the changes that require Python 2.5, and now, it is just sitting around waiting to be committed once the server kinks are worked out.

Not trying to be rude, but AFAIK, both windows & linux & most everyone else have already updated to the latest release, so why shouldn't mac people?  Is this a apple specific thing or something? 
Problem in this case is that Blender seems to use its own Python. :(
So we can't require anything, because people are not able to satisfy those requirements.