admin管理员组文章数量:1315244
I use VS Code routinely for Python coding, and I've never had a problem with it until now. I can run a Kivy app without debugging from VS Code, but when I try to run it in debug mode, the app never starts. TThis happens when I choose "debug python file" from the menu, or when I try to use this launch.json config:
{
"name": "Debug Kivy App",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/main.py",
"args": ["--debug"]
// Note: I've tried it with and without "args" : ["--debug"]
}
Also, after I try to run the app in debug mode, I can't run the app without debugging until I close VS Code and restart it.
Here's a small test app I've tried to run in the debugger with no success but runs just fine in VS Code without the debugger:
from typing import Self
from kivy.app import App
from kivy.uix.button import Button
class DebugTest(App):
def build(self : Self) -> Button:
return Button(text="blah", on_release = self.button_press)
def button_press(self : Self, instance : Button) -> None:
print("Button pressed")
if __name__ == '__main__':
DebugTest().run()
The operating system I'm running this on is Ubuntu 24.10, and I'm using VS Code 1.96.4, which I believe is the latest version. The python version is 3.13.0, which, according to the Kivy website, is Kivy compatible.
I have no output to show you because the app just doesn't start when I try to run it in debug mode from within VS Code. However, here is the output from running it without debugging:
kivytestrobert@rubunnytu:~/python/3.13.0/db_test$ /home/robert/.pyenv/versions/3.13.0/envs/kivytest/bin/python /home/robert/python/3.13.0/db_test/main.py
[INFO ] [Logger ] Record log in /home/robert/.kivy/logs/kivy_25-01-29_8.txt
[INFO ] [Kivy ] v2.3.1
[INFO ] [Kivy ] Installed at "/home/robert/.pyenv/versions/3.13.0/envs/kivytest/lib/python3.13/site-packages/kivy/__init__.py"
[INFO ] [Python ] v3.13.0 (main, Oct 14 2024, 11:37:50) [GCC 13.2.0]
[INFO ] [Python ] Interpreter at "/home/robert/.pyenv/versions/3.13.0/envs/kivytest/bin/python"
[INFO ] [Logger ] Purge log fired. Processing...
[INFO ] [Logger ] Purge finished!
[INFO ] [Factory ] 195 symbols loaded
[INFO ] [ImageLoaderFFPy] Using ffpyplayer 4.5.2
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] Backend used <sdl2>
[INFO ] [GL ] OpenGL version <b'4.6 (Compatibility Profile) Mesa 24.2.3-1ubuntu1'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Mesa Intel(R) HD Graphics 530 (SKL GT2)'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Base ] Start application main loop
[INFO ] [GL ] NPOT texture support is available
[INFO ] [Base ] Leaving application in progress...
kivytestrobert@rubunnytu:~/python/3.13.0/db_test$
Running ps -aux | grep -i python after trying to run the app in debug mode with VS Code shows:
robert 152988 0.4 0.0 6164 4848 ? S 15:39 0:01 /home/robert/.vscode/extensions/ms-python.python-2024.22.2-linux-x64/python-env-tools/bin/pet server
robert 153853 4.3 1.4 1214080120 234556 ? Sl 15:39 0:08 /usr/share/code/code /home/robert/.vscode/extensions/ms-python.vscode-pylance-2024.12.1/dist/server.bundle.js --cancellationReceive=file:27507b40408191bdb10300c13fc80a5472ab60567d --node-ipc --clientProcessId=152901
That doesn't seem relevant, but I'm including it in case I'm wrong.
I've scoured the web for a solution to no avail. Any help would be greatly appreciated. I prefer VS Code for python programming, and I don't want to switch to another IDE for Kivy programming.
Edit: It apparently had something to do with the plugins. I deleted my .vscode directory and recreated it by running VS Code again,then added only the bare minimum of plugins I needed. Debugging now works fine. I'll add the others back one by one after I'm done with this project and, hopefully, find out where the conflict is.
本文标签: pythonMy Kivy app doesn39t start when I try to launch it in VS Code in debug modeStack Overflow
版权声明:本文标题:python - My Kivy app doesn't start when I try to launch it in VS Code in debug mode - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741980989a2408393.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论