Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103242 > unrolled thread
| Started by | jenswaelkens@gmail.com |
|---|---|
| First post | 2016-02-19 23:42 -0800 |
| Last post | 2016-02-20 09:05 -0800 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.lang.python
[newbie] Problem with matplotlib jenswaelkens@gmail.com - 2016-02-19 23:42 -0800
Re: [newbie] Problem with matplotlib Dave Farrance <df@see.replyto.invalid> - 2016-02-20 08:30 +0000
Re: [newbie] Problem with matplotlib Dave Farrance <df@see.replyto.invalid> - 2016-02-20 08:49 +0000
Re: [newbie] Problem with matplotlib Dave Farrance <df@see.replyto.invalid> - 2016-02-20 09:19 +0000
Re: [newbie] Problem with matplotlib jenswaelkens@gmail.com - 2016-02-20 09:02 -0800
Re: [newbie] Problem with matplotlib Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-02-20 08:42 +0000
Re: [newbie] Problem with matplotlib jenswaelkens@gmail.com - 2016-02-20 09:05 -0800
| From | jenswaelkens@gmail.com |
|---|---|
| Date | 2016-02-19 23:42 -0800 |
| Subject | [newbie] Problem with matplotlib |
| Message-ID | <1751492a-45ae-422d-8819-17de767a94c4@googlegroups.com> |
When I use either of the following commands I get an error for which I don't have a solution, could someone here help me further?
These are the commands:
import matplotlib.pyplot as plt
or
from matplotlib.pyplot import pyplot as plt
This is the error I get:
Traceback (most recent call last):
File "/home/waelkens/matplotlibdemo.py", line 2, in <module>
from matplotlib.pyplot import pyplot as plt
File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 27, in <module>
import matplotlib.colorbar
File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 36, in <module>
import matplotlib.contour as contour
File "/usr/lib/python2.7/dist-packages/matplotlib/contour.py", line 17, in <module>
import matplotlib.ticker as ticker
File "/usr/lib/python2.7/dist-packages/matplotlib/ticker.py", line 152, in <module>
import decimal
File "/usr/lib/python2.7/decimal.py", line 3744, in <module>
_numbers.Number.register(Decimal)
AttributeError: 'module' object has no attribute 'Number'
thanks in advance
Jens
[toc] | [next] | [standalone]
| From | Dave Farrance <df@see.replyto.invalid> |
|---|---|
| Date | 2016-02-20 08:30 +0000 |
| Message-ID | <jq7gcb92fh0fedaiqn55da0dq1t9f3ihla@4ax.com> |
| In reply to | #103242 |
jenswaelkens@gmail.com wrote: > File "/usr/lib/python2.7/decimal.py", line 3744, in <module> > _numbers.Number.register(Decimal) >AttributeError: 'module' object has no attribute 'Number' Your decimal module seems broken. Confirm that in the Python shell: import numbers print numbers.Number I'm guessing you'll get: AttributeError: 'module' object has no attribute 'Number' It appears to be the usual decimal module of the current linux system python 2.7, so a corrupt hard disk?
[toc] | [prev] | [next] | [standalone]
| From | Dave Farrance <df@see.replyto.invalid> |
|---|---|
| Date | 2016-02-20 08:49 +0000 |
| Message-ID | <ep9gcb58ugidcvrs66akcn6rf2ul45khh3@4ax.com> |
| In reply to | #103250 |
It occurs to me now that the trackback might misidentify the module in use, if say, you'd named a file "numbers.py" then got rid of it later leaving a "numbers.pyc" somewhere. If so, see where it is: import numbers print numbers.__file__
[toc] | [prev] | [next] | [standalone]
| From | Dave Farrance <df@see.replyto.invalid> |
|---|---|
| Date | 2016-02-20 09:19 +0000 |
| Message-ID | <uqbgcbtgepk0shuu422mka27oh1m49tmlu@4ax.com> |
| In reply to | #103255 |
Dave Farrance <df@see.replyto.invalid> wrote: >It occurs to me now that the trackback might misidentify the module in >use, if say, you'd named a file "numbers.py" then got rid of it later >leaving a "numbers.pyc" somewhere. If so, see where it is: > >import numbers >print numbers.__file__ I seem to have "numbers" on the brain. Replace with "decimal", of course.
[toc] | [prev] | [next] | [standalone]
| From | jenswaelkens@gmail.com |
|---|---|
| Date | 2016-02-20 09:02 -0800 |
| Message-ID | <0062d4be-6dfa-48e4-be08-050f33ea6d75@googlegroups.com> |
| In reply to | #103255 |
Op zaterdag 20 februari 2016 09:50:05 UTC+1 schreef Dave Farrance: > It occurs to me now that the trackback might misidentify the module in > use, if say, you'd named a file "numbers.py" then got rid of it later > leaving a "numbers.pyc" somewhere. If so, see where it is: > > import numbers > print numbers.__file__ Dear Farrance, You have solved my problem, there was indeed a program which I had called numbers.py and a numbers.pyc which caused this behaviour. Thanks a lot for helping me. kind regards, Jens
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2016-02-20 08:42 +0000 |
| Message-ID | <mailman.16.1455957803.13884.python-list@python.org> |
| In reply to | #103242 |
On 20/02/2016 07:42, jenswaelkens@gmail.com wrote: > When I use either of the following commands I get an error for which I don't have a solution, could someone here help me further? > These are the commands: > import matplotlib.pyplot as plt Are you certain that this is what you typed? C:\Users\Mark\Desktop>py -2.7 Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib.pyplot as plt >>> Please have another go. > > or > > from matplotlib.pyplot import pyplot as plt The above is incorrect, you are trying to import 'pyplot' from 'matplotlib.pyplot'. > > This is the error I get: > Traceback (most recent call last): > File "/home/waelkens/matplotlibdemo.py", line 2, in <module> > from matplotlib.pyplot import pyplot as plt > File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 27, in <module> > import matplotlib.colorbar > File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 36, in <module> > import matplotlib.contour as contour > File "/usr/lib/python2.7/dist-packages/matplotlib/contour.py", line 17, in <module> > import matplotlib.ticker as ticker > File "/usr/lib/python2.7/dist-packages/matplotlib/ticker.py", line 152, in <module> > import decimal > File "/usr/lib/python2.7/decimal.py", line 3744, in <module> > _numbers.Number.register(Decimal) > AttributeError: 'module' object has no attribute 'Number' > > thanks in advance > Jens > With this type of problem I'm inclined to throw the last line of the traceback, here the 'AttributeError' one, into a search engine and see what you come up with. The hits you get are often enough to help you diagnose the problem. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | jenswaelkens@gmail.com |
|---|---|
| Date | 2016-02-20 09:05 -0800 |
| Message-ID | <5fefa9ca-31a2-41a2-8fd4-97367e0a6c3f@googlegroups.com> |
| In reply to | #103253 |
Op zaterdag 20 februari 2016 09:43:35 UTC+1 schreef Mark Lawrence: > On 20/02/2016 07:42, jenswaelkens@gmail.com wrote: > > When I use either of the following commands I get an error for which I don't have a solution, could someone here help me further? > > These are the commands: > > import matplotlib.pyplot as plt > > Are you certain that this is what you typed? > > C:\Users\Mark\Desktop>py -2.7 > Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit > (AMD64)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import matplotlib.pyplot as plt > >>> > > Please have another go. > > > > > or > > > > from matplotlib.pyplot import pyplot as plt > > The above is incorrect, you are trying to import 'pyplot' from > 'matplotlib.pyplot'. You are right, this doesn't work, I got it from some source on the Internet tryin to solve the initial problem with the other statement...Anyway, as you see in my other reply, the problem has been solved. kind regards, Jens > > > > > This is the error I get: > > Traceback (most recent call last): > > File "/home/waelkens/matplotlibdemo.py", line 2, in <module> > > from matplotlib.pyplot import pyplot as plt > > File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 27, in <module> > > import matplotlib.colorbar > > File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 36, in <module> > > import matplotlib.contour as contour > > File "/usr/lib/python2.7/dist-packages/matplotlib/contour.py", line 17, in <module> > > import matplotlib.ticker as ticker > > File "/usr/lib/python2.7/dist-packages/matplotlib/ticker.py", line 152, in <module> > > import decimal > > File "/usr/lib/python2.7/decimal.py", line 3744, in <module> > > _numbers.Number.register(Decimal) > > AttributeError: 'module' object has no attribute 'Number' > > > > thanks in advance > > Jens > > > > With this type of problem I'm inclined to throw the last line of the > traceback, here the 'AttributeError' one, into a search engine and see > what you come up with. The hits you get are often enough to help you > diagnose the problem. > > -- > My fellow Pythonistas, ask not what our language can do for you, ask > what you can do for our language. > > Mark Lawrence
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web