UnboundLocalError: local variable 'credentials' referenced before assignment



I am currently on topic ‘Python Programming - Project - Part 1’ of course ’ Python For Machine Learning (Videos and MCQs)’

I have been trying the step ’ bash <(curl -s -S -L https://git.io/gyb-install)’ and it ends up always with below error. I have tried with multiple email accounts and still error exists.

I have selected below options:
[ ] 0) Gmail Backup And Restore - read/write mailbox access
[*] 1) Gmail Backup Only - read-only mailbox access
[ ] 2) Gmail Restore Only - write-only mailbox access and label management
[ ] 3) Gmail Full Access - read/write mailbox access and message purge
[ ] 4) No Gmail Access

[] 5) Groups Restore - write to Google Apps Groups Archive
] 6) Storage Quota - Drive app config scope used for --action quota

Error is:

Are you ready to authorize GYB to backup and restore G Suite user email? (yes or no) Y
Great! Checking service account scopes.This will fail the first time. Follow the steps to authorize and retry. It can take a few minutes for scopes to PA
SS after they’ve been authorized in the admin console.
Scope: _https://mail.google.com/ FAIL
Scope: _https://www.googleapis.com/auth/apps.groups.migration FAIL
Scope: _https://www.googleapis.com/auth/drive.appdata FAIL
Scope: _https://www.googleapis.com/auth/userinfo.email FAIL
Traceback (most recent call last):
File “gyb.py”, line 2132, in
File “gyb.py”, line 1480, in main
File “gyb.py”, line 1071, in doCheckServiceAccount
UnboundLocalError: local variable ‘credentials’ referenced before assignment
[20490] Failed to execute script gyb
Service account authorization failed. Confirm you entered the scopes correctly in the admin console. It can take a few minutes for scopes to PASS after they are entered in the admin console so if you’re sure you entered them correctly, go grab a coffee and then hit Y to try again. Say N to skip admin authorization.

Please help

Project Part-1 | gyb installation problem

Hi, Renal.
Your approach is absolutely right!


  1. Now continue by selecting option 7.
  2. Open the given link in a new browser, advanced with GYB.
  3. You will get permission box “Grant GYB permission” and Google Drive and Gmail permissions click “Allow” three consecutive times.
  4. Copy the Verification code and type in the linux console.
  5. It will ask " Are you ready to autorize the GYB to backup and restore G Suite user email? Click “No” if you are not using G-suite products.
  6. That’s all you have successfully installed GYB and a folder with path /home/your_user_login_id/bin/gyb/gyb has been created.

Now you can proceed with your projects.
All the best

Please find the screenshots for any queries.

Problem in project 1
Python Project 1
Gyb installation support
Getting this error in bin/gyb folder
Problem in project 1
Please help me to complete my Python Project

I am getting an error as ‘Email is required’.
Can you suggest please?

GYB installation and setup complete!

Please restart your terminal shell or to get started right away run:


[dmellorenal3274@cxln4 ~]$ ^C
[dmellorenal3274@cxln4 ~]$ /home/dmellorenal3274/bin/gyb/gyb
ERROR: --email is required.



I am getting sign in temporarily disabled for this app.

Can you help in this regard


Hi, Avilash.

Please try with a different browser in a Laptop/Desktop.
There will be an option for “Advance safely” click on it and proceed
You will be able to do it.

All the best



I am facing same issue.
I tried Chrome, FF and IE. There is no option for advance safely as well.


I also tried the above suggested with other browser as well in my Mac. But there is no “advance safely” option. So, I am still stuck with " Sign in with Google temporarily disabled for this app" error.Unable to proceed. Kindly assist.


Hi, Parvathy.

Kindly check the below link to know why this error has occurred?
Google needs to verify your account.


All the best.


after removing bin, I have again the follow the steps. after this https://gyb-shortn.jaylee.us/2wu434. I am facing above issue


Hi, Umang.

Please try again with the starting steps onward also as the error says there is an url error please look if you are copying the correct url?
If there is any error for gmail downloads please refer this https://support.google.com/cloud/answer/7454865 you can enable the gmail security from your side.

All the best