Unable to call python code using python scope

Hi all,
We are facing an issue while trying to call a python script inside python scope. The script returns an oauth2 token as output and we use this token further for api calling We have passed the service account details inside the python script and have loaded the code in input of load python script activity.
However on executing the script, we are getting the below error.

Can anyone please help us with this issue? any help is welcome.

Thank you.