Python 3.4 script keeps calling same function -


i new python , created script when called set computer shutdown in x seconds, if called again add x seconds shutdown. problem when check arguments script called with. if call script '-s' shutdown, first calls shutdown function , proceeds go elif statement infinite times until exit...

if arg == '-s':     shutdown() elif arg == '-a':     abort() else:     sys.exit("error: '%s' isn't valid argument." % arg) 

the full script here: http://pastebin.com/vnxanlz5, problem might else where. other input making script better welcome aswell.

if script named shutdown.py, it's possible executing os.system("shutdown -s -t %s" % timetoshutdown) or os.system("shutdown -a") cause script execute itself, rather invoking windows' built-in shutdown command.

try renaming script other shutdown.py.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -