简体   繁体   中英

Safe to change python file during run time?

I have python 3 file that run a SVN deployment. Basically run "python3 deploy.py update" and following things happen:

  1. Close site

  2. Backup Ignore but secure files

  3. SVN revert -R .

  4. SVN update

  5. Trigger tasks

  6. Open site

That all sounds simple and logical, but for one thought going around my head "SVN is writing files, including python files and sub module helpers that are trigger the SVN subprocess"

I understand that python files are read and processed and only through some tricky reload will python reload. And I understand if SVN change python source then update would only take effect on next run.

But question is "should keep this structure or move file to root and run SVN to be safe side"

Applies to GIT or any python changes

From what I know it is safe to change python (ie .py) file while python is running, after .pyc file has been created by python (ie your situation). You can even remove .py file and run .pyc just fine.

On the other hand SVN revert -R . is dangerous here as it would attempt removing .pyc files, so either screw up your python or fail by itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM