allenai / allenai/tango

Use vscode to debug tango

未關閉
#571 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
572
分支
55
PR 合併指標
30 天內沒有已合併 PR

描述

- File tree
```
.
├── components.py
├── config.jsonnet
├── debug.py
```

- The agent file called `debug.py`.
```python
import sys
import runpy
import os

base_path = os.path.dirname(__file__)
os.chdir(base_path)

args = 'python -m tango run config.jsonnet -i components -w ../workspace'

args = args.split()
if args[0] == 'python':
"""pop up the first in the args"""
args.pop(0)

if args[0] == '-m':
"""pop up the first in the args"""
args.pop(0)
fun = runpy.run_module
else:
fun = runpy.run_path

sys.argv.extend(args[1:])

fun(args[0], run_name='__main__')
```
- Then you can just click the `Debug the Python file` button to debug your project while viewing the `debug.py` file.

- Reference
- https://www.bilibili.com/video/BV1ta4y1u78v/

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。