코딩일기

파이썬 args가 포함된 스크립트 명령어 vscode에서 디버깅하기 ( feat. Debugging Python with adding Script Args in VSCode, debug, debugging) 본문

카테고리 없음

파이썬 args가 포함된 스크립트 명령어 vscode에서 디버깅하기 ( feat. Debugging Python with adding Script Args in VSCode, debug, debugging)

daje 2022. 8. 9. 16:51
728x90
반응형

안녕하십니까 다제 입니다. 

오늘은 파이썬에서 args가 포함된 스크립트 명령어를 디버깅하는 방법에 대해서 안내 드립니다. 

Today I am going to show you to debug script commands with args in Python using Vscode.

 

Reference link

Click Debug icon → Click "실행 및 디버그" 

Click "구성 추가… "

Click Python and then You can see the automatically written python code.

{
    
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 현재 파일",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
            
        },
        {
            "name": "Python: 현재 파일",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}
  • 이것은 파이썬 디버그 실행모드를 추가하는 것입니다.
  • (This is to add python debug run mode.)
  • 이곳에 args를 추가하면 파이썬 스크립트 명령어에서 args가 필요한 명령도 수행할 수 있습니다.
  • (If you add the args code, you can run the script command with args.)

아래와 같이 args를 넣어주면 됩니다. 여기서는 순서가 중요하니 꼭 순서에 맞게 넣어주셔야 합니다.

(Just add args like below. The order is important here, so be sure to put them in the your args correct order.)

 

    "configurations": [
        {
            "name": "Python: 현재 파일",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": false
				    "args": ["--task", "babi:task10k:1", "--model-file", "/tmp/babi_memnn", "--batchsize", "1", "--num-epochs", "5", "--model", "memnn"],            
        },

디버깅 방법을 통해서 우리가 더욱 코딩 실력이 늘었으면 좋겠습니다.

(I hope we can improve our codings skills more through the debugging method.)

 

감사합니다.

 

728x90
반응형
Comments