1

I have tried doing this on 2 separate installations of python 3.9 on different computers which don't work and one of 3.5 and it does work on 3.5 on a third computer.

The code:

from win32com.client import combrowse
combrowse.main()

I have also tried adding a time.sleep(100) statement after the combrowse.main and have run it in the python terminal. All of these result in the Python Object Browser opening and immediately crashing (not responding) if I try to click anything. There is no error statement. Task manager doesn't show any significant CPU or ram usage.

Can someone else try running combrowse on 3.9 or 3.10 and see if it will work for you?

CristiFati
  • 38,250
  • 9
  • 50
  • 87
Ted Burt
  • 11
  • 2

1 Answers1

0

I tried with Python: v3.7, v3.8, v3.9, v3.10, and it worked with the 1st and failed with the rest. But it turns out that was only a coincidence, because of the different PyWin32 versions that I installed (at different points in time) for those Python versions. After a few more tries, I realized that it's a PyWin32 regression bug.

In order to only change one variable at a time, I chose Python 3.9 (that I use as main version) and played with different PyWin32 versions. Results below:

  • v300 - works
  • v301 - crashes (with the Python has stopped working dialog)
  • v303 - crashes (with the Python has stopped working dialog)
  • v304 - crashes (silently)

A (shallow) Google search didn't reveal anything relevant, also the error isn't quite trivial, it happens in PyWin32's .dlls (as expected).
In consequence, the only advice I can provide at this point is to downgrade PyWin32 to v300.

If I find some more details, I will share them here.



Update #0

In v301 some new (dialog display related) functionality was added, and also made the default. That doesn't work (OOTB, at least). Fortunately, the old one is still available - with a minor code change:

combrowse.main(modal=True)

It works for all above PyWin32 versions (that (normally) fail). A possible drawback is (obviously) the dialog being modal.



Update #1

After a deeper investigation, I think I've got it. Submitted [GitHub]: mhammond/pywin32 - Fix modeless COM browser dialog, which fixes the issue:

Img00

For possible ways to benefit from the fix (once it's accepted), check [SO]: How to change username of job in print queue using python & win32print (@CristiFati's answer) (at the end).

The PR was rejected (although worth reading the discussion), but the issue was fixed in [GitHub]: mhammond/pywin32 - Make modal dialog the default again in combrowse.main(). With that fix, combrowse.main() will now work.

CristiFati
  • 38,250
  • 9
  • 50
  • 87