Page 1 of 1

Bug with 1.3.0

PostPosted: Sun Mar 02, 2008 1:53 pm
by Chacal
While trying to import any Cyan prp.

Code: Select all
Traceback (most recent call last):
  File "<string>", line 150, in open_file
  File "<string>", line 111, in import_prp
  File "<string>", line 93, in import_age
  File "D:\Graph\Blender\.blender\scripts\alcresmanager.py", line 908, in import_page
    page.import_all()
  File "D:\Graph\Blender\.blender\scripts\alcresmanager.py", line 195, in import_all
    self.load()
  File "D:\Graph\Blender\.blender\scripts\alcresmanager.py", line 126, in load
    self.prp.read(f)
  File "D:\Graph\Blender\.blender\scripts\alcprpfile.py", line 583, in read
    obj.read(buf)
  File "D:\Graph\Blender\.blender\scripts\alcprpfile.py", line 381, in read
    o.read(buf,offset,size)
  File "D:\Graph\Blender\.blender\scripts\alcprpfile.py", line 290, in read
    self.data.read(buf)
  File "D:\Graph\Blender\.blender\scripts\alc_MatClasses.py", line 2494, in read

    plLayerAnimationBase.read(self, stream)
  File "D:\Graph\Blender\.blender\scripts\alc_MatClasses.py", line 2458, in read

    self.fPreshadeColorCtl = PrpController(stream.Read16(), self.getVersion())
NameError: global name 'PrpController' is not defined

Re: Bug with 1.3.0

PostPosted: Sun Mar 02, 2008 2:12 pm
by Paradox
D'oh! I wish I knew what was causing the extra issue with anim class import, but it should be fixed now. Download Latest.zip again and let me know if it works.

http://www.guildofwriters.com/pyprp/latest.zip

Re: Bug with 1.3.0

PostPosted: Sun Mar 02, 2008 2:13 pm
by D'Lanor
That is strange. Since alc_AnimClasses is imported with...

Code: Select all
from alc_AnimClasses import *


...it does not need to be prefixed with the name of the module.

Is alc_AnimClasses.py in your scripts folder?

Re: Bug with 1.3.0

PostPosted: Sun Mar 02, 2008 2:25 pm
by Paradox
yes, I've had the same problem multiple times when testing the export. The file is clearly there, and I have no idea why it's causing the random errors :(

Re: Bug with 1.3.0

PostPosted: Sun Mar 02, 2008 7:15 pm
by belford
Is this a situation where two modules are trying to "import" each other? That's usually what's going on when I see mysterious import problems.

Re: Bug with 1.3.0

PostPosted: Sun Mar 02, 2008 9:38 pm
by Chacal
Paradox wrote:D'oh! I wish I knew what was causing the extra issue with anim class import, but it should be fixed now. Download Latest.zip again and let me know if it works.

http://www.guildofwriters.com/pyprp/latest.zip


Slightly different error now:

Code: Select all
[Type: 0x122]
[Type: 0x43]
Traceback (most recent call last):
  File "<string>", line 150, in open_file
  File "<string>", line 111, in import_prp
  File "<string>", line 93, in import_age
  File "D:\Graph\Blender\.blender\scripts\alcresmanager.py", line 908, in import_page
    page.import_all()
  File "D:\Graph\Blender\.blender\scripts\alcresmanager.py", line 195, in import_all
    self.load()
  File "D:\Graph\Blender\.blender\scripts\alcresmanager.py", line 126, in load
    self.prp.read(f)
  File "D:\Graph\Blender\.blender\scripts\alcprpfile.py", line 583, in read
    obj.read(buf)
  File "D:\Graph\Blender\.blender\scripts\alcprpfile.py", line 381, in read
    o.read(buf,offset,size)
  File "D:\Graph\Blender\.blender\scripts\alcprpfile.py", line 290, in read
    self.data.read(buf)
  File "D:\Graph\Blender\.blender\scripts\alc_MatClasses.py", line 2495, in read

    self.fTimeConvert.read(stream)
AttributeError: 'NoneType' object has no attribute 'read'

Re: Bug with 1.3.0

PostPosted: Mon Mar 03, 2008 11:44 am
by D'Lanor
belford wrote:Is this a situation where two modules are trying to "import" each other? That's usually what's going on when I see mysterious import problems.

Yes, alc_MatClasses and alc_AnimClasses are importing each other.

And alc_MatClasses is importing alc_AnimClasses in two different ways. I guess this needs some code cleaning.

Re: Bug with 1.3.0

PostPosted: Mon Mar 03, 2008 4:56 pm
by D'Lanor
What the heek? Now PyPRP suddenly generates bad sum files... :o

Re: Bug with 1.3.0

PostPosted: Mon Mar 03, 2008 10:51 pm
by belford
Yeah, you really want to import the minimum necessary in any given file.

It also helps a lot to move import statements to the *end* of the file, where possible. It's not always possible; if you're declaring some "class X(Y):" then Y has to be imported up top. But if you only use a symbol inside a function (or method), then its import statement can be at the bottom of the file. And that avoids a lot of the trouble.

(Mutual imports aren't illegal; you just have to be careful.)