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

Source links do not work for remote debugging #144

Open
OriginalBitFlipper opened this issue Apr 30, 2019 · 2 comments
Open

Source links do not work for remote debugging #144

OriginalBitFlipper opened this issue Apr 30, 2019 · 2 comments

Comments

@OriginalBitFlipper
Copy link

OriginalBitFlipper commented Apr 30, 2019

Hi,

I'm using PyCharm on Windows 10 and remote debug into a Linux VM. So in this case there are mapped paths between where the Python scripts are locally and where they are located remotely (IOW, Windows style paths locally and Unix style paths remotely), e.g:

Path Mapping:
C:\projects\foo -> /home/user/projects/foo

When an exception is thrown, you will see something in the console like this:

    Traceback (most recent call last):
      File "/home/user/projects/foo/bar.py", line 123, in MyFunction

In the original output console, the "/home/user/projects/foo/bar.py" path will be a link, and clicking on it will take you to the corresponding source file, even though the file is located on Windows and the real path is "C:\projects\foo\bar.py".

However in the Grep Console, the source file will not be shown as a link, so one cannot click on it to go to the line where the exception occurred.

Interestingly, if I explicitly print a source line but use the Windows path style, it shows up as a link in Grep Console, e.g.:

   print('   File "C:\\projects\\foo\\bar.py", line 123, in MyFunction')

The above is shown as a link in the Grep Console output and is clickable.

[edit] Note the file must actually exist locally for it to be shown as a link.

So it seems Grep Console only treats Windows style paths on Windows as links, while PyCharm treats both Windows and Unix style paths as links.

I'm not sure who is responsible for displaying a source file as a link in Grep Console. If it is the Grep Console plugin itself then maybe if it simply displays anything within quotes after "File" that looks like either a Windows or a Unix file path as a link to the file, PyCharm will probably do the mapping to the local Windows file automatically when it is clicked, not sure.

PyCharm 2019.1.1 (Professional Edition)
Build #PY-191.6605.12, built on April 3, 2019
JRE: 11.0.2+9-b159.34 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

@krasa
Copy link
Owner

krasa commented Apr 30, 2019

I found the thing that does it https://github.com/JetBrains/intellij-community/blob/master/python/src/com/jetbrains/python/run/PyRemoteTracebackFilter.java#L28

The solution would be do some dirty hacks and check if the original console has one, and then add it to the grep console. Probably doable.

@OriginalBitFlipper
Copy link
Author

Interesting. It's certainly not a critical issue but definitely a very-nice-to-have feature when doing remote debugging + Grep Console.

Thanks for taking a look!

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