movpy-2.0.0-py2.4.4 - error importing pylab

28 views
Skip to first unread message

Kevin Horton

unread,
Apr 3, 2007, 11:33:52 AM4/3/07
to mo...@googlegroups.com
I'm trying to use pylab, installed as part of matplotlib from the movpy extensions page. But, I get an error when I try to import pylab in a script or in ipython. The log shows:

[err] Traceback (most recent call last):
[err] File "main.py", line 947, in ?
[err] File "Flt_Test_Data_Review_wx.py", line 23, in ?
[err] File "C:\Documents and Settings\hortonk\Desktop\Python\scripts\FT_Data_Review\GUI.py", line 27, in ?
[err] File "C:\Documents and Settings\hortonk\Desktop\Python\scripts\FT_Data_Review\ftdata.py", line 3, in ?
[err] File "C:\DOCUME~1\hortonk\Desktop\Python\MOVPY-~1.4\movpy\lib\matplotlib\pylab.py", line 200, in ?
[err] File "C:\DOCUME~1\hortonk\Desktop\Python\MOVPY-~1.4\movpy\lib\matplotlib\axes.py", line 18, in ?
[err] ImportError: cannot import name RegularPolyCollection

Line 3 in ftdata.py is:
import pylab

line 200 in pylab.py is:
from axes import Axes, PolarAxes

line 18 in axes.py is:
from collections import RegularPolyCollection, PolyCollection, LineCollection, QuadMesh

I looked in collections.py, and there is a class RegularPolyCollection, so it isn't clear what the problem is.

Ideas?

Kevin Horton
Ottawa, Canada

Fuzzyman

unread,
Apr 3, 2007, 11:51:44 AM4/3/07
to mo...@googlegroups.com
Hello Kevin,

One quick test you could do, from an interactive interpreter prompt, is
change the current directory to the directory that axes is in and then
add that directory to sys.path (just add '.').

Then do 'import collections' and print 'collections.__file__' to see if
it is picking up the right file.

(You don't have a collections module somewhere else in your code do you.)

When I get home tonight, I'll try an experiment myself. Do you have a
simple example script I can use that demonstrates the problem ?

Michael

Kevin Horton

unread,
Apr 3, 2007, 12:04:47 PM4/3/07
to mo...@googlegroups.com
On Tue, 03 Apr 2007 16:51:44 +0100
Fuzzyman <fuzz...@voidspace.org.uk> wrote:

> One quick test you could do, from an interactive interpreter prompt, is
> change the current directory to the directory that axes is in and then
> add that directory to sys.path (just add '.').
>
> Then do 'import collections' and print 'collections.__file__' to see if
> it is picking up the right file.

This fails with:
'module' object has no attribute '__file__'

> (You don't have a collections module somewhere else in your code do you.)

No.



> When I get home tonight, I'll try an experiment myself. Do you have a
> simple example script I can use that demonstrates the problem ?

A one line script, with 'import pylab' as the only line will do it.

Kevin

Michael Foord

unread,
Apr 3, 2007, 7:07:03 PM4/3/07
to mo...@googlegroups.com
It works fine for me. Have you put the whole contents of the pylab
distribution into the movpy 'lib' folder ?

Michael
http://www.voidspace.org.uk/python/articles.shtml

Kevin Horton

unread,
Apr 3, 2007, 7:16:00 PM4/3/07
to mo...@googlegroups.com
I thought I had, but I'll replace all the matplotlib stuff when I am
back at work tomorrow and try again. I'll let you know how it goes.

I used the matplotlib - Python 2.4 here:

http://www.tradebit.com/filedetail.php/839342

Kevin

Michael Foord

unread,
Apr 3, 2007, 7:17:25 PM4/3/07
to mo...@googlegroups.com
Kevin Horton wrote:
> I thought I had, but I'll replace all the matplotlib stuff when I am
> back at work tomorrow and try again. I'll let you know how it goes.
>
> I used the matplotlib - Python 2.4 here:
>
> http://www.tradebit.com/filedetail.php/839342
>
That's what I just used. :-)

Michael

Kevin Horton

unread,
Apr 4, 2007, 8:05:04 AM4/4/07
to mo...@googlegroups.com
I grabbed a fresh copy of your matplotlib zipfile, expanded it, and used diff to compare it to what I had. I found that for some reason (almost certainly my error), I did not have the pylab.py file that sits in the 'lib' folder. I copied it over, and now it works. Or rather, pylab imports OK. My script still doesn't work, but that's my fault, not yours.

Thanks for your help.

Kevin

Reply all
Reply to author
Forward
0 new messages