Re: dynamically importing a module and function

2008-04-23 Thread [EMAIL PROTECTED]
On Mon, Apr 21, 2008 at 4:47 PM, John Machin <[EMAIL PROTECTED]> wrote: > > > saved = sys.path > > > sys.path = data['cwd'] > > > module = __import__(data['module']) > > > sys.path = saved > > > > > > > > import os > > > > > os.chdir('/home/mark/work/proj1') > > > > > import sys > > > > > sys.p

Re: dynamically importing a module and function

2008-04-21 Thread John Machin
[EMAIL PROTECTED] wrote: On Mon, Apr 21, 2008 at 3:39 PM, John Machin <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: data['module'], in the directory data['cwd'] OT: Any good reason for using a dictionary instead of a class instance (data.functiom, data.module, etc)? not really, i just

Re: dynamically importing a module and function

2008-04-21 Thread [EMAIL PROTECTED]
On Mon, Apr 21, 2008 at 3:39 PM, John Machin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > data['module'], in the directory data['cwd'] > OT: Any good reason for using a dictionary instead of a class instance > (data.functiom, data.module, etc)? not really, i just wanted to stick to pr

Re: dynamically importing a module and function

2008-04-21 Thread John Machin
[EMAIL PROTECTED] wrote: Hi I have a function data['function'], that I need to import from a file data['module'], in the directory data['cwd'] OT: Any good reason for using a dictionary instead of a class instance (data.functiom, data.module, etc)? If I do this from python interactive shel

Re: dynamically importing a module and function

2008-04-21 Thread [EMAIL PROTECTED]
there was a mistake in my prev mail.. it is not able to successfully import the module. abcde is in directory /home/mark/work/proj1, but it is looking for it in /home/mark from where i am running the script.. though i changed cwd using os.chdir() function > File "/home/mark/app.py", line 5, i