Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b95eefb

Browse files
committed
fix savefig not to raise an error when file object is given
svn path=/trunk/matplotlib/; revision=7856
1 parent 3e5ae2d commit b95eefb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/figure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import artist
1717
from artist import Artist, allow_rasterization
1818
from axes import Axes, SubplotBase, subplot_class_factory
19-
from cbook import flatten, allequal, Stack, iterable
19+
from cbook import flatten, allequal, Stack, iterable, is_string_like
2020
import _image
2121
import colorbar as cbar
2222
from image import FigureImage
@@ -1038,7 +1038,7 @@ def savefig(self, *args, **kwargs):
10381038
kwargs[key] = rcParams['savefig.%s'%key]
10391039

10401040
extension = rcParams['savefig.extension']
1041-
if args and '.' not in args[0] and extension != 'auto':
1041+
if args and is_string_like(args[0]) and '.' not in args[0] and extension != 'auto':
10421042
fname = args[0] + '.' + extension
10431043
args = (fname,) + args[1:]
10441044

0 commit comments

Comments
 (0)