[Python-porting] Issues about relative& absolute import way for Porting from python2.4 to python2.7
Lennart Regebro
regebro at gmail.com
Sun Mar 30 09:51:32 CEST 2014
More information about the Python-porting mailing list
Sun Mar 30 09:51:32 CEST 2014
- Previous message: [Python-porting] Issues about relative& absolute import way for Porting from python2.4 to python2.7
- Next message: [Python-porting] questions about future package here?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Mar 18, 2014 at 8:05 AM, 北冰洋 <wtz_wh at foxmail.com> wrote: > export PYTHONPATH=$(TEST_LOCATION):$(TEST_LOCATION)/testPy This is the fundamental problem. By adding both these locations, you make each module in testPy importable both as "testPy.something" and as "something". This means they can be imported twice. As a general rule, you should avoid modifying PYTHONPATH at all, unless you are doing something "frameworky". Although in this case the simplest fix may be to remove the testPy directory from the PYTHONPATH. I can't see why it would be needed. Possibly some of the imports need to be made absolute in that case, ie "from testPy import client" instead of just "import client", etc. //Lennart
- Previous message: [Python-porting] Issues about relative& absolute import way for Porting from python2.4 to python2.7
- Next message: [Python-porting] questions about future package here?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-porting mailing list