agermanidis / SnapchatBot

[deprecated] Python library for building bots that live on Snapchat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IOError: File not open for writing

csu opened this issue · 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

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

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

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

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

thanks @krissrex first use GitHub reply message,thanks

use use