There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Attach to Process using Flask
I am writing an application using Flask, and I am having trouble attaching to a Python process for debugging. I am trying to attach to the process which my Flask development server is running on (127.0.0.1:5000).
I have followed the instructions within the "Cross-platform remote Python debugging" section in the documentation, and have had mixed success (but I have never fully gotten it to work).
I insert the following code just before I run my server:
ptvsd.attach_server.enable_attach(secret = None, address = ('127.0.0.1', 5000))
Then I go to "Tools --> Attach to Process", choose "Python remote debugging (unsecured)", and type in the appropriate qualifier to find my running process ('127.0.0.1:5000'). After doing that, I am actually able to see the process, and
I can 'attach' to it (I put 'attach' in quotes since at this point my process doesn't seem to work properly).
The problem is that as soon as my code runs the 'ptvsd.attach_server.enable_attach()' command, it seems to disable my server. Everything runs fine as long as I comment out that line so that that command does not run (although I am obviously not able to debug).
If I uncomment that line, if I then run the server and go to 127.0.0.1:5000 in my browser I get an error page that "This webpage is not available".
Does anyone have any ideas on why this isn't working?
I am running Visual Studio 2012 Professional and have version 2.0 of PTVS installed.