at the >>> prompt type the following:
execfile("script.py")
and press enter
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
Try this:
execfile("script.py argument1 argument2")
For the moment I don't have access to Python, let me know if it works.
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
Found this in my code library ...
# run an external program from within Python code
# subprocess.call(["program-name", "param1", "param2"])
# safer than os.system("program-name")
# new in Python24
import subprocess
subprocess.call(["D:/Python24/Python.exe", "Skripta.py", "arg1", "arg2"])
Where Skripta.py contains this code ...
import sys
import time
print 'Beginning... now...'
for x in sys.argv:
print x
time.sleep(5) # 5 seconds to look at result
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
guys im still a newbie in programming I also had problem in running this small things im doing in python ,so if its possible can u plz send for me the best tutorial link to this email add [email]grigerdrogba@webmail.co.za[/email]
cheers
hi there mate if you are still after a tutorial i found the best one to use was on youtube by "thenewboston" just search for him on youtube i managed to learn most of the basic functions in 2hours from the tutorials.
danholding
Junior Poster in Training
56 posts since Aug 2010
Reputation Points: 15
Solved Threads: 1
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
also 'thenewboston' tutorials on python explains and shows an example of this
danholding
Junior Poster in Training
56 posts since Aug 2010
Reputation Points: 15
Solved Threads: 1