Bug #62767 MySQL workbench failed to export a database
Submitted: 17 Oct 2011 1:26 Modified: 20 Oct 2011 1:54
Reporter: Hxcan Cai Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S2 (Serious)
Version:5.2.35 OS:Linux (Fedora 15 x86-64)
Assigned to: CPU Architecture:Any

[17 Oct 2011 1:26] Hxcan Cai
Description:
When I use MySQL workbench to export a database , it fails and give the following error messages:
** Message: Gnome keyring daemon seems to not be available. Stored passwords will be lost once quit
Warning! Can't use connect with timeout in paramiko 1.7.7.1 (George)
Log levels '0111000'
Ready.

(mysql-workbench-bin:6460): Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed

(mysql-workbench-bin:6460): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0

(mysql-workbench-bin:6460): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0

(mysql-workbench-bin:6460): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0

(mysql-workbench-bin:6460): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0
Traceback (most recent call last):
  File "/usr/lib64/mysql-workbench/modules/wb_admin_export.py", line 204, in run
    self.print_log_message(time.strftime('%X ') + task.title)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 2: ordinal not in range(128)
Error executing task 'ascii' codec can't decode byte 0xe6 in position 2: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/lib64/mysql-workbench/modules/wb_admin_export.py", line 691, in update_progress
    self.tasks_completed()
  File "/usr/lib64/mysql-workbench/modules/wb_admin_export.py", line 1608, in tasks_completed
    logmsg = time.strftime('%X ') + u"Export of %s has finished" % self.path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 2: ordinal not in range(128)

I think MySQL workbench didn't handle unicode correctly when outputing logs .

How to repeat:
Open MySQL workbench and export a database to a sql file.
[17 Oct 2011 10:43] MySQL Verification Team
I couldn't repeat on Fedora 14 X86_64.
[17 Oct 2011 10:51] Hxcan Cai
Maybe it has something to do with my locale . I am using zh_CN. And in the database , there are some utf8 fields.

Anyway , how can I get further information about this exception ?
[17 Oct 2011 13:28] Alfredo Kojima
Can you upload a dump (schema only, dont need data) of the problematic database?
[18 Oct 2011 0:30] Hxcan Cai
How to dump the schema ?
[18 Oct 2011 2:28] Alfredo Kojima
From a terminal:

mysqldump -u<user> -p -h<hostname> <schemaname> --no-data > dump_file.sql
[18 Oct 2011 7:08] Hxcan Cai
the schema dump

Attachment: SbIndexSchemaDump.sql (text/x-sql), 1.70 KiB.

[18 Oct 2011 12:37] Alfredo Kojima
Thank you for the info.
This seems to be a duplicate of bug #56869
[18 Oct 2011 12:46] Alfredo Kojima
Hi

The dump you uploaded contains a single table and it's all ascii. What objects do you have in your database that are in Chinese characters?
[18 Oct 2011 14:29] Sergio Andres De La Cruz Rodriguez
Hi:

This seems to be some encoding issue. Can you try to edit the file /usr/lib64/mysql-workbench/modules/wb_admin_export.py and...

replace line 204 with:
self.print_log_message(time.strftime('%X ') + task.title.encode('utf-8'))

replace line 1608 with:
logmsg = time.strftime('%X ') + u"Export of %s has finished" % self.path.encode('utf-8')

Or you can simply patch the file with the patch I'm attaching. The command to apply the patch would be:
patch -p0 /usr/lib64/mysql-workbench/modules/wb_admin_export.py /path/to/the/patch/file

You would have to type the above command as root.

Please report back if this corrects your problem.
[18 Oct 2011 14:30] Sergio Andres De La Cruz Rodriguez
Patch to wb_admin_export.py

Attachment: wb_admin_export.patch (application/octet-stream, text), 376 bytes.

[19 Oct 2011 0:41] Hxcan Cai
to Sergio de la Cruz:

I manually edited the python script wb_admin_export.py as waht you said . The first exception disappeared , but the second is still there .

bash-4.2# mysql-workbench
** Message: Gnome keyring daemon seems to not be available. Stored passwords will be lost once quit
Warning! Can't use connect with timeout in paramiko 1.7.7.1 (George)
Log levels '0111000'
Ready.

