SnapchatBot icon indicating copy to clipboard operation
SnapchatBot copied to clipboard

IOError: File not open for writing

Open csu opened this issue 9 years ago • 6 comments

[2015-03-22 22:22:51,092] "POST /bq/blob HTTP/1.1" 200 1620640
Traceback (most recent call last):
  File "csebot.py", line 34, in <module>
    bot.listen(timeout=60)
  File "build/bdist.macosx-10.10-intel/egg/snapchat_bots/bot.py", line 62, in listen
  File "build/bdist.macosx-10.10-intel/egg/snapchat_bots/bot.py", line 172, in get_snaps
  File "build/bdist.macosx-10.10-intel/egg/snapchat_bots/bot.py", line 146, in process_snaps
  File "build/bdist.macosx-10.10-intel/egg/snapchat_bots/bot.py", line 53, in process_snap
  File "build/bdist.macosx-10.10-intel/egg/snapchat_bots/snap.py", line 93, in __init__
IOError: File not open for writing

csu avatar Mar 23 '15 05:03 csu

I have the same problem, and I've noticed that this only happens if the bot receives a videosnap from certain phones.

My Error:

Traceback (most recent call last):
  File "storifierbot.py", line 25, in <module>
    bot.listen(timeout=600)
  File "/usr/local/lib/python2.7/dist-packages/snapchat_bots-0.1-py2.7.egg/snapchat_bots/bot.py", line 62, in listen
    snaps = self.get_snaps()
  File "/usr/local/lib/python2.7/dist-packages/snapchat_bots-0.1-py2.7.egg/snapchat_bots/bot.py", line 172, in get_snaps
    return self.process_snaps(snaps)                
  File "/usr/local/lib/python2.7/dist-packages/snapchat_bots-0.1-py2.7.egg/snapchat_bots/bot.py", line 146, in process_snaps
    snap = self.process_snap(snap_obj, data)
  File "/usr/local/lib/python2.7/dist-packages/snapchat_bots-0.1-py2.7.egg/snapchat_bots/bot.py", line 53, in process_snap
    is_story=is_story)
  File "/usr/local/lib/python2.7/dist-packages/snapchat_bots-0.1-py2.7.egg/snapchat_bots/snap.py", line 93, in __init__
    self.file.write(data)
IOError: File not open for writing

jfremstad avatar Mar 23 '15 08:03 jfremstad

I get the same error with certain videosnaps, is there anyway to disable all videosnaps? So only photosnaps are used?

jcherrera avatar Mar 24 '15 22:03 jcherrera

I guess it is because line 86 in snap.py should use rb+ instead of rb.

                self.file = open(video_filename, 'rb+')

krissrex avatar Mar 25 '15 15:03 krissrex

Thanks @krissrex!

csu avatar Mar 25 '15 19:03 csu

thanks @krissrex first use GitHub reply message,thanks

stamplong avatar Jun 28 '17 09:06 stamplong

use use

stamplong avatar Jun 28 '17 09:06 stamplong