hi,
 
thanks everyone. i tried sys.exit() inside one.py and it works to return to DOS 
prompt. 
 
thanks
tcl
 


From: tc...@hotmail.com
To: bgai...@gmail.com; tutor@python.org
Date: Mon, 4 Apr 2011 05:10:50 +0000
Subject: Re: [Tutor] Calling another script




hi,
 
i opened a cmd DOS prompt to execute one.py. it works to execute codes from 
two.py and three.py. yes, you are fight it will not re-execute the module. 
is there a way to do it? i want after the python script finishes execution will 
return the control to the DOS prompt instead of leaving as >>>.
i tried putting sys.exit(). 
 
thanks
cltee
 


Date: Mon, 4 Apr 2011 00:29:19 -0400
From: bgai...@gmail.com
To: tutor@python.org
Subject: Re: [Tutor] Calling another script

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 
_______________________________________________ Tutor maillist - 
Tutor@python.org To unsubscribe or change subscription options: 
http://mail.python.org/mailman/listinfo/tutor                                   
 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to