Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not show the image during debugging the python code. #6

Closed
zhfkt opened this issue Jan 22, 2021 · 6 comments
Closed

Can not show the image during debugging the python code. #6

zhfkt opened this issue Jan 22, 2021 · 6 comments

Comments

@zhfkt
Copy link

zhfkt commented Jan 22, 2021

Hi,

I am debugging the remote python code through wsl, and the plugin can not show the image during debugging the python code.

The logs says:

[2021-01-22 11:53:54.619] [exthost] [error] [johnguo.simply-view-image-for-python-opencv-debugging] provider FAILED
[2021-01-22 11:53:54.627] [exthost] [error] Error: Unable to find thread to evaluate variable reference.
at t.RawDebugSession.handleErrorResponse (file:///C:/Users/SHData/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3369:750)
at file:///C:/Users/SHData/AppData/Local/Programs/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3369:55

image

Pls review.

Thank you !

@john-guo
Copy link
Owner

Hello,

I have tested with wsl and it's no problem. Do you install the extension in wsl? The extension must be installed in wsl not local if you want to debug in wsl.

screenshot 2021-01-22 235529

@zhfkt
Copy link
Author

zhfkt commented Jan 25, 2021

Hi @john-guo

I installed the extension in both local and wsl env

image

Could we have some way to collect extension logs for what happened in my local envs ? then I could provide extension logs to you for futher debugging ?

@john-guo
Copy link
Owner

How do you start the debug? Could you paste some Python Debug Console outputs? Could you create a tiny python to test this issue, such as:

import numpy as np
import cv2

img = cv2.imread("test.jpg")

pass

or you can add some logs in ViewImageService.ts:

		let res = await session.customRequest('threads', {});
--------> console.log(res); 
		let threads = res.threads;
		let mainThread = threads[0].id;
--------> console.log(`main:${mainThread}`);

But I don't know if this will be helpful.

@zhfkt
Copy link
Author

zhfkt commented Feb 1, 2021

Hi @john-guo

Thank you for your the suggestion. I just saw the log from the "Log (Remote Extension)" in the output window in the following screenshot

image

Unfortunately I didn't have much time to debug further because I was too busy in recent days. I used another plugin from Pycharm on https://plugins.jetbrains.com/plugin/14371-opencv-image-viewer as an alternative choice. You could close this issue if you would like to close it.

@john-guo
Copy link
Owner

john-guo commented Feb 1, 2021

Hi zhfkt

It seems this issue is caused by multi-threading. Because the vscode debug api cannot provide the current thread id in active debug session, I use the first thread id to evaluate the expression. I will modify the limition description in ReadMe.Thank you.

@john-guo john-guo closed this as completed Feb 1, 2021
@john-guo
Copy link
Owner

john-guo commented Feb 2, 2021

Hi @zhfkt

After some experimentation I made a workaround in multithreaded debugging. Hope it works for you. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants