fixed SCRIPT_NAME handling in python