[Twisted-Python] os x installer, multiple source locations

Matt Bennett matt at bennett.name
Fri Sep 4 17:50:36 MDT 2009


Hello all,

I used the Twisted 8.2.0 for OS X 10.5 installer from [1] to install
twisted on my mac. I don't understand why, but I seem to have two
copies of the source on the disk, one at
/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/twisted
and another at /Library/Python/2.5/site-packages/twisted. Both
locations are on sys.path, the former taking precedence.

More curiously, the two versions appear to be different. The following
snippet fails with the version that python finds by default:

from twisted.python import usage

class Options(usage.Options):
    optParameters = [["shiny_integer", "s", 1, None, int]]
    optParameters = [["dummy_float", "d", 3.14159, None, float]]

o = Options()

Resulting in:

Traceback (most recent call last):
  File "options.py", line 7, in <module>
    o = Options()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/twisted/python/usage.py",
line 120, in __init__
    (longOpt, shortOpt, docs, settings, synonyms, dispatch) = c()
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/twisted/python/usage.py",
line 287, in _gather_parameters
    long, short, default, doc = util.padTo(4, parameter)
  File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/twisted/python/util.py",
line 227, in padTo
    raise ValueError, "%d elements is more than %d." % (len(seq), n)
ValueError: 5 elements is more than 4.

The same snippet works with the version in the other location. Is this a bug?

Thanks,
Matt.

[1] http://tmrc.mit.edu/mirror/twisted/Twisted/8.2/Twisted-8.2.0_py2.5_osx10.5.dmg




More information about the Twisted-Python mailing list