{"action":"created","issue":{"url":"https://api.github.com/repos/ioam/holoviews/issues/3151","repository_url":"https://api.github.com/repos/ioam/holoviews","labels_url":"https://api.github.com/repos/ioam/holoviews/issues/3151/labels{/name}","comments_url":"https://api.github.com/repos/ioam/holoviews/issues/3151/comments","events_url":"https://api.github.com/repos/ioam/holoviews/issues/3151/events","html_url":"https://github.com/ioam/holoviews/issues/3151","id":378171980,"node_id":"MDU6SXNzdWUzNzgxNzE5ODA=","number":3151,"title":"Rendering HoloMap as GIF with matplotlib/pillow fails under Windows","user":{"login":"smillies","id":8183111,"node_id":"MDQ6VXNlcjgxODMxMTE=","avatar_url":"https://avatars2.githubusercontent.com/u/8183111?v=4","gravatar_id":"","url":"https://api.github.com/users/smillies","html_url":"https://github.com/smillies","followers_url":"https://api.github.com/users/smillies/followers","following_url":"https://api.github.com/users/smillies/following{/other_user}","gists_url":"https://api.github.com/users/smillies/gists{/gist_id}","starred_url":"https://api.github.com/users/smillies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillies/subscriptions","organizations_url":"https://api.github.com/users/smillies/orgs","repos_url":"https://api.github.com/users/smillies/repos","events_url":"https://api.github.com/users/smillies/events{/privacy}","received_events_url":"https://api.github.com/users/smillies/received_events","type":"User","site_admin":false},"labels":[{"id":97850376,"node_id":"MDU6TGFiZWw5Nzg1MDM3Ng==","url":"https://api.github.com/repos/ioam/holoviews/labels/bug","name":"bug","color":"fc2929","default":true},{"id":230301496,"node_id":"MDU6TGFiZWwyMzAzMDE0OTY=","url":"https://api.github.com/repos/ioam/holoviews/labels/mpl","name":"mpl","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/ioam/holoviews/milestones/30","html_url":"https://github.com/ioam/holoviews/milestone/30","labels_url":"https://api.github.com/repos/ioam/holoviews/milestones/30/labels","id":3198839,"node_id":"MDk6TWlsZXN0b25lMzE5ODgzOQ==","number":30,"title":"v1.11.0","description":"","creator":{"login":"philippjfr","id":1550771,"node_id":"MDQ6VXNlcjE1NTA3NzE=","avatar_url":"https://avatars2.githubusercontent.com/u/1550771?v=4","gravatar_id":"","url":"https://api.github.com/users/philippjfr","html_url":"https://github.com/philippjfr","followers_url":"https://api.github.com/users/philippjfr/followers","following_url":"https://api.github.com/users/philippjfr/following{/other_user}","gists_url":"https://api.github.com/users/philippjfr/gists{/gist_id}","starred_url":"https://api.github.com/users/philippjfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philippjfr/subscriptions","organizations_url":"https://api.github.com/users/philippjfr/orgs","repos_url":"https://api.github.com/users/philippjfr/repos","events_url":"https://api.github.com/users/philippjfr/events{/privacy}","received_events_url":"https://api.github.com/users/philippjfr/received_events","type":"User","site_admin":false},"open_issues":86,"closed_issues":32,"state":"open","created_at":"2018-03-19T15:04:42Z","updated_at":"2018-11-07T19:18:27Z","due_on":"2018-10-31T07:00:00Z","closed_at":null},"comments":1,"created_at":"2018-11-07T07:33:08Z","updated_at":"2018-11-07T19:43:00Z","closed_at":null,"author_association":"NONE","body":"I am trying to create an animated gif image from a series of heat maps with HoloViews. I need to do this in a Python script, i. e. specifically not in a Jupyter notebook. I am using Python 3.7 under Windows 10.\r\n\r\nWhen saving the image, Python throws a PermissionError originating from PIL\\Image.py line 1966 while manipulating a temporary file. However, it doesn't seem like a user permission problem, as it happens also for users with unrestricted rights. At the point the exception happens, the temporary file has already been created on the file system.\r\n\r\nThe same code runs as expected under CentOS 7. Here's [an SSCE](https://gist.github.com/smillies/2575831ddfa5731b8d04d08d0f1bdad1)\r\n\r\nHere's [another minimal example](https://gist.github.com/ImportanceOfBeingErnest/f44d5137fa44fa9f5e1833bb022d3eee) by [ImportanceOfBeingErnest](https://stackoverflow.com/users/4124317/importanceofbeingernest) that removes holoviews from the picture by making a direct call to matplotlib's `FuncAnimation.save(\"fname\", writer=\"pillow\", fps=5)`. That works OK under Windows. So it looks like the holoviews save function might be broken.  \r\n\r\nImportanceOfBeingErnest also played around a bit in the source code of holoviews and it also fails to save via imagemagick or imagemagick_file. (Although fixing this part of the issue is probably not a priority in view of #2460) \r\n\r\nThe source of this issue is [this discussion](https://stackoverflow.com/questions/53163438/permissionerror-errno-13-permission-denied-when-saving-holomap-to-gif) on StackOverflow."},"comment":{"url":"https://api.github.com/repos/ioam/holoviews/issues/comments/436752455","html_url":"https://github.com/ioam/holoviews/issues/3151#issuecomment-436752455","issue_url":"https://api.github.com/repos/ioam/holoviews/issues/3151","id":436752455,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjc1MjQ1NQ==","user":{"login":"jbednar","id":1695496,"node_id":"MDQ6VXNlcjE2OTU0OTY=","avatar_url":"https://avatars0.githubusercontent.com/u/1695496?v=4","gravatar_id":"","url":"https://api.github.com/users/jbednar","html_url":"https://github.com/jbednar","followers_url":"https://api.github.com/users/jbednar/followers","following_url":"https://api.github.com/users/jbednar/following{/other_user}","gists_url":"https://api.github.com/users/jbednar/gists{/gist_id}","starred_url":"https://api.github.com/users/jbednar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbednar/subscriptions","organizations_url":"https://api.github.com/users/jbednar/orgs","repos_url":"https://api.github.com/users/jbednar/repos","events_url":"https://api.github.com/users/jbednar/events{/privacy}","received_events_url":"https://api.github.com/users/jbednar/received_events","type":"User","site_admin":false},"created_at":"2018-11-07T19:43:00Z","updated_at":"2018-11-07T19:43:00Z","author_association":"MEMBER","body":"I think the [hv code in question](https://github.com/ioam/holoviews/blob/master/holoviews/plotting/mpl/renderer.py#L234) is:\r\n\r\n```\r\nwith NamedTemporaryFile(suffix='.%s' % fmt) as f:\r\n                anim.save(f.name, writer=writer, **anim_kwargs)\r\n                video = f.read()\r\n```\r\n\r\nAccording to the [Python docs](https://docs.python.org/2/library/tempfile.html), NamedTemporaryFile has different behavior in Windows:\r\n\r\n> Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). \r\n\r\nI'm not sure what anim.save is in this case, but from that description, maybe @smillies could see if the file could be closed before anim.save and opened after for the reading step?  Otherwise it would seem that anim.save would need to be rewritten to take a file handle instead of a file name, and in that case it's hard to see what the point of NamedTemporaryFile is on Windows..."}}
{"actor":{"display_login":"jbednar"}}