Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68570 > unrolled thread
| Started by | Peter Otten <__peter__@web.de> |
|---|---|
| First post | 2014-03-20 08:21 +0100 |
| Last post | 2014-03-20 08:21 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Python-Dev] Issues about relative& absolute import way for Portingfrom python2.4 to python2.7 Peter Otten <__peter__@web.de> - 2014-03-20 08:21 +0100
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Date | 2014-03-20 08:21 +0100 |
| Subject | Re: [Python-Dev] Issues about relative& absolute import way for Portingfrom python2.4 to python2.7 |
| Message-ID | <mailman.8291.1395300082.18130.python-list@python.org> |
北冰洋 wrote: > I just wrote a sample like this: > testPy/ > __init__.py > client.py > SoamFactory.c > SoamFactory.so > soamapi.py > sample/testP.py > export PYTHONPATH=$(TEST_LOCATION):$(TEST_LOCATION)/testPy > I found that soamapi was imported twice, and I investigated this is > I don't know how to fix it. Is there any official way about how to porting > this scenario or better idea? Without looking into the details -- I believe that your problem stems from having a path into the package: > export PYTHONPATH=$(TEST_LOCATION):$(TEST_LOCATION)/testPy The above means that a module testPy.foo can also successfully be imported as foo. Try changing the path to export PYTHONPATH=$(TEST_LOCATION) If you get failing imports change every failing import import foo to from testPy import foo
Back to top | Article view | comp.lang.python
csiph-web