I updated my python version on windows 2003 server from 2.4 to 2.5.
In 2.4 I could import a file "sub1.py" from a subdirectory c:\application\subdir\ like this:
import sub1
as long as the calling script main.py that lives in c:\application was started like this:
c:\application\subdir>python ..\main.py
But in 2.5 it no longer works for me:
C:\application\subdir>python ..\main.py
Traceback (most recent call last):
File "main.py", line 3, in <module>
import sub1
ImportError: No module named sub1
Now I can put an empty file
__init__.py
into subdir and import like this:
import subdir.sub1 as sub1
Was there a change in python 2.5? This would mean the current working directory in python 2.4 was inherited from the calling process, and in python 2.5 it is set to where the main script lives.
[edit3] I corrected the question now. I must appologize that I had over-simplified the example at first and removed the cause that results in the error without checking my simplified example. [/edit3]