Debugger opens new instance of code file in editor

Answered
When debugging a python script, the debugger opens another instance of the code file (another tab).  This file is opened with an absolute file name and is considered to be "outside of the project".  Changes to the code in this tab are not automatically reflected in the previous tab.

The debugger works fine, but this is strange behavior.  Is there a way to debug a script file without the debugger opening a new instance?

John
4 comments
Comment actions Permalink
In general this is controlled by the "Path mappings" setting in the Remote Debug config. If this is set up correctly it should jump to the right place in your local copy of the source rather than the one outside the project.

What platform/OS are you using? I have had the exact problem you describe under Windows with the path mapping feature. See this other forum post. I ended up changing things around so I could use local (non-remote) debugging in most cases.  When I use PyCharm remote debugging under Mac I don't have this problem.
0
Comment actions Permalink
Hmm.  I'm using the community version so I'm not sure remote debugging is available.  Regardless, I found the problem.  I needed to check "Single Instance" in Run/Debug configuration.

Thanks for your help.

John

P.S. I'm using PyCharm under Linux (Ubuntu 14.04)
0
Comment actions Permalink

I realize this is an old post, but I'm having a very similar issue with PyCharm 2019.2 Professional. When debugging tests executed with pytest, when a breakpoint is hit a new editor tab opens containing the code file, which is treated as "Out of the project", and leads to lots of confusing behavior regarding editing breakpoints, code changes, and unwanted dialogs popping up. The solution above seems to be out of date.. is there a new solution?

0
Comment actions Permalink

@Brendan

Report it to https://youtrack.jetbrains.com/issues/PY attaching idea.log. If the issue is reproducible in a brand new project, please describe the procedure so we can try to reproduce it.

0

Please sign in to leave a comment.