ARGV and import ?

J geek_girl at mailcity.com
Tue Oct 9 19:07:38 CEST 2001


Hi all, 

This is my first post to this group & I am also fairly new to python,
so please forgive me if this isn't the brightest question or the
appropriate venue.

I would like to do the following: 
import a module based on what is typed on the command line.  

I thought this would work: 
import sys
recipes = sys.argv[1] 
import recipes

But, I get this error: 
>> ImportError: No module named recipes

Is there any way to pass the module name to import through an argv?  

Thanks in advance.



More information about the Python-list mailing list