, is this a bug ?

Stef Mientki stef.mientki at
Fri Nov 6 22:33:37 CET 2009


I get an error compiling with pyjamas, in the standard module imputil, 

Traceback (most recent call last):
line 22, in <module>
    from Vragenlijsten import Get_Vragenlijst
  File "P:\Python\Lib\site-packages\pyjd\", line 109, in 
    top_module = self._import_top_module(parts[0])
  File "P:\Python\Lib\site-packages\pyjd\", line 217, in 
    module = item.import_top(name)
AttributeError: 'unicode' object has no attribute 'import_top'

It seems that elements of sys.path can be of the type unicode

    def _import_top_module(self, name):
        # scan sys.path looking for a location in the filesystem that 
        # the module, or an Importer object that can import the module.
        for item in sys.path:
            if isinstance(item, _StringType):
                module = self.fs_imp.import_from_dir(item, name)
                module = item.import_top(name)
            if module:
                return module
        return None

so by adding the next 2 lines, everything works ok.
            elif isinstance ( item, basestring ) :
                module = self.fs_imp.import_from_dir ( str(item), name)

is this a bug ?
(I'm using Python 2.5.2 on Windows )

Stef Mientki

More information about the Python-list mailing list