"_dict" is an invalid variable name because it starts with "_" - Script Report

I’m trying to use _dict on a script report and a get this error message

dict" is an invalid variable name because it starts with "

My Python Version: 3.7.3

“_dict” is allowed on safe_exec.py… On compile my custom script “_dict” is identified as a variable, but in reality it is a method

Anyone get this error too?
I suspect it is error with the python version

You can’t use variable names starting with _ in scripts due to security features (RestrictedPython)

So this is not python version, so it could be a error, currently when making a server script or Script report bouth use same safe_exec, I can’t use _dict({…}).

Inside safe_exec.py we have “_dict” representing “frappe._dict”, so should we change “_dict” to “as_dict”?

as_dict work perfectly, waiting ur feedback the i can create a pull request.

I generally avoid using script report because of this limiting factor. For maximum flexibility, create the report in a custom app. Then install the app on your server. Or if you’re on frappe cloud you can install it there as well.

1 Like

the _dict Command exists… but it is not accessible, just correct it and make it accessible for different types of use.

Complex or not, it will be used by someone, just as I wanted to use it.

It can be a Server Script or an report.