@@ -525,18 +525,21 @@ def dbTableValues(self, tableValues):
525525 self ._write ("| %s%s" % (value , blank ), newline = False , console = console )
526526
527527 if len (value ) > MIN_BINARY_DISK_DUMP_SIZE and r'\x' in value :
528- mimetype = magic .from_buffer (value , mime = True )
529- if any (mimetype .startswith (_ ) for _ in ("application" , "image" )):
530- if not os .path .isdir (dumpDbPath ):
531- os .makedirs (dumpDbPath , 0755 )
532-
533- filepath = os .path .join (dumpDbPath , "%s-%d.bin" % (unsafeSQLIdentificatorNaming (column ), randomInt (8 )))
534- warnMsg = "writing binary ('%s') content to file '%s' " % (mimetype , filepath )
535- logger .warn (warnMsg )
536-
537- with open (filepath , "wb" ) as f :
538- _ = safechardecode (value , True )
539- f .write (_ )
528+ try :
529+ mimetype = magic .from_buffer (value , mime = True )
530+ if any (mimetype .startswith (_ ) for _ in ("application" , "image" )):
531+ if not os .path .isdir (dumpDbPath ):
532+ os .makedirs (dumpDbPath , 0755 )
533+
534+ filepath = os .path .join (dumpDbPath , "%s-%d.bin" % (unsafeSQLIdentificatorNaming (column ), randomInt (8 )))
535+ warnMsg = "writing binary ('%s') content to file '%s' " % (mimetype , filepath )
536+ logger .warn (warnMsg )
537+
538+ with open (filepath , "wb" ) as f :
539+ _ = safechardecode (value , True )
540+ f .write (_ )
541+ except magic .MagicException , err :
542+ logger .debug (str (err ))
540543
541544 if conf .dumpFormat == DUMP_FORMAT .CSV :
542545 if field == fields :
0 commit comments