Pythonista-Issues
Pythonista-Issues copied to clipboard
Global variables are not initialized following a previous run
When you run a script twice in succession, the global variables defined in the script still contain the values from the previous run. I’m including a script (93.py) that demonstrates the problem. The script has a global list variable, _memory, that should be initialized to an empty list each run. Instead, the values from the previous run are still present, which causes my code to raise an exception. BTW, I was not in debug mode when running the script.
I’ve run this same code on my Windows 11 system, using the Pycharm IDE and the code worked as designed. I also ran the code using the Thonny IDE, under Windows , with no issues.
Moore_Bug.zip Contents: Moore_93.zip - The two script files. IMG_490.png - Image showing successful run. Remaining images show the errors encountered during the second run.
System Information
- Pythonista N/A (N/A), Default interpreter 3.10.4
- iOS 17.6.1, model iPad13,16, resolution (portrait) 1640.0 x 2360.0 @ 2.0