diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py index 853893c2a8..169a6e0c4f 100644 --- a/pylib/cqlshlib/copyutil.py +++ b/pylib/cqlshlib/copyutil.py @@ -146,7 +146,7 @@ class SendingChannel(object): msg = self.pending_messages.get() self.pipe.send(msg) except Exception as e: - printmsg('%s: %s' % (e.__class__.__name__, e.message)) + printmsg('%s: %s' % (e.__class__.__name__, e.message if hasattr(e, 'message') else str(e))) feeding_thread = threading.Thread(target=feed) feeding_thread.setDaemon(True) @@ -1342,7 +1342,7 @@ class FeedingProcess(mp.Process): try: reader.start() except IOError as exc: - self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message)) + self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message if hasattr(exc, 'message') else str(exc))) channels = self.worker_channels max_pending_chunks = self.max_pending_chunks @@ -1371,7 +1371,7 @@ class FeedingProcess(mp.Process): if rows: sent += self.send_chunk(ch, rows) except Exception as exc: - self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message)) + self.outmsg.send(ImportTaskError(exc.__class__.__name__, exc.message if hasattr(exc, 'message') else str(exc))) if reader.exhausted: break @@ -2632,7 +2632,7 @@ class ImportProcess(ChildProcess): pk = get_row_partition_key_values(row) rows_by_ring_pos[get_ring_pos(ring, pk_to_token_value(pk))].append(row) except Exception as e: - errors[e.message].append(row) + errors[e.message if hasattr(e, 'message') else str(e)].append(row) if errors: for msg, rows in errors.items(): diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py index e00d91f2d6..a8ee51d225 100644 --- a/pylib/cqlshlib/formatting.py +++ b/pylib/cqlshlib/formatting.py @@ -239,6 +239,7 @@ def formatter_for(typname): return f return registrator + class BlobType(object): def __init__(self, val): self.val = val @@ -246,6 +247,7 @@ class BlobType(object): def __str__(self): return str(self.val) + @formatter_for('BlobType') def format_value_blob(val, colormap, **_): bval = ensure_text('0x') + ensure_text(binascii.hexlify(val))