fbchat
fbchat copied to clipboard
IOError: [Errno 36] File name too long: '/9j/4AAQSkZJRgABAQ....'
I am using fbchat for odoo module to send text message and local images, the sendMessage function works fine, but the function sendLocalImage gives IOError.
this is my xml code:
< field name="image" nolabel="1" placeholder="Attach an image" widget="image" attachment=True/>
this is my python code:
image = feilds.Binary()
the sendLocalImage function:
@api.multi
def messenger_conf(self,e,p,fn,m,i):
username =e
client = fbchat.Client(username,p)
#no_of_friends = self.number_of_friend
for friend in fn:
name = friend.name
friends = client.searchForUsers(name)
friend =friends[0]
sent = client.sendMessage(m, friend.uid)
send = client.sendLocalImage(i, friend.uid)
if sent:
print("Message sent successfully!")
Traceback
2020-06-11 23:07:40,550 30410 ERROR socialsuite openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/Abdullah/Abdullah-server/openerp/http.py", line 659, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/Abdullah/Abdullah-server/openerp/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/Abdullah/Abdullah-server/openerp/http.py", line 332, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/Abdullah/Abdullah-server/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/Abdullah/Abdullah-server/openerp/http.py", line 325, in checked_call
result = self.endpoint(*a, **kw)
File "/Abdullah/Abdullah-server/openerp/http.py", line 975, in __call__
return self.method(*args, **kw)
File "/Abdullah/Abdullah-server/openerp/http.py", line 525, in response_wrap
response = f(*args, **kw)
File "/Abdullah/Abdullah-server/addons/web/controllers/main.py", line 901, in call_button
action = self._call_kw(model, method, args, {})
File "/Abdullah/Abdullah-server/addons/web/controllers/main.py", line 889, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/Abdullah/Abdullah-server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/Abdullah/Abdullah-server/openerp/api.py", line 381, in old_api
result = method(recs, *args, **kwargs)
File "/Abdullah/Abdullah-server/addons/messages/message.py", line 276, in twitter_facebook_messenger_whatsapp
conf_obj.messenger_conf(crec3.email,crec3.password,crec3.friendsName,self.messages, self.image)
File "/Abdullah/Abdullah-server/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/Abdullah/Abdullah-server/addons/messages/message.py", line 42, in messenger_conf
sent2 = client.sendLocalImage(i, friend.uid)
File "/usr/local/lib/python2.7/dist-packages/fbchat/_client.py", line 1376, in sendLocalImage
thread_type=thread_type,
File "/usr/local/lib/python2.7/dist-packages/fbchat/_client.py", line 1284, in sendLocalFiles
with get_files_from_paths(file_paths) as x:
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/local/lib/python2.7/dist-packages/fbchat/_util.py", line 251, in get_files_from_paths
(basename(filename), open(filename, "rb"), guess_type(filename)[0])
IOError: [Errno 36] File name too long: '/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAk