Re: doted filenames in import statements

2009-07-24 Thread Jean-Michel Pichavant
Terry Reedy wrote: Jean-Michel Pichavant wrote: Piet van Oostrum wrote: [snip] JP> file = "/home/dsp/4.6.0.0/test.py" JP> test = __import__(file) JP> => no module name blalalal found. JP> Any suggestion ? I tried multiple escape technics without any success. Rightly so. I think the be

Re: doted filenames in import statements

2009-07-22 Thread Terry Reedy
Jean-Michel Pichavant wrote: Piet van Oostrum wrote: [snip] JP> file = "/home/dsp/4.6.0.0/test.py" JP> test = __import__(file) JP> => no module name blalalal found. JP> Any suggestion ? I tried multiple escape technics without any success. Rightly so. I think the best would

Re: doted filenames in import statements

2009-07-22 Thread Jean-Michel Pichavant
Piet van Oostrum wrote: [snip] JP> file = "/home/dsp/4.6.0.0/test.py" JP> test = __import__(file) JP> => no module name blalalal found. JP> Any suggestion ? I tried multiple escape technics without any success. Rightly so. I think the best would be to add the directory to sy

Re: doted filenames in import statements

2009-07-21 Thread Christian Heimes
Chris Rebert wrote: > You want the imp.load_module() function: > http://docs.python.org/library/imp.html#imp.load_module > > __import__() only operates on module/package names. I'm not sure how > you even got it to work with a filename... It used to work with filenames but it was a bug. I guess s

Re: doted filenames in import statements

2009-07-21 Thread Piet van Oostrum
> Jean-Michel Pichavant (JP) wrote: >JP> Hi fellows, >JP> I'd like to use the dynamic __import__ statement. It works pretty well with >JP> non dotted names, but I cannot figure how to make it work with dotted file >JP> paths. What is a dotted file path? Is that 4.6.0.0? >JP> example: >JP>

Re: doted filenames in import statements

2009-07-21 Thread Chris Rebert
On Tue, Jul 21, 2009 at 2:42 PM, Jean-Michel Pichavant wrote: > Hi fellows, > > I'd like to use the dynamic __import__ statement. It works pretty well with > non dotted names, but I cannot figure how to make it work with dotted file > paths. > > example: > > file = "/home/dsp/test.py" > test = __im

doted filenames in import statements

2009-07-21 Thread Jean-Michel Pichavant
Hi fellows, I'd like to use the dynamic __import__ statement. It works pretty well with non dotted names, but I cannot figure how to make it work with dotted file paths. example: file = "/home/dsp/test.py" test = __import__(file) works like a charm file = "/home/dsp/4.6.0.0/test.py" test =