Try ERPNext Buy Support Partners Foundation

Script Report - Changes made in py file

I am making my first script report. I have added few filter which are showing up correctly in the report

Now I added some functionality in py. How do I get the pyc file updated/re-compiled after changing py file?

regards,
Atif

The pyc file is system generated file and you don’t need to do anything to that file at all.

AFAIK and what I generally do is that I make changed to the py file only and the same are reflected.

@adityaduggal
My PYC files are NOT automatically generated quickly. Everytime I update my script report then I have to wait for 30 minutes or sometimes even hour so that PYC file is re-generated. Any idea???

f.y.i I am using erpnext on digitalocean

You need not worry about pyc files. It’s generated when a module is loaded. If you change anything in a py file, you’ll have to restart the application server. The development server (bench frappe --serve or bench start) automatically restarts on such changes. If using in production, use bench restart to restart the application server (gunicorn).

Rekindling an old thread as the problem context remains exactly same.

Am working on a Virtualbox Production VM.
Made changes to a script report .py file. Have development mode turned on.

frappe@ubuntu:~/frappe-bench$ cat sites/site1.local/site_config.json
{
 "db_name": "1bd3e0294da19198",
 "db_password": "VpX1JJNKputV2VJl",
 "developer_mode": 1,
 "limits": {
  "space_usage": {
   "backup_size": 7.0,
   "database_size": 44.37,
   "files_size": 5.0,
   "total": 56.37
  }
 }
}

Executed bench clear-cache.
Reloaded the report a few times in the browser - no good.
Tried bench start a few times, still no good.
Finally deleted the .pyc file and reloaded the page and the new .pyc was generated. - Doesn’t work either, though it seemed once that it had worked.

The .pyc file was generated once earlier but have no clue how and what triggered it.

What may I be getting wrong?

Bumping this as I am still clueless about it. Any help shall be much appreciated.

Had the same issue on 9.0 version. For me restart of supervisor solved issue

sudo -i service supervisor stop
sudo -i service supervisor start

Probably gunicorn is caching .pyc file somewhere and do not use new ones until restart.