Bench restart doesnt generate .pyc files


In version 6, to update my custom app I used to

1.pull updates in my custom app by running “git pull upstream” in app folder “bench restart”

and bench restart would generate .pyc for all my updated python files.

However in version 7 bench restart doesnt generate .pyc files.

I have to manually run python -m py_comile for each .py file that is updated.

Is this change by design or is this a bug?

Is there any other way to compile all my updated .py files in one step?

1 Like

No I think .pyc file are generated on demand

Same think for me I have the latest version 10.
Any solutions?

This still appears to be a thing, and is quite annoying because this happens:

I change a python file

bench observes the .py file has changed, and restarts
I run a javascript button which calls a python function
python loads and parses the python file containing the function
python creates a .pyc file
the python script is still running
bench observes the .pyc file has changed, and restarts
the python script is killed

There is probably no need for bench to watch .pyc files?

1 Like

You can run python -m compileall . on bench/apps directory or python -m compileall /home/frappe/bench/apps