Reputation: 2556
I am using VScode and I would like to debug a program that is used with a pipe command.
In the console, I run my program with
cat dataset.txt | python my_program.py
How can I configure VSCode to pass the cat
command so I can debug the program correctly?
I suspect I need to edit launch.json
?
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
Upvotes: 12
Views: 4971
Reputation: 76
If you change "console" to "externalTerminal", when you run the program an external terminal window will open. This window has stdin connected to the keyboard, so if you type or paste content it will be passed to the program until you send or type ctrl-z. stdout goes to the window. Debugging and breakpoints work as expected.
Upvotes: 6