You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling simpledialog to get user input, then later calling filedialog to save a text file, the python interpreter often crashes. Without both dialog boxes called, there is no crash.
Reproducible on macOS Sierra 14.4.1 Macbook Air M1
Could not reproduce on Windows
Python 3.12
ips crash report generated and available
fromtkinterimport*fromtkinterimportfiledialog, scrolledtext, simpledialog# BEGIN CODE THAT CAUSES CRASH ******# BEGIN CODE THAT CAUSES CRASH ******# BEGIN CODE THAT CAUSES CRASH ******# prompt for settingstime_out_seconds=simpledialog.askinteger(title="Title", prompt="Prompt")
# set defaults if dialogs are cancelledifnottime_out_seconds:
time_out_seconds=10# END CODE THAT CAUSES CRASH ********# END CODE THAT CAUSES CRASH ********# END CODE THAT CAUSES CRASH ********defsave_to_file():
""" Saves File """# CRASH OCCURS HERE ******# CRASH OCCURS HERE ******# CRASH OCCURS HERE ******# while it does crash without filetypes defined, it crashes more often when filetypes are defined.file_path=filedialog.asksaveasfilename(defaultextension=".txt",
filetypes=[("Text files", "*.txt"), ("All files", "*.*")])
iffile_path:
withopen(file_path, 'w') asfile:
text_content="Sample text document text"file.write(text_content)
# Window configwindow=Tk()
# User inputtext_box=scrolledtext.ScrolledText()
text_box.pack()
# Save Buttonsave_button=Button(window, text="Save", command=save_to_file)
save_button.pack()
window.mainloop()
CPython versions tested on:
3.12
Operating systems tested on:
macOS
Output from running 'python -VV' on the command line:
2024-04-07 20:30:19.525 Python[3024:88005] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES. Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)
The text was updated successfully, but these errors were encountered:
This crash has been fixed upstream for Tk 8.6.14, and the
fix is backported for inclusion in the Python 3.11.7 and 3.12.1 installers: #108693
Good catch. I was running python 3.12.0 which I thought was the latest release.
Just updated to 3.12.2 and that seems to have fixed the issue.
I'm new to using Python and this was the first time I encountered a bug that crashed the Python Interpreter or wasn't caused by my code.
I also did not realize there were bug fix releases that had not been installed on my machine.
Thank you and I think this can be closed.
Crash report
What happened?
When calling simpledialog to get user input, then later calling filedialog to save a text file, the python interpreter often crashes. Without both dialog boxes called, there is no crash.
Reproducible on macOS Sierra 14.4.1 Macbook Air M1
Could not reproduce on Windows
Python 3.12
ips crash report generated and available
CPython versions tested on:
3.12
Operating systems tested on:
macOS
Output from running 'python -VV' on the command line:
2024-04-07 20:30:19.525 Python[3024:88005] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES. Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)
The text was updated successfully, but these errors were encountered: