seanwu1105 / vscode-qt-for-python

Qt for Python (PySide and PyQt) extension for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=seanwu.vscode-qt-for-python
MIT License
186 stars 15 forks source link

打开 qml 文件时候报错 #296

Closed niuzhenyong closed 1 year ago

niuzhenyong commented 1 year ago

我使用 conda 建立了一个叫做 gui 的开发环境,在 vscode 中将 python 解释器配置为 C:\Users\nzy\miniconda3\envs\gui\python.exe, 执行 python 程序没有问题,但是当我打开 qml 文件的时候,显示如下错误:

Command failed: C:\Users\nzy\miniconda3\envs\gui\python.exe c:\Users\nzy.vscode\extensions\seanwu.vscode-qt-for-python-7.2.2\python\scripts\qmlls.py --help

环境内容如下:

vscode : 1.76.2 Python:3.10.10 PySide : 6.4.3

seanwu1105 commented 1 year ago

Could you provide the messages from the extension output?

niuzhenyong commented 1 year ago

Qt for Python 的输出只有:

[ERROR - 08:54:21]

Command failed: C:\Users\nzy\miniconda3\envs\gui\python.exe c:\Users\nzy.vscode\extensions\seanwu.vscode-qt-for-python-7.2.2\python\scripts\qmlls.py --help


vscode 的输出如下:

2023-04-04 08:50:56.405 [info] Electron sandbox mode is enabled! 2023-04-04 08:50:56.441 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.vscode-selfhost-test-provider' wants API proposal 'testContinuousRun' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned. 2023-04-04 08:50:56.442 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.remote-repositories' wants API proposal 'contribEditorGutterMenu' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned. 2023-04-04 08:50:56.442 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'github.vscode-pull-request-github' wants API proposal 'contribEditorGutterMenu' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned. 2023-04-04 08:50:56.447 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-toolsai.jupyter' wants API proposal 'notebookControllerKind' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned. 2023-04-04 08:51:00.107 [info] [perf] Render performance baseline is 89ms


扩展宿主的输出:

2023-04-04 08:50:58.046 [info] Extension host with pid 3168 started 2023-04-04 08:50:58.046 [info] Skipping acquiring lock for c:\Users\nzy\AppData\Roaming\Code\User\workspaceStorage\4cf4ba3c221a0bc47a72bfeddf8f1293. 2023-04-04 08:50:58.287 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage' 2023-04-04 08:50:58.830 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '', root cause: vscode.git 2023-04-04 08:50:58.929 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '' 2023-04-04 08:50:58.930 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '' 2023-04-04 08:50:59.107 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github' 2023-04-04 08:50:59.156 [info] Eager extensions activated 2023-04-04 08:50:59.200 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished' 2023-04-04 08:50:59.201 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished' 2023-04-04 08:50:59.201 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender, startup: false, activationEvent: 'onStartupFinished' 2023-04-04 08:50:59.250 [error] No bundle location found for extension ms-vscode-remote.remote-wsl-recommender 2023-04-04 08:50:59.357 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft' 2023-04-04 08:51:55.669 [info] ExtensionService#_doActivateExtension vscodevim.vim, startup: false, activationEvent: '' 2023-04-04 08:54:17.666 [info] ExtensionService#_doActivateExtension ms-python.python, startup: false, activationEvent: 'onLanguage:qml', root cause: seanwu.vscode-qt-for-python 2023-04-04 08:54:17.835 [warning] Using default string since no string found in i18n bundle that has the key: You need to select a Python interpreter before you start debugging.

Tip: click on "Select Interpreter" in the status bar. 2023-04-04 08:54:17.835 [warning] Using default string since no string found in i18n bundle that has the key: The Python extension now includes Pylance to improve completions, code navigation, overall performance and much more! You can learn more about the update and learn how to change your language server here.

Read Pylance's license here. 2023-04-04 08:54:17.837 [warning] Using default string since no string found in i18n bundle that has the key: The Microsoft Python Language Server has reached end of life. Your language server has been set to the default for Python in VS Code, Pylance.

