Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86268 > unrolled thread
| Started by | Tobiah <toby@tobiah.org> |
|---|---|
| First post | 2015-02-23 13:00 -0800 |
| Last post | 2015-02-23 15:29 -0700 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.python
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
| From | Tobiah <toby@tobiah.org> |
|---|---|
| Date | 2015-02-23 13:00 -0800 |
| Subject | new.py and having '.' in PYTHONPATH |
| Message-ID | <mcg4e1$mcq$1@speranza.aioe.org> |
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
[toc] | [next] | [standalone]
| From | sohcahtoa82@gmail.com |
|---|---|
| Date | 2015-02-23 14:07 -0800 |
| Message-ID | <72425a30-d3bb-4e7a-86ea-e49bf7efbac3@googlegroups.com> |
| In reply to | #86268 |
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'.
[toc] | [prev] | [next] | [standalone]
| From | Ethan Furman <ethan@stoneleaf.us> |
|---|---|
| Date | 2015-02-23 14:14 -0800 |
| Message-ID | <mailman.19105.1424729708.18130.python-list@python.org> |
| In reply to | #86268 |
[Multipart message — attachments visible in raw view] — view raw
On 02/23/2015 01:00 PM, Tobiah wrote: > Anyway, it raises the question as to whether having '.' in the > PYTHONPATH is at all a sane thing to do. The current directory is added to sys.path /only/ for the interactive interpreter. -- ~Ethan~
[toc] | [prev] | [next] | [standalone]
| From | Ian Kelly <ian.g.kelly@gmail.com> |
|---|---|
| Date | 2015-02-23 15:29 -0700 |
| Message-ID | <mailman.19106.1424730589.18130.python-list@python.org> |
| In reply to | #86268 |
On Mon, Feb 23, 2015 at 3:14 PM, Ethan Furman <ethan@stoneleaf.us> wrote: > On 02/23/2015 01:00 PM, Tobiah wrote: > >> Anyway, it raises the question as to whether having '.' in the >> PYTHONPATH is at all a sane thing to do. > > The current directory is added to sys.path /only/ for the interactive interpreter. When executing a file, the directory containing the file is added to sys.path instead, which amounts to the same thing if the file that you're executing is in your current working directory.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web