Python matplotlib

hi all
the following code

import matplotlib.pyplot as plt 
import numpy as np

def f(x):
	return x**2
x= np.linspace(0,10,1000)	

runs normally when i run commands 1 by 1 but when i have it in a file i get error

================= RESTART: C:\Python34\training\ =================
Traceback (most recent call last):
  File "C:\Python34\training\", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Python34\lib\site-packages\matplotlib\", line 122, in <module>
    from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
  File "C:\Python34\lib\site-packages\matplotlib\", line 33, in <module>
    import numpy as np
  File "C:\Python34\lib\site-packages\numpy\", line 180, in <module>
    from . import add_newdocs
  File "C:\Python34\lib\site-packages\numpy\", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python34\lib\site-packages\numpy\lib\", line 8, in <module>
    from .type_check import *
  File "C:\Python34\lib\site-packages\numpy\lib\", line 11, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python34\lib\site-packages\numpy\core\", line 22, in <module>
    from . import _internal  # for freeze programs
  File "C:\Python34\lib\site-packages\numpy\core\", line 15, in <module>
    from .numerictypes import object_
  File "C:\Python34\lib\site-packages\numpy\core\", line 962, in <module>
  File "C:\Python34\lib\site-packages\numpy\core\", line 958, in _register_types
AttributeError: 'module' object has no attribute 'Integral'

any idea what is happen

1 Like

Perhaps @sdaityari or @abderhasan could help with that. They are pretty good with Python. :slight_smile:

Iā€™m not a python expert, but this looks similar

Ok i found my fault. I had a python file in my exercise folder named That caused the problem. It was in same folder with the matplot exercise file and the programm was reading this instead from standard library. I renamed it and now it runs normally. Stupid from me but happened.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.