elazarcoh / simply-view-image-for-python-debugging

visual studio code extension simply view the image of the image variables when debugging python
https://marketplace.visualstudio.com/items?itemName=elazarcoh.simply-view-image-for-python-debugging
MIT License
57 stars 6 forks source link

No popup/response when debugging with an attach request to a remote machine. #36

Closed b7leung closed 2 months ago

b7leung commented 2 years ago

When I'm debugging with a launch request, eg with a configuration like

        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        },

the extension works great. However, when I'm debugging with an attach request, like

        {
            "name": "Attach name,
            "type": "python",
            "request": "attach",
            "host": "my_host_name",
            "port": host_port_num
        },

the "view image" hover popup does show, and variables are recorded in the "image watch" section, but when I click them nothing happens (there is no side window showing the image). It would be amazing if this extension could be used for attach debugging sessions, which is how I always debug in my use case; I cannot debug through a launch config.

elazarcoh commented 2 years ago

I'll look into it

elazarcoh commented 2 years ago

Okay, seems since the debug is performed remotely, and the extension is running locally, the save paths are local paths. For a debug inside local docker container, a workaround might be to map local paths into remote paths. This might not work very easily, though. Maybe only if both remote and local platforms are the same (e.g. linux-linux).

(Note to myself) A possible solution is to pass the entire image as bytes via the debugger, and save it locally. This needed only for such cases where the debugger and VSCode do not share the same filesystem. Need to find a way to figure out how can I detect that from vscode.debug.activeDebugSession (maybe in vscode.debug.activeDebugSession.debugOptions).

Note that this might take a while for me to get, though, as it not seems to be trivially solved.

If you have any other suggestions I'd love to hear them.

b7leung commented 2 years ago

Actually, it seems like just unchecking usetmppathtosave fixed the issue. Like you mentioned, the issue was not being able to find paths. Thankfully, my case is a bit simpler, since my local and remote share the same home directory (accessing the same storage), but are different machines (so have a different /tmp folder). This option clearly wouldn't work in more complicated remote setups though.

Also, thanks for working on this great extension! And it was super cool that you responded so quickly.

elazarcoh commented 2 years ago

Great to hear that was simple enough for your case!

I'll keep this issue open and will get around fixing it in a more complete way when I have the time for it.

MaKaNu commented 2 years ago

I have probably a similar issue (can't find outputs from the extension) but instead of a local docker I am connected to a remote ssh server. unchecking usetmppathtosave was not successful for me, since remote linux and local windows. Any workarround for this situation?

Edit: Nevermind worked fine I tried to open a boolean image. Recognized after I found the debug options.