Fix Python – What will happen if I modify a Python script while it’s running?

Question

Asked By – wong2

Imagine a python script that will take a long time to run, what will happen if I modify it while it’s running? Will the result be different?

Now we will see solution for issue: What will happen if I modify a Python script while it’s running?


Answer

Nothing, because Python precompiles your script into a PYC file and launches that.

However, if some kind of exception occurs, you may get a slightly misleading explanation, because line X may have different code than before you started the script.

This question is answered By – Lixas

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0