We need to handle errors related to image resizing and any file IO operations. An example of an error when trying to resize a profile picture
raceback (most recent call last):
File "/home/deploy/apps/whatsapp/venv/bin/ongair-cli", line 18, in <module>
main(sys.argv[1:])
File "/home/deploy/apps/whatsapp/venv/bin/ongair-cli", line 14, in main
client.loop()
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/ongair/client.py", line 47, in loop
stack.loop(timeout=5, discrete=0.5) # this is the program mainloop
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/stacks/yowstack.py", line 187, in loop
asyncore.loop(*args, **kwargs)
File "/usr/lib/python2.7/asyncore.py", line 216, in loop
poll_fun(timeout, map)
File "/usr/lib/python2.7/asyncore.py", line 156, in poll
read(obj)
File "/usr/lib/python2.7/asyncore.py", line 87, in read
obj.handle_error()
File "/usr/lib/python2.7/asyncore.py", line 83, in read
obj.handle_read_event()
File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
self.handle_read()
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 86, in handle_read
self.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/network/layer.py", line 94, in receive
self.toUpper(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 28, in receive
self.processReceived()
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 51, in processReceived
self.processReceived()
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 51, in processReceived
self.processReceived()
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/stanzaregulator/layer.py", line 48, in processReceived
self.toUpper(oneMessageData)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_crypt.py", line 63, in receive
self.toUpper(payload)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/coder/layer.py", line 35, in receive
self.toUpper(node)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/logger/layer.py", line 14, in receive
self.toUpper(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/axolotl/layer.py", line 126, in receive
self.toUpper(protocolTreeNode)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 169, in receive
s.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 105, in receive
recv(node)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/auth/layer_authentication.py", line 71, in handleSuccess
self.toUpper(nodeEntity)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/__init__.py", line 59, in toUpper
self.__upper.receive(data)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/yowsup/layers/interface/interface.py", line 98, in receive
self.callbacks[entityType](entity)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/ongair/ongair.py", line 40, in onSuccess
self.work()
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/ongair/ongair.py", line 196, in work
self.setProfilePicture(job)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/ongair/ongair.py", line 258, in setProfilePicture
pictureData = src.resize((640, 640)).tobytes("jpeg", "RGB")
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 668, in tobytes
e = _getencoder(self.mode, encoder_name, args)
File "/home/deploy/apps/whatsapp/venv/local/lib/python2.7/site-packages/PIL/Image.py", line 430, in _getencoder
return encoder(mode, *args + extra)
SystemError: unknown raw mode
We need to handle errors related to image resizing and any file IO operations. An example of an error when trying to resize a profile picture