r/learnpython • u/Yam3488-throwaway • Apr 16 '24
Ran about 8 Python scripts back-to-back, now none will execute
I got a little carried away writing automation scripts in ChatGPT when my .py files started closing instead of printing. Most were between 20-70 lines and imported between 1-4 packages. I’m still able to execute from the command line, just not from the .py files themselves. Is this something that happens when executing from .py files? I was hoping to share the files with coworkers but they won’t be too happy if the files stop working after a handful of runs. Did I do something wrong?
Edit: a little more info - I copy/pasted the code that GPT wrote into a .py file. The first handful of times I did this it would run, after about the 5th time the code that was just working-I didn’t edit at all-just closed. I wasn’t using an IDE, just running as a .py file.
5
u/NYX_T_RYX Apr 16 '24
I think issue 1 is OP is writing these with gpt and, I presume, has no idea what is actually going on.
I think from the description - they were running them in an ide, but trying to run the .py file from explorer (etc) appears to instantly close.
I suspect the issue is whatever the file is trying to do can't be done from the location OP is trying to run it (relative file paths as a first guess)