Re: module import search path strangeness

2008-08-12 Thread Peter Otten
Sion Arrowsmith wrote: > Peter Otten <[EMAIL PROTECTED]> wrote: >>tow wrote: >>> sys.path.append(os.path.join(project_directory, os.pardir)) >>> project_module = __import__(project_name, {}, {}, ['']) >>> sys.path.pop() >>Ouch. > > I presume that "Ouch" is in consideration of what mi

Re: module import search path strangeness

2008-08-12 Thread tow
On Aug 12, 4:59 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > tow wrote: > > On Aug 12, 9:56 am, Peter Otten <[EMAIL PROTECTED]> wrote: > >> tow wrote: > > >> > Basically, I had thought that import and imp.find_module used exactly > >> > the same > >> > search path, but the above example shows that

Re: module import search path strangeness

2008-08-12 Thread Sion Arrowsmith
Peter Otten <[EMAIL PROTECTED]> wrote: >tow wrote: >> sys.path.append(os.path.join(project_directory, os.pardir)) >> project_module = __import__(project_name, {}, {}, ['']) >> sys.path.pop() >Ouch. I presume that "Ouch" is in consideration of what might happen if the subject of the __

Re: module import search path strangeness

2008-08-12 Thread Peter Otten
tow wrote: > On Aug 12, 9:56 am, Peter Otten <[EMAIL PROTECTED]> wrote: >> tow wrote: > >> > Basically, I had thought that import and imp.find_module used exactly >> > the same >> > search path, but the above example shows that at least in this >> > circumstance they >> > don't; import is picking

Re: module import search path strangeness

2008-08-12 Thread tow
On Aug 12, 9:56 am, Peter Otten <[EMAIL PROTECTED]> wrote: > tow wrote: > > Basically, I had thought that import and imp.find_module used exactly > > the same > > search path, but the above example shows that at least in this > > circumstance they > > don't; import is picking up additional search

Re: module import search path strangeness

2008-08-12 Thread Peter Otten
tow wrote: >>> > I have a python script (part of a django application, if it makes any >> > difference) which is exhibiting the following behaviour: >> >> > import my_module # succeeds >> > imp.find_module("my_module") # fails, raising ImportError >> >> > which is completely baffling me. According

Re: module import search path strangeness

2008-08-12 Thread tow
On Aug 12, 4:59 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 11 Aug 2008 19:19:19 -0300, tow <[EMAIL PROTECTED]>   > escribi : > > > I have a python script (part of a django application, if it makes any > > difference) which is exhibiting the following behaviour: > > > import my_mod

Re: module import search path strangeness

2008-08-11 Thread Gabriel Genellina
En Mon, 11 Aug 2008 19:19:19 -0300, tow <[EMAIL PROTECTED]> escribi�: I have a python script (part of a django application, if it makes any difference) which is exhibiting the following behaviour: import my_module # succeeds imp.find_module("my_module") # fails, raising ImportError which is

module import search path strangeness

2008-08-11 Thread tow
I have a python script (part of a django application, if it makes any difference) which is exhibiting the following behaviour: import my_module # succeeds imp.find_module("my_module") # fails, raising ImportError which is completely baffling me. According to sys.path, both should fail; the direct