new.py and having '.' in PYTHONPATH
sohcahtoa82 at gmail.com
sohcahtoa82 at gmail.com
Mon Feb 23 17:07:29 EST 2015
On Monday, February 23, 2015 at 1:01:07 PM UTC-8, Tobiah wrote:
> Was working along, and wasted some time on this.
>
> Wanted to try something on my script, so I copied
> it to 'new.py'. It wouldn't run, and neither would
> the one I copied from!
>
> Traceback (most recent call last):
> File "a2z.py", line 6, in <module>
> from suds.client import Client
> File "build/bdist.linux-i686/egg/suds/__init__.py", line 154, in <module>
>
> File "build/bdist.linux-i686/egg/suds/client.py", line 30, in <module>
> File "build/bdist.linux-i686/egg/suds/sudsobject.py", line 25, in <module>
> ImportError: cannot import name classobj
>
>
> I finally figured out that the presence of new.py in
> my directory was breaking things. '.' is in my
> PYTHONPATH, so maybe suds was looking for some
> other new.py.
>
> Anyway, it raises the question as to whether having '.' in the
> PYTHONPATH is at all a sane thing to do.
>
> Thanks,
>
> Tobiah
There shouldn't be a need to have '.' in your PYTHONPATH. If your current working directory is /home/me, and you have a module in /home/me/myModule.py, then opening up the interpreter and typing `import myModule` should work fine without '.' in your PYTHONPATH.
Are you running Python 2.x? There was a module named "new" in 2.x that was removed in 3. You might be dealing with a conflict when you call your own module 'new.py'.
More information about the Python-list
mailing list