Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#226 PythonWin run-script opens file-open-dialogs in a tight loop

pythonwin (176)

On my system, python2.4+win32all build 204,
as well as on the previous build build203 of win32all,
pythonwin is unable to run any script and the Run
Script dialog seems severely borked.

When I hit Ctrl+R it opens the Run Script dialog, and
then it is like something has clicked the Browse
button. The file-open dialog opens. I can not cancel
this dialog, or move it, for every time I move the
current file-open dialog, or cancel it, orclick okay,
another one opens. I can get dozens of File Open
dialogs open at once. Once I am stuck here the only
option is to kill PythonWin from the task manager.

I don't know how to debug this situation, but if anyone
can tell me how to further investigate this, I'll look
into the best I can.

In scriptutils.py, I made the changes marked by
asterisks below:

class DlgRunScript(dialog.Dialog):
def OnBrowse(self, id, cmd):
** if self.browsing:
** return 0
** self.browsing = 1
openFlags =
dlg = win32ui.CreateFileDialog(1,None,None,openFlags,
"Python Scripts (*.py)|*.py||", self)
dlg.SetOFNTitle("Run Script")
if dlg.DoModal()!=win32con.IDOK:
return 0
self['script'] = dlg.GetPathName()
** self.browsing = 0
return 0

This was intended to prevent any endless showing of the
dialog in a loop, which makes the problem less nasty
but doesn't fix the problem. I have no idea how to
really fix it. Also getting rid of the hook command:
self.HookCommand(self.OnBrowse, win32ui.IDC_BUTTON2)
Which would disable the browse button completely also
fixes the problem.

My system is Windows XP Service Pack 2, with 2 gb ram.


  • Mark Hammond
    Mark Hammond

    Logged In: YES

    I'm afraid I can't repro this and have never had anything
    similar reported. Can you try on another machine?

  • Roger Upole
    Roger Upole

    Logged In: YES
    Originator: NO

    I can't reproduce this either.
    Please reopen if you still see this problem

  • Roger Upole
    Roger Upole

    • status: open --> closed-works-for-me