3

I've been trying to debug a python code on my RPi from VS2013 using python tools for visual studio, but failed all the time to connect to the python console running in Pi,

this is my code frag.in Pi:

import ptvsd
ptvsd.enable_attach('secret',address = ('0.0.0.0',5678))
ptvsd.wait_for_attach()

for i in range(10):
    print (i)
print ('hello visual studio')

Im using Python3 in both the machines and using the latest version of ptvsd i belive (PTVS 2.1 RC2 VS 2013)

When i try to connect, I'm getting an error message which says

Remote server at tcp://secret@rgpi:5678/ is not a Python tools for Visual Studio remote debugging server, or it's version is not supported.

where rgpi is the hostname of my Pi, any help would be much appreciated, thanks

  • It is almost certainly a ptvsd version mismatch. Can you clarify how you had it installed onto RPi? If you used `pip install ptvsd`, keep in mind that this will give you the most recent _stable_ version, which is currently still 2.0. If you want to install the most recent development version (2.1 RC), you have to do `pip install --pre ptvsd`. – Pavel Minaev Oct 13 '14 at 08:08
  • @PavelMinaev , thank you, that worked fine. The version that I had installed in my remote machine was 2.0. I've installed the version you've mentioned. Now I can connect fine to my Pi. But, I couldn't see VS asking to open the python file from the remote machine, the code just continued and began printing the numbers. What would be the reason? – Rakesh George Oct 14 '14 at 16:42
  • 1
    In general, VS doesn't pause when attaching (by any means). If you want to break, then you should open the source file in VS in advance, and set a breakpoint where you want it to stop. Also note that it doesn't have a way to open files remotely (yet; but see https://pytools.codeplex.com/workitem/2271). So you need to have the same source file available locally to open it in VS, and for the breakpoint to match running code, the filenames must match. Furthermore, if it is a module inside a package, then your local copy must also be a module inside a package (with `__init__.py` etc). – Pavel Minaev Oct 14 '14 at 16:52

0 Answers0