(mysql-workbench-bin:2454): Gtk-CRITICAL **: gtk_box_pack: assertion `child->parent == NULL' failed

(mysql-workbench-bin:2454): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0

(mysql-workbench-bin:2454): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0

(mysql-workbench-bin:2454): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0

(mysql-workbench-bin:2454): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -5 and height 0
08时31分51秒 Dumping SbIndex

Running: mysqldump --defaults-extra-file="/tmp/tmpCTFqrX/extraparams.cnf"  --no-create-info=FALSE --order-by-primary=FALSE --force=FALSE --no-data=FALSE --tz-utc=TRUE --flush-privileges=FALSE --compress=FALSE --replace=FALSE --host=localhost --insert-ignore=FALSE --extended-insert=TRUE --user=root --quote-names=TRUE --hex-blob=FALSE --complete-insert=FALSE --add-locks=TRUE --port=3306 --disable-keys=TRUE --delayed-insert=FALSE --create-options=TRUE --delete-master-logs=FALSE --comments=TRUE --default-character-set=utf8 --max_allowed_packet=1G --flush-logs=FALSE --dump-date=TRUE --lock-tables=TRUE --allow-keywords=FALSE --events=FALSE --databases "SbIndex"

/Data/Main/dumps/Dump20111019-1.sql
Traceback (most recent call last):
  File "/usr/lib64/mysql-workbench/modules/wb_admin_export.py", line 691, in update_progress
    self.tasks_completed()
  File "/usr/lib64/mysql-workbench/modules/wb_admin_export.py", line 1610, in tasks_completed
    logmsg = time.strftime('%X ') + u"Export of %s has finished" % self.path.encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 2: ordinal not in range(128)
[19 Oct 2011 0:47] Hxcan Cai
to Alfredo Kojima:

It has 6 rows and 4 fields.
The file attached is the dump of the whole database . The command I used is : mysqldump -u SbIndex -p SbIndex  > SbIndexTotalDump.sql
Is there anything other needed ?
[19 Oct 2011 0:47] Hxcan Cai
dump of the whole database

Attachment: SbIndexTotalDump.sql (text/x-sql), 2.49 KiB.

[19 Oct 2011 3:35] Alfredo Kojima
Thank you for the feedback. I was able to repeat the bug by setting the locale to zh_CN.UTF8
It is not related to the data being dumped.
[19 Oct 2011 3:37] Alfredo Kojima
Actually duplicate of bug #	56869
[19 Oct 2011 13:12] Sergio Andres De La Cruz Rodriguez
Hi:

Apparently I didn't check the issue with a Chinese locale. My bad. Here I describe the changes that you need to make to /usr/lib64/mysql-workbench/modules/wb_admin_export.py

replace line 204 with:
self.print_log_message(time.strftime(u'%X ') + task.title.encode('utf-8'))

replace line 1579 with:
self.out_pipe.write(self.table_list_model.get_schema_sql(schema).encode('utf-8'))

replace line 1608 with:
logmsg = time.strftime(u'%X ') + "Export of %s has finished" % self.path.encode('utf-8')

Please report back if this corrects your problem.
[19 Oct 2011 13:12] Sergio Andres De La Cruz Rodriguez
A new patch with the proposed changes

Attachment: new_wb_admin_export.patch (text/x-patch), 567 bytes.

[20 Oct 2011 1:54] Hxcan Cai
to [19 Oct 15:12] Sergio de la Cruz
This fixed the problem .
[26 Oct 2011 16:22] Martin Hollerweger
I hava the same bug but the patch didn't fix it:

MaxOS Lion, Workbench 5.2.35.
Unfortunately i can't make a mysql dump..

8:12:43 Dumping musys_sbv (organisation_kategorie)
Running: /Applications/MySQLWorkbench.app/Contents/Resources/mysqldump --defaults-extra-file="/var/folders/gf/9pr91_r13pl3ynp_10bdb_jw0000gn/T/tmpkQmO7s/extraparams.cnf"  --no-create-info=TRUE --order-by-primary=FALSE --protocol=tcp --no-data=FALSE --tz-utc=TRUE --flush-privileges=FALSE --compress=FALSE --replace=FALSE --host=localhost --insert-ignore=FALSE --extended-insert=TRUE --user=prod --hex-blob=FALSE --quote-names=TRUE --force=FALSE --complete-insert=FALSE --add-locks=TRUE --port=57844 --disable-keys=TRUE --delayed-insert=FALSE --create-options=TRUE --delete-master-logs=FALSE --comments=TRUE --default-character-set=utf8 --max_allowed_packet=1G --flush-logs=FALSE --dump-date=TRUE --lock-tables=TRUE --allow-keywords=FALSE --events=FALSE "musys_sbv" "organisation_kategorie"
Error executing task: 'ascii' codec can't encode character u'\xa7' in position 6: ordinal not in range(128)