Search code examples
pythoneclipsedebuggingconsolepydev

Pydev source file hyperlinks in Eclipse console


When a python app crashes the console displays hyperlinks to the source code where the exceptions occurred. You just click the link and your source file is opened in the Eclipse editor.

I have my own exception handler and would like to put links to source files in the console when my apps crash.

I have looked for info on this a few times and cannot see how to do it or if it is possible at all.

It seems that it can be done in java by writing to the console in the form ':' - A listener picks this up and converts it to a clickable link. This does not work in Python.

Any ideas?


Solution

  • If you want to put links to be clickable in PyDev, you have to do it in the same way that's presented in Python.

    I.e.: You can see from https://github.com/fabioz/Pydev/blob/master/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/PythonConsoleLineTracker.java that the pattern it matches is:

    .*(File) \\\"([^\\\"]*)\\\", line (\\d*).

    (note that \ is the escape in a string on on java).