jwi*_*720 10 python debugging visual-studio-code
我的setup.py has the following console_scripts as entry points:
entry_points={\n \'console_scripts\': [\'script=myapp.app:do_something\',\n \'script2=myapp.app:do_something2\'],\n },\n\nRun Code Online (Sandbox Code Playgroud)\n\n具有以下结构
\n\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 myapp\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 app.py\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 mod.py\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 mod2.py\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 submodules\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 __init__.py\n\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 mod3.py\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 requirements.txt\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 setup.py\nRun Code Online (Sandbox Code Playgroud)\n\n和应用程序看起来像
\n\n##my_app.app\n\ndef do_something():\n #do stuff\ndef do_something2():\n #do other stuff\n\nRun Code Online (Sandbox Code Playgroud)\n\n如何获取 VS 代码调试配置以输入这些模块属性。if __name__ == "__main__": do_something()如果我使用但想要根据 console_scripts 单独的 launch.json 文件,我可以运行该模块
##launch.json\n{\n "configurations": [\n {\n "name": "Python: Module",\n "type": "python",\n "request": "launch",\n "cwd": "${workspaceFolder}",\n "module": "myapp.app",\n "args": ["--hello world"]\n }\n ]\n}\nRun Code Online (Sandbox Code Playgroud)\n\n认为你也许可以做类似的事情:
\n\n "module": "myapp.app:do_something",\nRun Code Online (Sandbox Code Playgroud)\n\n可惜:
\n\nNo module named myapp.app:do_something\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
1769 次 |
| 最近记录: |