Page MenuHome

Function and modules recognized as "NoneType" when not part of the Operator Class namespace
Closed, ResolvedPublic


This bug report shows a strange bevahiour in Blender bpy introduced after rev.26569 .My guess is that it's related to namespace.

1) Global functions are recognizes as being "NoneType" therefore can't be called
- solution to move them to inside the Operator Class [Not handy for big scripts though]

2) Imported modules have to be re-imported to be accessed from an Operator class.

To test it go to bug.blend and run the scripts. The file is self-explanatory (I hope).

It's probably something I'm doing wrong, dunno. I've been away for one month, so I may have missed some important API change.

Tested in Windows 64 (blender 32) with rev. 31365 (after 2.5Beta3). Using Python from lib/windows/




Event Timeline

I think this is the issue that we discussed on IRC a while ago, this didn't work with python 3.1.0 and does work with python 3.1.2. Probably Nathan has upgrading the python version on his todo list?

Indeed, is on the todolist.

these two problems seemed to begin after auto-registration. In addition to whats listed above, there is also a problem with on-the-fly class generation. If you generate classes they appear to get registered (ie you can find them in the operator search) but you can't call them. The workaround is to unregister each class after generation then register it again eg...

def gen_class(...):
opclass = type(..., (bpy.types.Operator,), dict(
bl_description = ...,
bl_options={'REGISTER', 'UNDO'},
return opclass


I'm not sure if this is related to the python version problem or simply to the auto registration code?
hope this helps, josh

Hey Josh, do you think you can put your problem in a example .blend file. Just so when Nathan updates the Python all the 3 bugs can be tested (in case the 3rd one is not related with that, otherwise the bug report can end up closed with still remaining issues).

argh this bug is even worse. Another test for it:
Go to Console Editor:
$ import urllib
$ urllib.<Ctrl+Tab>
you should see 4 modules, however only parse is available

With Python 3.1.2 (or importing the modules from an addon):

I have updated the Python libraries in lib/windows and lib/win64. Please update and rebuild against those.

All the scripts in bug.blend give a nice "It worked!"

Please verify and report back. Builds with the new python can be retrieved at top part of right sidebar.

Very nice, works great!

Hm strange. The reported file really works well, but the urllib test still fails here. (even though the submodules are accessible from an addon (e.g. - ))

Do you want me to open a new report for that?

Windows 7 Pro, CMake+MSVC - Python 3.1.2

closing. moving the urllib problem for another bugreport.

Dalai Felinto (dfelinto) closed this task as Resolved.Sep 3 2010, 8:03 AM