From 404b4ffeb437f0e17ee88dc55a803bd4c0b07982 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 25 Jul 2017 11:12:43 +0100 Subject: [PATCH] Fix last commit. memfs.py broken in Python 3 --- memfs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/memfs.py b/memfs.py index c25963f6f..f3cf40f28 100755 --- a/memfs.py +++ b/memfs.py @@ -13,11 +13,12 @@ print(dirs) FILES = {} NAMES = [] +# Binary to ASCII function. Different in Python 2 and 3 try: - str("",'ascii') - ascii = lambda x: str(x, 'ascii') + str(b'\x23\x20','ascii') + ascii = lambda x: str(x, 'ascii') # Python 3 except: - ascii = lambda x: str(x) + ascii = lambda x: str(x) # Python 2 # The last argument is the generated C file @@ -37,7 +38,7 @@ for directory in dirs: continue fname = full[full.find("/%s/" % (dname,)):] - print("MEMFS add", fname) + #print("MEMFS add", fname) name = re.sub(r'\W', '_', fname) assert name not in FILES