【解决pycharm远程运行服务器连接报错问题】TypeError: an integer is required (got type bytes)

本文介绍如何解决PyCharm在远程运行时遇到的`TypeError: an integer is required (got type bytes)`错误。问题根源在于`_shaded_thriftpy/_compat.py`文件,通过替换特定代码段可以修复此问题。
摘要由CSDN通过智能技术生成

.pycharm_helpers/third_party/thriftpy/_shaded_thriftpy/_compat.py 

直接用下面的代码替换原文件代码即可

# -*- coding: utf-8 -*-

"""
    thriftpy._compat
    ~~~~~~~~~~~~~

    py2/py3 compatibility support.
"""

from __future__ import absolute_import

import platform
import sys
import types

PY3 = sys.version_info[0] == 3
PYPY = "__pypy__" in sys.modules
JYTHON = sys.platform.startswith("java")

UNIX = platform.system() in ("Linux", "Darwin")
CYTHON = False  # Cython always disabled in pypy and windows

# only python2.7.9 and python 3.4 or above have true ssl context
MODERN_SSL = (2, 7, 9) <= sys.version_info < (3, 0, 0) or \
    sys.version_info >= (3, 4)

if PY3:
    text_type = str
    string_types = (str,)

    def u(s):
        return s
else:
    text_type = unicode  # noqa
    string_types = (str, unicode)  # noqa

    def u(s):
        if not isinstance(s, text_type):
            s = s.decode("utf-8")
        return s

# `LOAD_ATTR` constants of `org.python.core.Opcode` class differs in Jython 2.7.0 and Jython 2.7.1
# <= Jython 2.7.1b3
# `Opcode` class in Jython 2.7.0 has the comment: "derived from CPython 2.5.2 Include/opcode.h"
JYTHON_2_7_0_LOAD_ATTR = 105
# >= Jython 2.7.1rc1
# `Opcode` class in Jython 2.7.1 has the comment: "derived from CPython 2.7.12 I
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值