出现问题:python 3.8版本,使用pycharm的console。出现TypeError: an integer is required (got type bytes)。
这是python3.8的一个新问题,好像会和旧版pycharm产生问题。
如果已经安装了ipython的话,这时打开python console就会一直进入ipython的交互页面。
解决方法:
把python/helpers/third_party/thriftpy/_shaded_thriftpy/_compat.py文件出错的地方的代码:
code = init.__code__
if PY3:
new_code = types.CodeType(len(varnames),
0,
len(varnames),
code.co_stacksize,
code.co_flags,
code.co_code,
code.co_consts,
code.co_names,
varnames,
code.co_filename,
"__init__",
code.co_firstlineno,
code.co_lnotab,
code.co_freevars,
code.co_cellvars)
elif JYTHON:
from org.python.core import PyBytecode
改成下面这样(亲测通过):
if PY3:
args = [len(varnames),
0,
len(varnames),
code.co_stacksize,
code.co_flags,
code.co_code,
code.co_consts,
code.co_names,
varnames,
code.co_filename,
"__init__",
code.co_firstlineno,
code.co_lnotab,
code.co_freevars,
code.co_cellvars]
if sys.version_info >= (3, 8, 0):
#Python 3.8 and above supports positional-only parameters. The number of such
#parameters is passed to the constructor as the second argument.
args.insert(2, 0)
new_code = types.CodeType(*args)
elif JYTHON:
from org.python.core import PyBytecode