Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我你妈是真的服了,这个小小BUG还能发行到Visual Studio上面去? #1844

Closed
Aarondongsq opened this issue Feb 23, 2025 · 1 comment
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@Aarondongsq
Copy link

描述

在使用 Visual Studio 2022 时,遇到 Python调试 功能无法正常工作的情况。我无法使用Python解释器,也无法调试任何Python脚本。即使经过多次尝试修复,问题依旧存在,后面我他妈的找了GPT,才算是修复

复现步骤

  1. 打开 Visual Studio 2022,并确保安装了 Python 工具(Python 3.7.9解释器)。
  2. 创建一个Python项目或打开一个已有项目。
  3. 启动调试(F5)或附加调试器到Python脚本。
  4. 观察调试器失败并抛出错误:
    ImportError: cannot import name 'Literal' from 'typing'
    

期望结果

调试器应该能够正常运行Python脚本,能够逐步调试代码、检查变量和执行命令。

实际结果

调试器抛出 ImportError 错误,并且无法进行调试。

错误信息

Traceback (most recent call last):
  File "C:\***\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\***\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\__main__.py", line 69, in <module>
    from debugpy.server import cli
  File "c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy/..\debugpy\server\__init__.py", line 7, in <module>
    import debugpy._vendored.force_pydevd  # noqa
  File "c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy/..\debugpy\_vendored\force_pydevd.py", line 51, in <module>
    'pydevd',
  File "c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy/..\debugpy\_vendored\__init__.py", line 126, in preimport
    import_module(name)
  File "C:\Python\Python 3.7\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\pydevd.py", line 226, in <module>
    from _pydevd_bundle.pydevd_plugin_utils import PluginManager
  File "c:\program files\microsoft visual studio\2022\enterprise\common7\ide\extensions\microsoft\python\core\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_plugin_utils.py", line 4, in <module>
    from typing import Tuple, Literal
ImportError: cannot import name 'Literal' from 'typing' (C:\Python\Python 3.7\lib\typing.py)

附加信息

  • Python版本:3.7.9
  • Visual Studio版本:2022(企业版)
  • 该调试错误在尝试使用Python进行调试时发生。

备注

我真他妈的服了,这一个BUG竟然没经过审查就发布到用户这里?当所有用户都是顶真是吧?还不知道在Python 3.7.9中,typing 无法导入小模块 Literal 是吧?难道你不知道有个东西叫做 typing-extensions 吗?哪怕不知道,你问ChatGPT都会告诉这个低级错误如何纠正吧?国际大厂的水平就这个样?

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Feb 23, 2025
@rchiodo
Copy link
Contributor

rchiodo commented Feb 24, 2025

Thanks for the issue. Debugpy doesn't support older versions of python. At least not the latest version of debugpy. You'll have to go find an older version of debugpy and I'm assuming the vscode-python-debugger extension in vscode to debug 3.7.

See here for the supported versions of python:
https://devguide.python.org/versions/

3.9 is the oldest version currently supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

3 participants