The thing sandbox only applies if you use the python_script
integration.
Standard python scripts (or other programs) started by command_line
sensors should be executed inside the homeassistant
container with no other limitations.
That can get quite tricky, since the script runs inside the homeassistant
container. Your configuration directory is mounted as /config
inside that container. I would start by moving your file there, just for testing. You can continue from there after you get the script to work.
It will depend on your installation method.