If you'd like to change your language server, you can learn about how to do so here.

Read Pylance's license here. 2023-04-04 08:54:17.984 [info] ExtensionService#_doActivateExtension seanwu.vscode-qt-for-python, startup: false, activationEvent: 'onLanguage:qml' 2023-04-04 08:54:18.300 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc' 2023-04-04 08:54:18.300 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc' 2023-04-04 08:54:18.301 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc' 2023-04-04 08:54:18.553 [info] ExtensionService#_doActivateExtension ms-python.vscode-pylance, startup: false, activationEvent: 'api', root cause: ms-python.python 2023-04-04 09:03:35.615 [info] ExtensionService#_doActivateExtension ms-toolsai.jupyter, startup: false, activationEvent: 'onLanguage:python' 2023-04-04 09:03:35.903 [warning] Using default string since no string found in i18n bundle that has the key: Python is not installed. Please download and install Python in order to execute cells in this notebook. Once installed please reload VS Code. 2023-04-04 09:03:35.903 [warning] Using default string since no string found in i18n bundle that has the key: Please check the 'Jupyter' output panel for further details./Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel 2023-04-04 09:03:35.904 [warning] Using default string since no string found in i18n bundle that has the key: Jupyter Server Console 2023-04-04 09:03:35.904 [warning] Using default string since no string found in i18n bundle that has the key: Operation not supported in web version of Jupyter Extension. 2023-04-04 09:03:35.904 [warning] Using default string since no string found in i18n bundle that has the key: type to filter 2023-04-04 09:03:35.904 [warning] Using default string since no string found in i18n bundle that has the key: Failed to install the Python Extension. 2023-04-04 09:03:37.199 [info] ExtensionService#_doActivateExtension ms-toolsai.jupyter-renderers, startup: false, activationEvent: 'api', root cause: ms-toolsai.jupyter

seanwu1105 commented 1 year ago

I could not reproduce the problem on my end. Could you try to call the official pyside6-qmlls directly and see what is the result?

# with your Python environment activated
pyside6-qmlls --help

Basically, the script provided by this extension use the same dependency the official executable uses. Thus, it is likely the command mentioned above will also fail due to some environment issues. I need more information, such as error messages about the pyside6-qmlls to investigate.

cong commented 1 year ago
  1. 请问您是如何在 vscode 中将 python 解释器配置为 C:\Users\nzy\miniconda3\envs\gui\python.exe的?通过项目中.vscod文件夹的setting.json么?
  2. 在项目中右键点击 Create Qt UI File (designer) 会自动启动 Qt designer么?
niuzhenyong commented 1 year ago

1、在vscode 终端窗口执行 pyside6-qmlls --help 显示结果如下:

Microsoft Windows [版本 10.0.19045.2728] (c) Microsoft Corporation。保留所有权利。

D:\gui\options>C:/Users/nzy/miniconda3/Scripts/activate

(base) D:\gui\options>conda activate gui

(gui) D:\gui\options>pyside6-qmlls --help Usage: C:\Users\nzy\miniconda3\envs\gui\Lib\site-packages\PySide6\qmlls [options] QML languageserver

Options: -?, -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options.
-w, --wait Waits the given number of seconds before startup
-v, --verbose Outputs extra information on the operations being
performed -l, --log-file Writes logging to the given file -b, --build-dir Adds a build dir to look up for qml information
--write-defaults Writes defaults settings to .qmlls.ini and exits
(Warning: This will overwrite any existing settings and comments!) --ignore-settings Ignores all settings files and only takes command line options into consideration

(gui) D:\gui\options>

1

2、我没有在配置文件中设置解释器的位置,我是在py文件的编辑窗口的右下角选择的python环境。 3、在项目中右键点击 Create Qt UI File (designer) 能够正常启动 Qt designer。

niuzhenyong commented 1 year ago

2 我又自己看了一下,从输出的信息看,是不是缺少了目录分隔符导致的?上面的文本信息是从错误窗口复制出来的,应该不是人为漏掉的。

niuzhenyong commented 1 year ago

刚刚升级到7.3.1版本后,问题消失了,多谢!👌