So I wrote a program that can manipulate excel files. What I like is to run the script in an interpreter and to call the functions from the shell, and that works fine. What I want to do, is doing the same on a computer that doesn't necessarily have pyhthon installed, so I convererted my py to exe using auto-py-to-exe, but in the exe file you can't access shell.
I've made à 30s video about the issue : https://photos.app.goo.gl/XAaJYikmpcLV6HqC7
code would looke like this :
def main():
#stuff
return
while 1 != 0:
user = input("What do you want to do ? : ")
subprocess.call(user, shell=True)
If the user enter "main()" I want it to execute the main function as it would in the shell.
I've tried subprocess.call .run .popen none of it work and os.system stuff also.
EDIT: I want to run any function with any arguments, it can be "main()", "main(1,/path)", "getfiles()", ect. So I dont have to manually write "if user == ...: main(...)" each time.
Found the answer :
def main():
#stuff
return
while 1 != 0:
user = input("What do you want to do ? : ")
eval(input)
But WARNING this allow the user to run any command so big security issue
the "exec" command can also help you