0

I am using Visual Studio Code on Windows 10 machine: enter image description here

Here is my code:

import sys

if __name__ == "__main__":

    print(sys.argv[0])
    print(sys.argv[1])

When I execute it, in the terminal window by passing a parameter:

c:; cd 'folder_path\code'; & 'folder_path\python3.9.exe' 'folder_path\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\lib\python\debugpy\launcher' '58259' '--' 'folder_path\code\cmd_line.py' test  

I get an error

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
1
  • that is a debug connection problem Commented Jan 18, 2022 at 22:39

2 Answers 2

1

Do you execute the debug command again after you debug the python file? It will not work.

After you debug, the debug server will be closed and the server port will be changed in the next time, so the same debug command can not be executed twice.

You can right-click and select Run Python File in Terminal. And this command can be executed any times.

Sign up to request clarification or add additional context in comments.

Comments

0

Try simply run this in the terminal:

python folder_path\code\cmd_line.py test

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.