On 4/3/2011 11:58 PM, tee chwee liong wrote:
hi,

i want to read from a file which will indicate which operation to execute. so i'm using configparser module. i want one.py to read a configuration file and executes two.py and three.py. however, it only executes two.py and not three.py codes. pls help advise.

I see no reason for the problem you report. I tested a brief version:
import two
import three
and it worked as expected.

The only reason I can think of for it not working is that you had already imported three.py. Importing again will NOT re-execute the module!


thanks
tcl

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

*_one.py:_*
import ConfigParser
config = ConfigParser.ConfigParser()
config.read("configuration.ini")
operation=config.get("config", "operation")
if int(operation)== 0:
    import two
    import three
else:
    print "Default"

*_two.py:_*
print "executing script number 2"

*_three.py:_*
print "executing script number 3"



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


--
Bob Gailer
919-636-4239
Chapel Hill NC

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to