boolangery / py-lua-parser

A Lua parser and AST builder written in Python.
MIT License
117 stars 36 forks source link

TypeError: ord() expected string of length 1, but int found #22

Closed QiuleiWang closed 2 years ago

QiuleiWang commented 2 years ago
self.data = [ord(c) for c in self.strdata]

TypeError: ord() expected string of length 1, but int found

merwok commented 2 years ago

The report would be more useful with the full error message, including file and location!

This could be a Python 2 / 3 conversion issue; if strdata is bytes, then it’s already a sequence of bytes, no need for ord.

QiuleiWang commented 2 years ago

I solved the problem because my parameter type is wrong, ast.parse(str(lua_content, encoding = "utf8"))