Re: Import and absolute file names, sys.path including ''... or not

2009-05-21 Thread greg
Jean-Michel Pichavant wrote: __import__('/home/jeanmichel/test') The __import__ function takes *module* names, not filesystem pathnames. Giving it a pathname might happen to work some of the time in some versions of Python, but it's not an intended feature, and you shouldn't rely on it. If y

Re: Import and absolute file names, sys.path including ''... or not

2009-05-20 Thread Mike Kazantsev
On Wed, 20 May 2009 22:01:50 +0200 Jean-Michel Pichavant wrote: > You are right, but my concern is not the relative path resolution. Let > me clarify: > > /home/jeanmichel/test.py: > "import sys > print sys.path" > > >python.exe test.py > sys.path = ['/home/jeanmichel'] > > from within a pyt

Re: Import and absolute file names, sys.path including ''... or not

2009-05-20 Thread Jean-Michel Pichavant
You are right, but my concern is not the relative path resolution. Let me clarify: /home/jeanmichel/test.py: "import sys print sys.path" >python.exe test.py sys.path = ['/home/jeanmichel'] > from within a python shell: sys.path = [''] The unpredictable effect of '' (at least something I did no

Re: Import and absolute file names, sys.path including ''... or not

2009-05-20 Thread Aahz
In article , Jean-Michel Pichavant wrote: > >I spent quite a time on a malicious issue. I found out that there is a >slight difference on the sys.path content when either executing code >from a shell or from within a script. This difference is the '' item, >which is present in the shell form of

Import and absolute file names, sys.path including ''... or not

2009-05-19 Thread Jean-Michel Pichavant
Hi fellows, I spent quite a time on a malicious issue. I found out that there is a slight difference on the sys.path content when either executing code from a shell or from within a script. This difference is the '' item, which is present in the shell form of sys.path. For instance, let's wr