Python 2.7.3 tempfile.py, ln34, from random import Random as _Random

dbv dineshbvadhia at hotmail.com
Mon Mar 25 13:29:50 CET 2013


In Python 2.7.3, at ln34 the source file tempfile.py states:

from random import Random as _Random

But, Random is a Class.

The project imports werkzeug and using PyInstaller, the Traceback is:

Traceback (most recent call last):
  File "<string>", line 9, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 404, in load_module
    module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
  File "xserver.pyx", line 18, in init xserver (//home//ubuntu//Programs//myproject//myproject_pyx/xserver.c:2481)
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "//home//ubuntu//Programs//myproject//myproject_pi2/build/pyi.linux2/myproject/out00-PYZ.pyz/werkzeug.wrappers", line 26, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "//home//ubuntu//Programs//myproject//myproject_pi2/build/pyi.linux2/myproject/out00-PYZ.pyz/werkzeug.http", line 25, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "//home//ubuntu//Programs//myproject//myproject_pi2/build/pyi.linux2/myproject/out00-PYZ.pyz/urllib2", line 94, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "//home//ubuntu//Programs//myproject//myproject_pi2/build/pyi.linux2/myproject/out00-PYZ.pyz/httplib", line 79, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "//home//ubuntu//Programs//myproject//myproject_pi2/build/pyi.linux2/myproject/out00-PYZ.pyz/mimetools", line 6, in <module>
  File "/home/ubuntu/Programs/pyinstaller-2.0/PyInstaller/loader/pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "//home//ubuntu//Programs//myproject//myproject_pi2/build/pyi.linux2/myproject/out00-PYZ.pyz/tempfile", line 34, in <module>
ImportError: cannot import name Random

Is this a bug?  Or, is there some workaround available?  Thx.



More information about the Python-list mailing list