14.08.2011 21:48, OKB (not okblacke) yazmış:
=?UTF-8?B?T2t0YXkgxZ5hZmFr?= wrote:
It appears that Python is reading "import thetest" as
importing
thetest.py (the same file that is currently being run). When it
tries to run that file a second time, the relative import fails
=?UTF-8?B?T2t0YXkgxZ5hZmFr?= wrote:
>> It appears that Python is reading "import thetest" as
>> importing
>> thetest.py (the same file that is currently being run). When it
>> tries to run that file a second time, the relative import fails.
>>
>
> No, there is no such thing
14.08.2011 00:39, OKB (not okblacke) yazmış:
I'm using Python 2.6.5. I have a directory structure like this:
thetest/
__init__.py
thetest.py
theother.py
__init__.py is an empty file. theother.py contains a function foo().
The package is accessible from sys.path
On Sun, Aug 14, 2011 at 12:55 AM, OKB (not okblacke)
wrote:
> sys.path = sys.path[1:] + ['']
>
> (That is, move the current directory to the end of the search path
> instead of the beginning.)
>
Or, equivalently:
sys.path.append(sys.path.pop(0))
ChrisA
--
http://mail.python.org/mailman/listinf
OKB (not okblacke) wrote:
> But why? That __future__ import is supposed to make
> absolute
> imports the default, so why is "import thetest" importing
> thetest.py instead of the package called thetest? The absolute
> import should make it look in sys.path first and not try to
I'm using Python 2.6.5. I have a directory structure like this:
thetest/
__init__.py
thetest.py
theother.py
__init__.py is an empty file. theother.py contains a function foo().
The package is accessible from sys.path, so that if I open the
interpreter and do "