whatsapp-framework icon indicating copy to clipboard operation
whatsapp-framework copied to clipboard

image_send not working

Open admill1519 opened this issue 6 years ago • 11 comments

I am not able to send images using this framework. I am not getting any error.

admill1519 avatar Feb 20 '18 12:02 admill1519

please post the code you're using

saade avatar Feb 20 '18 13:02 saade

@signals.initialized.connect def send_image(message): mac.send_image_to("D:/test.png","91XXXXXXXXXX")

Is there any library or module that I need to install to work with media.

admill1519 avatar Feb 21 '18 04:02 admill1519

if i'm not wrong, you need PIL for images and ffmpeg-next for videos, but if you not getting any erros, i'm quite sure thats not the problem.

also, you can try putting your image inside a folder inside your script folder, and use:

import os

@signals.initialized.connect
def send_image(message):
mac.send_image_to( os.getcwd() + "app/assets/test.png", "91XXXXXXXXXX")

saade avatar Feb 21 '18 14:02 saade

Still, it's not working. I guess it's not a path issue because when I put the wrong path it says "image does not exist". I am using ffmpeg-python (0.1.10) and Pillow (5.0.0). What do you think what is the problem?

admill1519 avatar Feb 22 '18 05:02 admill1519

You already answered that, "image does not exist" is the problem. Put your image inside app\assets\images\YOUR_IMAGE folder

app\
    assets\
        images\
            YOUR_IMAGE.PNG

then:

mac.send_image_to( "app/assets/YOUR_IMAGE.PNG", "91XXXXXXXXXX")

saade avatar Feb 22 '18 13:02 saade

AttributeError: 'ImageDownloadableMediaMessageProtocolEntity' object has no attr ibute 'getMediaKey'

admill1519 avatar Feb 23 '18 05:02 admill1519

Well, this can be much deep in code that i understand, maybe @danielcardeenas or @tgalal can help you.

saade avatar Feb 23 '18 13:02 saade

Same or similar issue here. I am also not able to send any image. Sometimes get that same error you posted... but i am not sure if that is really related.

Also tried to use the pokemon code and it is also failing to send.

It seems we have a real bug.

lnelias avatar Feb 24 '18 00:02 lnelias

debug info attached debug.log

The "no attribute 'getMediaKey'" error only happens when the bot receives an image. So this might be a different issue.

File "/home/leo/bot/whatsapp-framework/app/models/message.py", line 24, in build self.build_media_message() File "/home/leo/bot/whatsapp-framework/app/models/message.py", line 42, in build_media_message self.file_path = downloader.get_file(self.message_entity) File "/home/leo/bot/whatsapp-framework/app/utils/downloader.py", line 13, in get_file out_file = decrypt_file(message_entity, enc_path) File "/home/leo/bot/whatsapp-framework/app/utils/downloader.py", line 36, in decrypt_file key = message_entity.getMediaKey() AttributeError: 'ImageDownloadableMediaMessageProtocolEntity' object has no attribute 'getMediaKey'

lnelias avatar Feb 24 '18 12:02 lnelias

anyone ? :(

lnelias avatar Feb 27 '18 21:02 lnelias

Same errors i have not errors but images not send. @danielcardeenas we need help

gildastema avatar Jul 20 '18 11:07 gildastema