Re: [gevent] Subject: 'module' object has no attribute '_fileobject'

319 views
Skip to first unread message

Ralf Schmitt

unread,
Mar 28, 2013, 9:28:43 AM3/28/13
to gev...@googlegroups.com
dbv <dinesh...@hotmail.com> writes:

> Environment: Ubuntu 12.04, Windows XP/7, virtualenv 1.9.1, Python 2.73,
> Numpy 1.7.0, Scipy 0.11, PyInstaller 2.0

you don't tell us which version of gevent you're using.

>
> Generating executable with PyInstaller (in a virtualenv) and got the
> following error:
[snip]
>
> Any ideas what might be going on?

gevent uses some hidden imports and uses modules that may conflict with
stdlib modules if you're packager fails to handle them in the right way
(gevent.os, gevent.socket).

the github version and rc2 contains some code to 'unhide' those hidden
imports.

bbfreeze (https://github.com/schmir/bbfreeze) may be able to freeze you
application (use the git version, it contains some fixes for gevent)

please also see https://github.com/SiteSupport/gevent/issues/181

>
> Btw, does gevent have to be imported into every source file even if source
> file doesn't use gevent?

yes, that's because monkeypatching should happen as one of the first
things a program does.

--
Cheers
Ralf

dbv

unread,
Mar 28, 2013, 10:07:18 AM3/28/13
to gev...@googlegroups.com, ra...@systemexit.de
gevent 0.13.8.
Will try the gevent github version.
Will definitely look at bbfreeze.
If project consists of multiple source files, then each source file must import gevent and monkey.patch (even if a source file doesn't use gevent):  will do this right now.

dbv

unread,
Mar 28, 2013, 1:40:20 PM3/28/13
to gev...@googlegroups.com, ra...@systemexit.de
Upgraded to gevent 1.0rc2.

The error generated by PyInstaller is:

Traceback (most recent call last):
  File "<string>", line 28, in <module>
  File "d://pyinstaller-2.0//PyInstaller//loader//pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "d://myprogram//myprogram_pi2//build//pyi.win32//myprogram_bs//out00-PYZ.pyz//os", line 11, in <module>
  File "d://pyinstaller-2.0//PyInstaller//loader//pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "d://myprogram//myprogram_pi2//build//pyi.win32//myprogram_bs//out00-PYZ.pyz//gevent", line 36, in <module>
  File "d://pyinstaller-2.0//PyInstaller//loader//pyi_importers.py", line 268, in load_module
    exec(bytecode, module.__dict__)
  File "d://myprogram//myprogram_pi2//build//pyi.win32//myprogram_bs//out00-PYZ.pyz//gevent.hub", line 241, in <module>
  File "d://myprogram//myprogram_pi2//build//pyi.win32//myprogram_bs//out00-PYZ.pyz//gevent.hub", line 249, in Hub
  File "d://myprogram//myprogram_pi2//build//pyi.win32//myprogram_bs//out00-PYZ.pyz//gevent.hub", line 225, in config
 
AttributeError: 'module' object has no attribute 'environ'

line 225 in gevent.hub is:
    
result = os.environ.get(envvar) or default

Also, see "...out00-PYZ.pyz//os, line 11 .." in Traceback.

Is this an "import os" problem ?

Reply all
Reply to author
Forward
0 new messages