From fab210a07d6a485d742a64f75e262a9c8862db10 Mon Sep 17 00:00:00 2001 From: MOM Date: Fri, 30 Nov 2018 08:48:09 +0100 Subject: [PATCH] Fix for python version < 3 --- fleep/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fleep/__init__.py b/fleep/__init__.py index b403394..ce0e9cd 100644 --- a/fleep/__init__.py +++ b/fleep/__init__.py @@ -10,6 +10,7 @@ import os import json +import sys with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "data.json")) as data_file: @@ -67,7 +68,10 @@ def get(obj): "mime": dict() } - stream = " ".join(['{:02X}'.format(byte) for byte in obj]) + if sys.version_info[0] < 3: + obj = bytearray(obj) + + stream = ' '.join(('{:02X}'.format(byte) for byte in obj)) for element in data: for signature in element["signature"]: