[py-dev] Greenlet module appears to be rebuilt on every import

Benno Rice benno at jeamland.net
Sun Jul 23 15:39:46 CEST 2006


Hi,

I'm running into an odd problem trying to use greenlets on Mac OS X  
10.4.7 with Python 2.4 built from DarwinPorts and the py lib from  
subversion as of 23 July 2006.

Whenever I try to import greenlets I get the following:

Python 2.4.3 (#1, Apr 20 2006, 12:04:55)
[GCC 4.0.0 (Apple Computer, Inc. build 5026)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from py.magic import greenlet
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/initpkg.py", line 180, in __getattr__
     result = self.__package__._resolve(extpy)
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/initpkg.py", line 68, in _resolve
     implmodule = self._loadimpl(fspath[:-3])
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/initpkg.py", line 98, in _loadimpl
     return __import__(modpath, None, None, ['__doc__'])
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/magic/greenlet.py", line 5, in ?
     greenlet = path.getpymodule().greenlet
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/path/local/local.py", line 404, in  
getpymodule
     mod = make_module_from_c(self)
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/misc/buildcmodule.py", line 37, in  
make_module_from_c
     lib.remove()
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/path/local/posix.py", line 111, in remove
     self._callex(os.remove, self.strpath)
   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.4/ 
lib/python2.4/site-packages/py/path/common.py", line 227, in _callex
     raise cls, value
py.error.EACCES: [Permission denied]: remove('/opt/local/Library/ 
Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/ 
py/c-extension/greenlet/greenlet.so',)

I've checked this out and it looks like something in the import logic  
wants to compile the greenlet module every time I import it.  This  
leads to two questions:

1) Shouldn't the greenlet module get built when I run the build  
target of the setup.py script?
2) Isn't this a rather large bug in normal operation since the site- 
packages directory should be owned by root?

Is there a way to have the greenlet module be built once during the  
build phase of setup.py and then just used statically after that?

-- 
Benno Rice
benno at jeamland.net
http://jeamland.net/




More information about the py-dev mailing list