This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkinter.filedialog.askdirectory() crashing before dialog opens when importing pywinauto
Type: crash Stage: resolved
Components: Tkinter Versions: Python 3.6
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: gpolo, rsteel1, serhiy.storchaka, taleinat, terry.reedy
Priority: normal Keywords:

Created on 2018-07-03 09:20 by rsteel1, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
minimal_file.py rsteel1, 2018-07-03 09:56
Messages (5)
msg320949 - (view) Author: Ryan (rsteel1) * Date: 2018-07-03 09:20
I'm creating a GUI application that needs to give the user the option to change a folder that's used for saving data.

I managed to track it down to the import of pywinauto to the application. All other filedialogs seem to work, it's only askdirectory that's having issues.

I've attached a small file that shows the crash - if you comment out the pywinauto import, no crash occurs.
msg320963 - (view) Author: Ryan (rsteel1) * Date: 2018-07-03 11:23
It seems reinstalling pywinauto has fixed this issue for now - I have no idea what could have caused it in the first place though.
msg320982 - (view) Author: Ryan (rsteel1) * Date: 2018-07-03 13:28
Okay so I'm an idiot and forgot that I'd commented out the pywinauto import in one of my project files, which is how I found out that was the issue in the first place. 

Crash is still occurring after a pywinauto reinstall.
msg321079 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-07-05 06:13
Confirmed with Python 3.6.3 on Windows 10 64-bit: It hangs showing an empty window.

Debugging a bit, the hang happens in Lib/tkinter/commondialog.py, line 43:

s = w.tk.call(self.command, *w._options(self.options)) 

The value of self.command is 'tk_chooseDirectory', and w._options(self.options) just gives an empty tuple, so the actual call is:

s = w.tk.call('tk_chooseDirectory', ())

This means that the hang is within w.tk.call().

I'd follow this up with the pywinauto devs. To me this doesn't seem like something wrong with the tkinter module.
msg321198 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-07 01:51
Ryan: this tracker only covers issues with the PSF CPython distribution.  Problems with 3rd party modules like pywinauto are not our responsibility until someone determines that its misbehavior reflects a CPython bug.
History
Date User Action Args
2022-04-11 14:59:02adminsetgithub: 78210
2018-07-07 01:51:45terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg321198

resolution: third party
2018-07-05 06:13:03taleinatsetnosy: + taleinat
messages: + msg321079
2018-07-03 13:28:00rsteel1setstatus: closed -> open

messages: + msg320982
2018-07-03 11:23:54rsteel1setstatus: open -> closed

messages: + msg320963
stage: resolved
2018-07-03 09:56:05rsteel1setfiles: + minimal_file.py
2018-07-03 09:21:41rsteel1settitle: tkinter.filedialog.askdirectory() crashing before dialog opens -> tkinter.filedialog.askdirectory() crashing before dialog opens when importing pywinauto
2018-07-03 09:20:43rsteel1setnosy: + serhiy.storchaka
2018-07-03 09:20:25rsteel1create