If I edit source of an installed package and delete the .pyc when I restart an app that uses it there is no new pyc generated in place indicating there is a cache elsewhere.
How do I force the update to source to be taken into account?
You just have to run python -m compileall again. It will overwrite older . pyc files. You can pass it the -f switch to force rebuild even if timestamps are up to date (as per the documentation).
How do I compile all files in a directory in Python? python -m compileall <directory> -r 0 is equivalent to python -m compileall <directory> -l. Use N workers to compile the files within the given directory. If 0 is used, then the result of os.
When a Python source file (module) is imported during an execution for the first time, the appropriate . pyc file is created automatically. If the same module is imported again, then the already created . pyc file is used.
Go to the directory of the .py
file and run python -m compileall .
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With