提交 e66dab0b 编写于 作者: L leroyron

Added python3 version of converter, errors with converting to binary has been cured in this script.

1st Errors-----------------:
The problem is that in Python 2 the print function is different in Python 3.
Python 2:
print ''

Python 3: print is a function and no keyword so it needs brackets:
print('')

2nd Errors-----------------:
struct.error: argument for 's' must be a bytes object
a.
signature = struct.pack('<12s', 'Three.js 003') Changed To signature = struct.pack(b'<12s', b'Three.js 003')

b.
out.write("".join(buffer)) Changed To > out.write(b"".join(buffer))

Explanation:

The error
packed = struct.pack(1, 'ab', 2.7)

With Python 3, 'ab' isn't a bytes object, what was called a str on Python 2, it's unicode. You need to use:
packed = struct.pack(1, b'ab', 2.7)

which tells Python that 'ab' is a byte literal. See PEP 3112 for more info.
上级 805d92d7
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册