From de575c80b97345d89605990575eb2d87953a3451 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 6 Jul 2015 14:27:57 +0300 Subject: [PATCH] tools/make-frozen.py: Actually make Python2-compatible. --- tools/make-frozen.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/make-frozen.py b/tools/make-frozen.py index 912c01ea53..704999e61c 100755 --- a/tools/make-frozen.py +++ b/tools/make-frozen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Create frozen modules structure for MicroPython. # @@ -49,7 +49,11 @@ for f, st in modules: m = module_name(f) print('"%s\\0"' % m) data = open(sys.argv[1] + "/" + f, "rb").read() - data = repr(data)[2:-1] + # Python2 vs Python3 tricks + data = repr(data) + if data[0] == "b": + data = data[1:] + data = data[1:-1] data = data.replace('"', '\\"') print('"%s"' % data) print("};")