mdevino
mdevino

Reputation: 137

Can I edit the copy of the python script a process is running?

I've started running a Python script that takes about 3 days to finish. My understanding is that Linux processes make a copy of a python script at the time they're created, so further edits on the file won't impact the running process.

However, I just realized I've made a mistake on the code and the processes running for over 2 days are going to crash. Is it possible to edit the copy of the python script the process loaded?

I'm basically trying to figure out if there's a way to fix the mistake I've made without having to restart the script execution.

Upvotes: 1

Views: 132

Answers (1)

brunson
brunson

Reputation: 744

No, you can't. The interpreter byte compiles your source code when it initially reads it. Updating the file won't change the byte code that is running.

Upvotes: 1

Related Questions