Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'output': 0.05; 'skip:" 60': 0.07; 'subject:Error': 0.07; 'tkinter': 0.07; '[],': 0.09; 'callback': 0.09; 'exception,': 0.09; 'listing,': 0.09; 'matplotlib': 0.09; 'pyplot': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.12; "'''": 0.16; '**kwargs)': 0.16; 'codec': 0.16; 'message-id:@post.gmane.org': 0.16; 'numpy': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'skip:" 70': 0.16; 'exception': 0.16; 'all,': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'byte': 0.24; 'file.': 0.24; 'handling': 0.26; 'skip:" 30': 0.26; 'skip:" 40': 0.26; 'header:X-Complaints-To:1': 0.27; 'raise': 0.29; 'lines': 0.31; '"",': 0.31; '13,': 0.31; 'produces': 0.31; 'file': 0.32; 'another': 0.32; '(most': 0.33; 'skip:_ 10': 0.34; 'problem': 0.35; 'subject:with': 0.35; 'basic': 0.35; "can't": 0.35; 'except': 0.35; 'problem.': 0.35; 'skip:s 30': 0.35; 'animation': 0.36; 'executing': 0.36; 'skip:" 50': 0.36; 'charset :us-ascii': 0.36; 'application': 0.37; 'two': 0.37; 'clear': 0.37; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'eye': 0.61; 'skip:* 10': 0.61; 'first': 0.61; 'save': 0.62; 'skip:n 10': 0.64; 'provide': 0.64; 'dear': 0.65; 'here': 0.66; '20,': 0.68; 'invalid': 0.68; 'skip:w 30': 0.69; 'saving': 0.69; 'skip:r 30': 0.69; 'received:117': 0.78 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Partha Pratim Ghosh Subject: Error with saving animation Date: Sat, 11 Oct 2014 04:55:19 +0000 (UTC) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 117.203.146.100 (Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.1.0) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 126 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1413003605 news.xs4all.nl 2847 [2001:888:2000:d::a6]:52343 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78978 Dear All, I am having a problem with saving the output of an animation as a file. I provide here two listing, first the small program which otherwise works well, except while executing the last few lines to save the output produces error which I also provide: 1. the program test.py : from matplotlib import animation as anim from matplotlib import pyplot as plt import numpy as np fig = plt.figure() plt.axis([-1,1,-1,1]) abcissa, = plt.plot([],[], color='black') graph, = plt.plot([], [], color='blue') t, = plt.plot([],[], color='red') def init(): ''' set the basic graph and put slate clean for blit''' x = np.arange(-1,1,0.01)# the x-values y = np.sin(np.pi/2 * x) abcissa.set_data(x, 0) graph.set_data(x, y) return abcissa, graph def animate(i): p = -1 + i*0.02 tx = [p-1,p+1] ty = [np.sin(np.pi/2 * p) - np.pi/2 * np.cos(np.pi/2 *p), np.sin(np.pi/2 * p) + np.pi/2 * np.cos(np.pi/2 *p)] t.set_data(tx, ty) return t, ani = anim.FuncAnimation(fig, animate, init_func=init, frames=100, interval=30, blit=True) plt.show() Writer = anim.writers['ffmpeg'] writer = Writer(fps=15, bitrate=1800) ani.save('test.mp4', writer=writer) 2. Error output ani.save('test.mp4', writer=writer) File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 719, in save writer.grab_frame(**savefig_kwargs) File "/usr/lib/python3/dist-packages/matplotlib/animation.py", line 205, in grab_frame dpi=self.dpi, **savefig_kwargs) File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1422, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/backend_bases.py", line 2225, in print_figure self.figure.dpi = origDPI File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 385, in _set_dpi self.dpi_scale_trans.clear().scale(dpi, dpi) File "/usr/lib/python3/dist-packages/matplotlib/transforms.py", line 1786, in clear self._mtx = np.identity(3) File "/usr/lib/python3/dist-packages/numpy/core/numeric.py", line 2053, in identity from numpy import eye File "", line 2280, in _handle_fromlist UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte ' Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python3.4/idlelib/run.py", line 121, in main seq, request = rpc.request_queue.get(block=True, timeout=0.05) File "/usr/lib/python3.4/queue.py", line 175, in get raise Empty queue.Empty During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/matplotlib/backends/tkagg.py", line 13, in blit tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array)) _tkinter.TclError: this isn't a Tk application During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.4/tkinter/__init__.py", line 1536, in __call__ return self.func(*args) File "/usr/lib/python3.4/tkinter/__init__.py", line 585, in callit func(*args) File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 363, in idle_draw self.draw() File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py", line 349, in draw tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) File "/usr/lib/python3/dist-packages/matplotlib/backends/tkagg.py", line 20, in blit tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array)) _tkinter.TclError: this isn't a Tk application Please can someone help me out of this problem. With my regards, partha