Fix last commit. memfs.py broken in Python 3

This commit is contained in:
Shahram Najm 2017-07-25 11:12:43 +01:00
parent 4e2cd7e4a7
commit 404b4ffeb4
1 changed files with 5 additions and 4 deletions

View File

@ -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