I'm doing a little bit strange practice for editing the python script that runs on my lab. I just want to know whether what I'm doing is okay and also learn other better practices to do this sort of thing. I have three computers in my lab running a python script to carry out a psychological test and store the participants data. To sync the whole data we collect, we run the python script on a shared Dropbox folder in three computers. The research assistants in the lab do the tests ,approximately two or three tests per hour, and I watch the data or edit the script at home! Because I don't want my editing to bother with running tests I'm doing this trick:
Anytime I edit the script I compile it into the pyc
file and the computers in the lab only run the compiled script (.pyc). I've checked that even if I delete or rename the running pyc
file, it cause no harm to the testing, so I think this practice ensures that I can edit my script and compile it at anytime and the next test(s) will be run with the new version seamlessly.
I appreciate if I know your thoughts about this.
compilation:
python -m myscript.py
running:
python myscript.pyc
You should place the scripts under version control. This makes it easier to see exactly which version a given participant was using, and to ensure you only roll out versions you're pleased with.