Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #86272

Re: new.py and having '.' in PYTHONPATH

Newsgroups comp.lang.python
Date 2015-02-23 14:07 -0800
References <mcg4e1$mcq$1@speranza.aioe.org>
Message-ID <72425a30-d3bb-4e7a-86ea-e49bf7efbac3@googlegroups.com> (permalink)
Subject Re: new.py and having '.' in PYTHONPATH
From sohcahtoa82@gmail.com

Show all headers | View raw


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'.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

new.py and having '.' in PYTHONPATH Tobiah <toby@tobiah.org> - 2015-02-23 13:00 -0800
  Re: new.py and having '.' in PYTHONPATH sohcahtoa82@gmail.com - 2015-02-23 14:07 -0800
  Re: new.py and having '.' in PYTHONPATH Ethan Furman <ethan@stoneleaf.us> - 2015-02-23 14:14 -0800
  Re: new.py and having '.' in PYTHONPATH Ian Kelly <ian.g.kelly@gmail.com> - 2015-02-23 15:29 -0700

csiph-web