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

638c638
<         if fname == "" :
---
>         if fname == "" or fname == ():

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to