First time here? Check out the FAQ!

Path is duplicated, can't debug

I've started a new topic for the discussion that was started around PyGTK (…). PyGTK is no longer in the picture... I'm just trying to get basic debugging working on a new installation of WingIDE

I create a new project in a temp folder. I create the following file "":

print("Hello world!")
x = 4 / 0
print("All done!")

I put a break point on the divide by zero line, and run the code. The break point does not catch, and the divide by zero gives me this error:

File "C:\Temp\Python\test/c:\Temp\Python\test\", line 3, in <module>

builtins.ZeroDivisionError: division by zero

You can see that the path for is messed up, sort of "doubled". I assume that's why the break points aren't working. And if I double-click on the error (what always used to take me to the offending line), it does nothing.

So what stupid, simple error am I making?!


I've done a little more testing. In the New Project dialog, if I select "Use Existing Python" and under Python Executable select "Use Default" , everything works just fine, with break points and normal file paths. (That uses a Python 3.8.10 environment that I have installed on my system)

However, if as Python Executable I select "Command Line" (still under "Use Existing Python"), and I select my MSYS2 environment, "C:/msys64/mingw64/bin/python.exe", then I get this behavior of "doubled" path, and break points not working:

File "C:\Temp\Python\test4/c:\Temp\Python\test4\", line 4, in <module>

builtins.ZeroDivisionError: division by zero

The MSYS2 Python executable is 3.11.5, and seems to be working normally otherwise. But the WingIDE debugger doesn't seem to be "connected" into it somehow. Any suggestions?

JeffH's avatar
asked 2023-09-19 20:34:36 -0500
Wingware Support's avatar
Wingware Support
updated 2023-09-30 01:52:49 -0500
edit flag offensive 0 remove flag close merge delete


add a comment see more comments

2 Answers


Wing 9.1.2 fixes debugger support for mingw Windows python builds, which I think will address the problem. Please let us know if not.

Wingware Support's avatar
Wingware Support
answered 2023-09-30 01:52:39 -0500
edit flag offensive 0 remove flag delete link


I have now tested Wing 9.1.2, and it does indeed seem to fix the problems I was having with debugging mingw python builds (in the MSYS2 environment) on Windows. Elsewhere in this thread it was pointed out that "MSYS2 is the only supported way to run PyGObject apps in Windows." So I'm very grateful to be able to get back to debugging my PyGObject (GTK3) project. Thank you for your prompt help in resolving this problem!

JeffH's avatar JeffH (2023-10-04 14:31:08 -0500) edit

Great, thanks for letting us know!

Wingware Support's avatar Wingware Support (2023-10-05 07:05:42 -0500) edit
add a comment see more comments

It looks like msys2's python is a Cygwin build of python so unfortunately it cannot be started from within Wing. You should be able to use it if you launch externally, though. Please see the Using Wing with Cygwin howto at

Wingware Support's avatar
Wingware Support
answered 2023-09-20 12:15:59 -0500
edit flag offensive 0 remove flag delete link


OK, I think I've made some progress. I copied my project files over to the MSYS2 environment, and can run the code there (with no debugging) from the MSYS2 command prompt. I copied from the install directory to the project directory. I created a new project and used Project > Add Existing Directory to connect the project to the source code in the MSYS2 environment. Then I added "import wingdbstub" to my code. Now when I run the code, I do get some reaction in Wing... I get the following in the status bar:

Debugger: Debug process running; pid=7024; Listening for connections: localhost (port 50005) …

But it still doesn't stop at breakpoints. And if I introduce an error to the code, it does catch the error in WingIDE, but I still get the same "doubled" path as before:

File "C:/msys64/home/jeff_/mytest/C:/msys64/home/jeff_/mytest/", line 105, in <module>

builtins.ZeroDivisionError: division by zero ...
JeffH's avatar JeffH (2023-09-20 20:30:23 -0500) edit

I suspect you need to remove the *.pyc/pyo files or the __pycache__ directory which contains those. The files were probably generated earlier with the invalid path and aren't being regenerated because the *.py has not changed since then.

Wingware Support's avatar Wingware Support (2023-09-21 00:16:28 -0500) edit

Still no joy... There was indeed a __pycache__ folder in the mytest directory, so I deleted that. But running the code in MSYS2 creates the __pycache__ folder again with a wingdbstub.cpython-311.pyc file in it, but debugging still doesn't work.

Let me walk through creating a new project in Wing, and maybe you can spot where I'm going awry.

  • Project > New Project...
  • Create New Directory, name: mytest, Parent Dir: C:\msys64\home\jeff_
  • Project Type: Custom, Check "Use wingdbstub for Debugging", click Next
  • Use Existing Python, Command Line: C:\msys64\mingw64\bin\python.exe
  • click Create Project Project
  • completion message: "The project was successfully created and saved. The following actions were completed during project setup: Created source directory, set testing framework, added directory to project, configured, saved the project, set Python Executable, enabled debug listening"
  • File > New, add following code:

    #import wingdbstub #x = 4 / 0 print("Hello World!")

  • save as ""

  • in MSYS2, go to ...
JeffH's avatar JeffH (2023-09-21 16:59:38 -0500) edit

I've reproduced it and will be looking into it. I mistakenly used the Cygwin python that comes with msys2 rather than the mingw python and the debugger is confused by the mingw python. I do think you need to use the mingw python with pygtk / gobject and probably want to use it anyway. It is too bad that there pygtk / gobject isn't available for python from

Wingware Support's avatar Wingware Support (2023-09-21 20:00:08 -0500) edit

Thanks so much for looking into this. Glad to know that I'm not as incompetent as I had feared... :-) Yes, it is sad that you only seem to be able to get pygtk / gobject through the MSYS2 environment. I found this info: "MSYS2 is the only supported way to run PyGObject apps in Windows." (See the comment from Dan Yeaw in this thread:….) In previous iterations of pygtk / gobject, I could find an installer that would install it directly into my main Python environment, avoiding all these difficulties...

JeffH's avatar JeffH (2023-09-22 08:33:35 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer