From 73132dad6f62560f598dd9265d06d625582b9250 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 5 Oct 2017 16:36:09 +0200 Subject: [PATCH] over.misc.hexdump now accepts anything as long as it's convertible to bytes --- over/misc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/over/misc.py b/over/misc.py index c7ff740..4167191 100644 --- a/over/misc.py +++ b/over/misc.py @@ -130,8 +130,10 @@ def hexdump(data, indent=0, offset=16, show_header=True, show_offsets=True, show output_io = io.StringIO() if not output else output - if type(data) is not bytes: - raise ValueError("data must be bytes") + try: + data = bytes(data) + except: + raise ValueError("data must be bytes or similar") offset_figures = math.ceil(math.log2(len(data)) / 8) * 2 if data else 2 format_str = "%%0%dx " %(offset_figures)