Nigel Smart <> writes:

>> "set" is a built-in set data type in Python 2.4 and later. Twisted
>> has a compatibility module for older versions of Python. On my
>> system, the twisted/python/ file (from which the code tries
>> to import "set") has
>>   try:
>>       set = set
>>   except NameError:
>>       from sets import Set as set
>> which simply tests to see if "set" is defined, otherwise it imports
>> it From the sets module, which defines a Set class in old Python
>> versions.
> Have now added this line, and I get the error....

Uh, it was supposed to be a solution for you to add :-( It was an
explanation that you have a broken installation of Twisted.

First of all, Python works no unlike Java with regard to it's PYTHONPATH
environment variable. On my system I have installed Twisted into
~/opt/lib/python/ and have set PYTHONPATH to that same value.

Inside of ~/opt/lib/python/ I have

  -rwxr-xr-x  1 mgeisler users 230K May 16  2007
  drwxr-xr-x 24 mgeisler users 4.0K Sep 16  2008 twisted
  drwxr-xr-x  3 mgeisler users 4.0K Sep 16  2008 zope

among other files.

You can check that things are installed nicely by switching to some
other directory and starting the interactive python interpreter:

  % python
  Python 2.4.3 (#1, Jun 11 2009, 14:09:58)
  [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from twisted import version
  >>> version
  Version('twisted', 2, 5, 0)

Likewise for GMPY:

  >>> import gmpy
  >>> x = gmpy.mpz(1234567891234567891234567)
  >>> len(str(x**12345))

>> Which Python version are you using (python -V)? Which distribution is
>> this? Twisted is a standard component which is surely packaged for
>> the distribution -- there should be no need to installing it
>> yourself.
> Python 2.4.3 (#1, Sep  3 2009, 15:37:37)

That is fine, we have an old Redhat here with the same Python version.

> We have Centos as the OS, it is a managed distributed system.
>   - i.e. the filestore is shared and used by 150 odd machines.
> So I cant just add packages etc. If I want something installed which my
> path does not pick up I either have to
>   a) Search around to find it on the system
> or
>   b) Install it myself in my own space
> Clearly b usually takes less time ;-)

Heh, yeah.

> Also no-one in the dept seems to use python for anything, so I doubt
> python related stuff is instaleld. Which means option a is unlikely to
> work.

It's not like it will mess things up to install Python, Twisted, and
GMPY globally. The packages will just sit nicely in the corner and
nobody will notice :-)

Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See:
viff-devel mailing list (

Reply via email to