Bug #101300 local variable referenced before assignment
Submitted: 23 Oct 22:09 Modified: 10 Nov 20:27
Reporter: John Krieger Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S3 (Non-critical)
Version:8.0.21, 8.0.22 OS:Microsoft Windows (10)
Assigned to: CPU Architecture:Any

[23 Oct 22:09] John Krieger
Description:
Attempting to export a schema, did not have sufficient privilege. Operation fails with this error:

15:23:17 [WRN][wb_admin_export.py:process_db:277]: Task exited with code 2
15:23:19 [ERR][       pymforms]: Unhandled exception in Python code: 
Traceback (most recent call last):
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 1955, in _update_progress
    r = self.update_progress()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 913, in update_progress
    self.start()
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 1942, in start
    password = self.get_mysql_password(self.bad_password_detected)
  File "C:\Program Files\MySQL\MySQL Workbench 8.0 CE\modules\wb_admin_export.py", line 963, in get_mysql_password
    if pwd is None:
UnboundLocalError: local variable 'pwd' referenced before assignment

How to repeat:
PREREQUISITE: You must NOT have privilege to LOCK TABLES n the database in this test

Open workbench
connect to database
Server > Data Export
Select schema
choose "dump structure only", self contained file
switch to "export progress" tab
start export

Suggested fix:
initialize local variable pwd
[24 Oct 11:45] MySQL Verification Team
Hello John Krieger,

Thank you for the report and feedback.

regards,
Umesh
[29 Oct 20:29] William Parra Velásquez
Is there any workaround ?
[10 Nov 20:27] John Krieger
No workaround - this will have to be corrected in the script. See attached file.
[10 Nov 20:28] John Krieger
code snippet

Attachment: get_mysql_password.PNG (image/png, text), 34.46 KiB.