TypeError: __name__ must be set to a string object
frank at chagford.com
Fri Jan 15 09:06:36 CET 2010
"Frank Millman" <frank at chagford.com> wrote in message
news:hieoq6$4i8$1 at ger.gmane.org...
> Hi all
> This problem is similar to one I posted recently regarding the
> multiprocessing module and unicode.
> However, although this one manifests itself while using the
> multiprocessing module, is caused by Python itself (2.6.2).
> At the top of my program I have 'from __future__ import unicode_literals'.
> The relevant lines from my program read -
> from multiprocessing.managers import BaseManager
> class MyManager(BaseManager): pass
> MyManager.register('my_function', my_function)
> Inside the multiprocessing module, the following lines are executed -
> def register(cls, typeid, ...)
> def temp(...):
> temp.__name__ = typeid
> At this point, Python raises the exception 'TypeError: __name__ must be
> set to a string object'.
> I can fix it by changing my last line to -
> MyManager.register(str('my_function'), my_function)
> Is there any reason why __name__ cannot be a unicode object in Python 2.x?
> If so, there is probably little chance of this being changed, so it is
> probably not worth reporting.
For the record, I filed a report on January 13th -
More information about the Python-list