UnboundLocalError: local variable 'credentials' referenced before assignment


#1

Hi,

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


#2

Hi, Renal.
Your approach is absolutely right!

Screenshot%20(386)|690x387

  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.


#3

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:

/home/dmellorenal3274/bin/gyb/gyb

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


#4

Hi

I am getting sign in temporarily disabled for this app.

Can you help in this regard


#5

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