strange issue

Hello,

I'm having a strange issue, and I've managed to reduce it to a simple problem. I created the following file structure:

- a directory named scripts/
- a script called scripts/inspect.py
- a script called scripts/test.py

inspect.py contains just 'pass' and test.py contains 'from matplotlib.pyplot import *'. When I run

python scripts/test.py

I get the traceback included below. Basically, it looks like python is trying to import my inspect.py script instead of one that comes with matplotlib. Is this just down to the design of python? Is there anything I can do to avoid this problem in future apart from renaming inspect.py to another name?

Thanks,

Thomas

Traceback (most recent call last):
   File "scripts/test.py", line 1, in <module>
     from matplotlib.pyplot import *
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/matplotlib/__init__.py", line 129, in <module>
     from rcsetup import defaultParams, validate_backend, validate_toolbar
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/matplotlib/rcsetup.py", line 19, in <module>
     from matplotlib.colors import is_color_like
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/matplotlib/colors.py", line 52, in <module>
     import numpy as np
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/numpy/__init__.py", line 147, in <module>
     import ma
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/numpy/ma/__init__.py", line 44, in <module>
     import core
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/numpy/ma/core.py", line 4855, in <module>
     all = _frommethod('all')
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/numpy/ma/core.py", line 4829, in __init__
     self.__doc__ = self.getdoc()
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/numpy/ma/core.py", line 4835, in getdoc
     signature = self.__name__ + get_object_signature(meth)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/numpy/ma/core.py", line 111, in get_object_signature
     sig = inspect.formatargspec(*inspect.getargspec(obj))
AttributeError: 'module' object has no attribute 'formatargspec'

Hello,

I'm having a strange issue, and I've managed to reduce it to a simple
problem. I created the following file structure:

- a directory named scripts/
- a script called scripts/inspect.py
- a script called scripts/test.py

inspect.py contains just 'pass' and test.py contains 'from
matplotlib.pyplot import *'. When I run

python scripts/test.py

I get the traceback included below. Basically, it looks like python is
trying to import my inspect.py script instead of one that comes with
matplotlib. Is this just down to the design of python?

the current directory and the one containing the executed script are
by default imported first than standard and 3rd part modules.

Is there
anything I can do to avoid this problem in future apart from renaming
inspect.py to another name?

rename it :slight_smile: or maybe changing the os.path variable forcing to some values.

Cheers,

···

On Thu, May 7, 2009 at 21:12, Thomas Robitaille <thomas.robitaille@...287...> wrote:
--
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

Thomas Robitaille wrote:

Hello,

I'm having a strange issue, and I've managed to reduce it to a simple problem. I created the following file structure:

- a directory named scripts/
- a script called scripts/inspect.py
- a script called scripts/test.py

inspect.py contains just 'pass' and test.py contains 'from matplotlib.pyplot import *'. When I run

python scripts/test.py

I get the traceback included below. Basically, it looks like python is trying to import my inspect.py script instead of one that comes with matplotlib. Is this just down to the design of python? Is there

Actually, inspect.py doesn't come from mpl, it is in the python standard library.

Eric

···

anything I can do to avoid this problem in future apart from renaming inspect.py to another name?

Thanks,

Thomas

Traceback (most recent call last):
   File "scripts/test.py", line 1, in <module>
     from matplotlib.pyplot import *
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ matplotlib/__init__.py", line 129, in <module>
     from rcsetup import defaultParams, validate_backend, validate_toolbar
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ matplotlib/rcsetup.py", line 19, in <module>
     from matplotlib.colors import is_color_like
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ matplotlib/colors.py", line 52, in <module>
     import numpy as np
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ numpy/__init__.py", line 147, in <module>
     import ma
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ numpy/ma/__init__.py", line 44, in <module>
     import core
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ numpy/ma/core.py", line 4855, in <module>
     all = _frommethod('all')
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ numpy/ma/core.py", line 4829, in __init__
     self.__doc__ = self.getdoc()
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ numpy/ma/core.py", line 4835, in getdoc
     signature = self.__name__ + get_object_signature(meth)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ numpy/ma/core.py", line 111, in get_object_signature
     sig = inspect.formatargspec(*inspect.getargspec(obj))
AttributeError: 'module' object has no attribute 'formatargspec'

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options