SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] Little fix in the TkAgg backend

From: Michael Z. <ze...@ph...> - 2007年11月14日 10:07:39
Hi,
whenever I clicked the "save"-button in a plot in my TkAgg and pressed 
"cancel" in the file dialog, I got the error message
Exception in Tkinter callback
Traceback (most recent call last):
 File "lib-tk/Tkinter.py", line 1406, in __call__
 return self.func(*args)
 File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_tkagg.py", 
line 641, in save_figure
 bname, fext = os.path.splitext(fname)
 File "posixpath.py", line 92, in splitext
 i = p.rfind('.')
AttributeError: 'tuple' object has no attribute 'rfind'
This obviously happened because tkFileDialog.asksaveasfilename returned 
an empty tupel rather than an empty string, when the user cancels the 
file dialog. I fixed it by replacing the line
if fname == "":
by
if fname == "" or fname == ():
in the file backend_tkagg.py.
Thank you,
Michael Zell

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /