[Distutils] OS X problem with pkg_resources and the twisted event loop
Michael Twomey
micktwomey at gmail.com
Thu Jan 19 17:59:51 CET 2006
Hi,
I've come across a problem with an easy_install managed package
(matplotlib) on my OS X box. When I try to import it for the first
time inside of a twisted application I get this nasty traceback:
Traceback (most recent call last):
File "/Users/mtt/Desktop/twisted_macosx_vers.py", line 12, in ?
reactor.run()
File "/usr/local/lib/python2.4/site-packages/twisted/internet/posixbase.py",
line 206, in run
self.mainLoop()
File "/usr/local/lib/python2.4/site-packages/twisted/internet/posixbase.py",
line 214, in mainLoop
self.runUntilCurrent()
--- <exception caught here> ---
File "/usr/local/lib/python2.4/site-packages/twisted/internet/base.py",
line 541, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/Users/mtt/Desktop/twisted_macosx_vers.py", line 4, in get_platform
import pkg_resources
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py",
line 534, in ?
class Environment(object):
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py",
line 537, in Environment
def __init__(self,search_path=None,platform=get_platform(),python=PY_MAJOR):
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py",
line 147, in get_platform
version = _macosx_vers()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/setuptools-0.6a9-py2.4.egg/pkg_resources.py",
line 126, in _macosx_vers
info = os.popen('/usr/bin/sw_vers').read().splitlines()
exceptions.IOError: [Errno 4] Interrupted system call
This seems to be caused by twisted's signal handling, which breaks
os.popen (and subprocess), see this bug:
http://twistedmatrix.com/bugs/issue733
I've attached a simple test script which triggers the problem (most of
the time for me, you have to run it a few times as it doesn't always
crash).
I've got a work around though:
If I import pkg_resources before starting my twisted app it seems to
fix the problem. (I presume that get_platform's output is being kept
somewhere, Environment's __init__ args I think.)
cheers,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twisted_macosx_vers.py
Type: application/octet-stream
Size: 237 bytes
Desc: not available
Url : http://mail.python.org/pipermail/distutils-sig/attachments/20060119/8deb617a/attachment.obj
More information about the Distutils-SIG
mailing list