core icon indicating copy to clipboard operation
core copied to clipboard

[Question] python 插件找不到模块应该怎么办?

Open zhuzeyu22 opened this issue 10 months ago • 2 comments

opensumi 里面的 python 插件找不到我的 python 模块怎么办呀?

我的 python 路径和 opensumi 的安装路径在一起

launch.json 我是这样写的不知道对不对 {   // 使用 IntelliSense 了解相关属性。   // 悬停以查看现有属性的描述。   // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387   "version": "0.2.0",   "configurations": [     {       "name": "Python: 当前文件",       "type": "python",       "request": "launch",       "program": "et_bootstrap",       "pythonPath": "D:\xxxxx\python.exe",       "console": "integratedTerminal",       "env": {         "scripts": "${runPythonScripts}",         "PYTHONPATH": "D:\xxxxxx\Python37\Lib\et_bootstrap"       }     }   ] }

报错信息 Traceback (most recent call last): File "D:\workspace\et_upper4\out-x64\Python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "D:\workspace\et_upper4\out-x64\Python37\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "D:\workspace\et_upper4\extensions\ms-python.python\pythonFiles\lib\python\debugpy_main.py", line 45, in cli.main() File "D:\workspace\et_upper4\extensions\ms-python.python\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "D:\workspace\et_upper4\extensions\ms-python.python\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 267, in run_file runpy.run_path(options.target, run_name=compat.force_str("main")) File "D:\workspace\et_upper4\out-x64\Python37\lib\runpy.py", line 261, in run_path code, fname = _get_code_from_file(run_name, path_name) File "D:\workspace\et_upper4\out-x64\Python37\lib\runpy.py", line 231, in _get_code_from_file with open(fname, "rb") as f: FileNotFoundError: [Errno 2] No such file or directory: 'et_bootstrap'

zhuzeyu22 avatar Apr 01 '24 02:04 zhuzeyu22

@zhuzeyu22 你这里使用的一些表达式如 ${runPythonScripts} 不支持,需要自行基于 https://github.com/opensumi/core/blob/a53fac57ec78743997f602682e661ba9594ec99e/packages/variable/src/browser/variable-resolver.contribution.ts#L21 拓展支持。

文件路径找不到的问题可能与 Windows 下的路径转换有关系,需要自行排查一下这里逻辑:

https://github.com/opensumi/core/blob/a53fac57ec78743997f602682e661ba9594ec99e/packages/debug/src/browser/debug-session-manager.ts#L363

erha19 avatar Apr 02 '24 02:04 erha19

变量有拓展

zhuzeyu22 avatar Apr 03 '24 07:04 zhuzeyu22

此问题已被自动标记为已过时,如果没有进一步的活动,它将被关闭。谢谢您的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '24 11:06 stale[bot]