pycharm无法正常调试问题

pycharm无法正常调试问题

1.错误代码

python 复制代码
已连接到 pydev 调试器(内部版本号 231.8109.197)Traceback (most recent call last):
  File "E:\Python\pycharm\PyCharm 2023.1\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 304, in _on_run
    r = r.decode('utf-8')
        ^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 1022-1023: unexpected end of data

进程已结束,退出代码-1073741510 (0xC000013A: interrupted by Ctrl+C)

2.解决方法

进行下图相关操作找到pydevd_comm.py文件,如何修改第304行代码为如下代码:

第304行代码:

python 复制代码
r = r.decode('utf-8')

修改后的的代码格式:

python 复制代码
try:
    r = r.decode('utf-8')
except UnicodeDecodeError:
    r = r.decode('latin-1')  # 尝试其他编码

修改前的图片:

修改后的代码展示:

3.调试展示

上述代码加完后,运行待调试的代码已经可以正常调试啦

相关推荐
曲幽13 分钟前
FastAPI实战:打造本地文生图接口,ollama+diffusers让AI绘画更听话
python·fastapi·web·cors·diffusers·lcm·ollama·dreamshaper8·txt2img
老赵全栈实战41 分钟前
Pydantic配置管理最佳实践(一)
python
阿尔的代码屋6 小时前
[大模型实战 07] 基于 LlamaIndex ReAct 框架手搓全自动博客监控 Agent
人工智能·python
AI探索者1 天前
LangGraph StateGraph 实战:状态机聊天机器人构建指南
python
AI探索者1 天前
LangGraph 入门:构建带记忆功能的天气查询 Agent
python
FishCoderh1 天前
Python自动化办公实战:批量重命名文件,告别手动操作
python
躺平大鹅1 天前
Python函数入门详解(定义+调用+参数)
python
曲幽1 天前
我用FastAPI接ollama大模型,差点被asyncio整崩溃(附对话窗口实战)
python·fastapi·web·async·httpx·asyncio·ollama
两万五千个小时1 天前
落地实现 Anthropic Multi-Agent Research System
人工智能·python·架构
哈里谢顿1 天前
Python 高并发服务限流终极方案:从原理到生产落地(2026 实战指南)
python