After import sys, I use sys.argv to get input arguments.
But after I compile my program with pyinstaller, the exe program will not accept my input.
It will just use the default value I set up for the program. How can I compile it and let the exe file accept my input?
I hope I don't need to write a gui for it. Sorry for late reply. Here is the code:
import sched, time
import sys
s = sched.scheduler(time.time, time.sleep)
def do_something(sc,wait_time): //wait_time is an integer representing how many seconds to wait.
// Here will be the code for doing something every after "wait_time " seconds
sc.enter(wait_time,1,do_something,(sc,wait_time))
try:
wait_time = int(sys.argv[1])
except IndexError:
wait_time = 5
# s.enter(wait_time, 1, do_something, (s,))
s.enter(wait_time,5,do_something,(s,wait_time))
s.run()
If I run it with "python this_script.py", it will wait for my input of how many seconds for wait. But after I compiled it with pyinstaller, I double clicked the exe file. There is no place for me to input a number which is the wait_time.
.exefile? Are you running it from a command prompt or are you clicking on it? - Greg Hewgill