[Tutor] Python 2.4 with Mandrake 10.0 query

Glen stygian at tesco.net
Thu Feb 3 00:53:29 CET 2005


On Wed, 2005-02-02 at 22:02, Danny Yoo wrote:
> 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!
> 
You're a genius! That's exactly what I'd done.
It also explains the odd results I was getting when I did import 
the sets module.
Thanks, I'll have a look at your module.
Glen



More information about the Tutor mailing list