[Tutor] Python 2.4 with Mandrake 10.0 query

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed Feb 2 23:02:55 CET 2005



On Wed, 2 Feb 2005, Glen wrote:

> [glen at localhost glen]$ idle
> set([34, 36, 38, 39])
> Failed to load extension 'CodeContext'
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.4/idlelib/EditorWindow.py", line 737, in
> load_standard_extensions
>     self.load_extension(name)
>   File "/usr/local/lib/python2.4/idlelib/EditorWindow.py", line 747, in
> load_extension
>     mod = __import__(name, globals(), locals(), [])
>   File "/usr/local/lib/python2.4/idlelib/CodeContext.py", line 15, in ?
>     from sets import Set
> ImportError: cannot import name Set

Hi Glen,


Ah!  Check to see if there's a "sets.py" program somewhere in your current
working directory.  It's very likely that Python is picking that up,
instead of the 'sets' standard library module.

This is one thing that does bite people every so often, because it's all
too easy to accidently write a program uses the same name as a standard
library module.

I wrote a small module a while back as a proposed solution to the issue:

    http://hkn.eecs.berkeley.edu/~dyoo/python/__std__/

but I don't think it's really being used.

Best of wishes to you!



More information about the Tutor mailing list