import os
import pdb
os.system("ToBuildOrNot.py MSS_sims")
for output in os.system:
if ToBuildOrNot is True:
print "The MSS_sims Needs To rebuilt"
elif ToBuildOrNot is False:
print "The MSS_sism does NOT Need to be Rebuilt"
else:
print "error"
Don't invoke a Python script from a Python script by using system, which spawns a whole other interpreter. Just import it. Like this:
import ToBuildOrNot
needsBuild = ToBuildOrNot.run() # or whatever you call your top-level function
Since ToBuildOrNot.py is a script now, make sure the "main" function is protected so it doesn't execute automatically on import. Most people do it this way in Python: What does if __name__ == "__main__": do?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.