Can't run program because it asks me to attach on process

James Shaw 1 Reputation point
2021-07-08T02:48:47.52+00:00

Hi guys,
I am using VS 2019
i have dragged an dropped a ".py" file into the VS 2019 icon and which has opened up a VS 2019 with the code however the green arrow to debug the code says "attach..."
I want to run a debugger, which is normally there instead of the "attach..." button.

how can i run a debugger?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,193 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 31,246 Reputation points Microsoft Vendor
    2021-07-08T05:39:58.863+00:00

    Hello @James Shaw ,

    Welcome to Microsoft Q&A forum.

    You need to create a new Python related project(or open a Python project) in Visual Studio to debug your project which includes the .py file and python codes. Just open a single .py file is not enough to debug the project in Visual Studio, so you will see the “Start” changed to “Attach…”.

    112769-image.png

    112784-image.png

    Suggestion:

    Please try to create a Python project and then copy and paste the Python code from the single .py file to the project’s .py file and then debug the whole project.

    BTW, for more information about Attach to process feature, you can refer to this document: Attach to running processes with the Visual Studio debugger.

    Best Regards,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.