TKinter filedialog.askdirectory fails on Mac OS X in Spyder

I haven’t been able to find anything recent on this issue (I.e. since ~2021), which makes me think it was solved but somehow I missed it.

I am trying to call filedialog.askdirectory() (with filedialog imported from tkinter) within the Spyder IDE on Mac OS X (Ventura 13.6).

This worked fine on my Windows machine, but now crashes python anytime I try to run the code that has this call in it. I have tried creating different environments with different versions of Python (specifically Python 3.9.18 and 3.10.13, which are the only lower versions than 3.11.4 available on Anaconda Navigator), and they all behave the same.

A screenshot of the failure is below.

It sounds like you’re having this issue:

The suggested solution is to go to Preferences → IPython Console → Graphics and set “Backend” to “Inline”.

Good luck!

Oh, great advice. Thank you.

Confirmed that setting the backend graphics utility to “inline” that the Kernel no longer crashes.

Interestingly, I changed the backend to “Tkinter” after this and it worked exactly ONCE, and then started crashing the Kernel again.

Carlos’s comment on the thread you linked noted that the issues with TKinter were supposed to be resolved within a week, and his post was dated January 2022.

I’m wondering if there’s either still an issue here I haven’t resolved? It would be really really nice not to have to use inline graphics.