{"action":"created","issue":{"url":"https://api.github.com/repos/tqdm/tqdm/issues/202","repository_url":"https://api.github.com/repos/tqdm/tqdm","labels_url":"https://api.github.com/repos/tqdm/tqdm/issues/202/labels{/name}","comments_url":"https://api.github.com/repos/tqdm/tqdm/issues/202/comments","events_url":"https://api.github.com/repos/tqdm/tqdm/issues/202/events","html_url":"https://github.com/tqdm/tqdm/issues/202","id":166685594,"number":202,"title":"I/O operation on closed file bug","user":{"login":"pauljherrera","id":17938135,"avatar_url":"https://avatars.githubusercontent.com/u/17938135?v=3","gravatar_id":"","url":"https://api.github.com/users/pauljherrera","html_url":"https://github.com/pauljherrera","followers_url":"https://api.github.com/users/pauljherrera/followers","following_url":"https://api.github.com/users/pauljherrera/following{/other_user}","gists_url":"https://api.github.com/users/pauljherrera/gists{/gist_id}","starred_url":"https://api.github.com/users/pauljherrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauljherrera/subscriptions","organizations_url":"https://api.github.com/users/pauljherrera/orgs","repos_url":"https://api.github.com/users/pauljherrera/repos","events_url":"https://api.github.com/users/pauljherrera/events{/privacy}","received_events_url":"https://api.github.com/users/pauljherrera/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tqdm/tqdm/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-07-20T21:23:43Z","updated_at":"2016-07-23T14:39:33Z","closed_at":null,"body":"Eighty percent of the time I use tqdm it works perfectly. The other 20%  I get 'I/O operation on closed file'.\r\n\r\nThe weird thing about it is that I can use tqdm in the same script two times. The first time it doesn't work. The second time, without changing anything , it works.\r\n\r\nI paste below the complete traceback:\r\n\r\n```\r\nFile \"<ipython-input-160-51605e3202c6>\", line 1, in <module>\r\n    runfile('C:/Users/forex/Documents/Knoxpy simple/Avanti_Analyzer.py', wdir='C:/Users/forex/Documents/Knoxpy simple')\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\spyderlib\\widgets\\externalshell\\sitecustomize.py\", line 699, in runfile\r\n    execfile(filename, namespace)\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\spyderlib\\widgets\\externalshell\\sitecustomize.py\", line 74, in execfile\r\n    exec(compile(scripttext, filename, 'exec'), glob, loc)\r\n\r\n  File \"C:/Users/forex/Documents/Knoxpy simple/Avanti_Analyzer.py\", line 1114, in <module>\r\n    barsperday, commission, swap, join, verbose = True)\r\n\r\n  File \"C:/Users/forex/Documents/Knoxpy simple/Avanti_Analyzer.py\", line 1022, in w_eventstudy\r\n    df = overlaps(df, overlapperiod, signal, trigger)\r\n\r\n  File \"C:/Users/forex/Documents/Knoxpy simple/Avanti_Analyzer.py\", line 438, in overlaps\r\n    for i in tqdm(xrange(overlapperiod - 1, len(x1))):\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\tqdm\\_tqdm.py\", line 622, in __iter__\r\n    else ncols),\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\tqdm\\_tqdm.py\", line 98, in print_status\r\n    fp_write('\\r' + s + (' ' * max(last_len[0] - len_s, 0)))\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\tqdm\\_tqdm.py\", line 92, in fp_write\r\n    fp_flush()\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\colorama\\ansitowin32.py\", line 40, in write\r\n    self.__convertor.write(text)\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\colorama\\ansitowin32.py\", line 141, in write\r\n    self.write_and_convert(text)\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\colorama\\ansitowin32.py\", line 169, in write_and_convert\r\n    self.write_plain_text(text, cursor, len(text))\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\colorama\\ansitowin32.py\", line 174, in write_plain_text\r\n    self.wrapped.write(text[start:end])\r\n\r\n  File \"C:\\Anaconda2\\lib\\site-packages\\ipykernel\\iostream.py\", line 317, in write\r\n    self._buffer.write(string)\r\n\r\nValueError: I/O operation on closed file\r\n```"},"comment":{"url":"https://api.github.com/repos/tqdm/tqdm/issues/comments/234721579","html_url":"https://github.com/tqdm/tqdm/issues/202#issuecomment-234721579","issue_url":"https://api.github.com/repos/tqdm/tqdm/issues/202","id":234721579,"user":{"login":"jveitchmichaelis","id":3159591,"avatar_url":"https://avatars.githubusercontent.com/u/3159591?v=3","gravatar_id":"","url":"https://api.github.com/users/jveitchmichaelis","html_url":"https://github.com/jveitchmichaelis","followers_url":"https://api.github.com/users/jveitchmichaelis/followers","following_url":"https://api.github.com/users/jveitchmichaelis/following{/other_user}","gists_url":"https://api.github.com/users/jveitchmichaelis/gists{/gist_id}","starred_url":"https://api.github.com/users/jveitchmichaelis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jveitchmichaelis/subscriptions","organizations_url":"https://api.github.com/users/jveitchmichaelis/orgs","repos_url":"https://api.github.com/users/jveitchmichaelis/repos","events_url":"https://api.github.com/users/jveitchmichaelis/events{/privacy}","received_events_url":"https://api.github.com/users/jveitchmichaelis/received_events","type":"User","site_admin":false},"created_at":"2016-07-23T14:39:33Z","updated_at":"2016-07-23T14:39:33Z","body":"I'll try that, although I have around 30-40k images to process so it might take a while (I guess 1s was for demonstration rather than anything else). Typically this thing runs at around 40 iterations per second and there isn't a problem when `tqdm` isn't used.\r\n\r\nThere was a reason I read in both images in the same function, but I forget why (I think previously I was doing a joint operation on them as I read them in) :)"}}
{"actor":{"display_login":"jveitchmichaelis"}}