caronc/apprise

Could not access attachment file (Windows issue ?)

pokemaster974 opened this issue ยท 1 comments

๐Ÿ“ฃ Notification Service(s) Impacted
All

๐Ÿž Describe the bug
When I try to add an attachment file, Apprise can't send it because it searches to another location after formatting the path.

import apprise
import logging

logging.basicConfig(level=logging.DEBUG)
apobj = apprise.Apprise()

apobj.add('discord://xxx')

apobj.notify(
    body='what a great notification service!',
    title='my notification title',
    attach='D:\placeholder.png',
)

Same result if I try to attach file via

attach = apprise.AppriseAttachment()
attach.add('D:\placeholder.png',)

Also tried with CLI and resulting in same ERROR with same formatted path.

Attaching a link like https://i.redd.it/my2t4d2fx0u31.jpg?name=FlyingToMars.jpg works.

DEBUG:apprise:Posting Discord attachment https://i.redd.it/my2t4d2fx0u31.jpg?rto=4.0&cto=4.0&verify=yes&cache=yes&name=flyingtomars.jpg
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): discord.com:443
DEBUG:urllib3.connectionpool:https://discord.com:443 "POST /api/webhooks/xxx HTTP/1.1" 200 None
INFO:apprise:Sent Discord attachment.

๐Ÿ’ก Screenshots and Logs

DEBUG:apprise:Notification Plugin 103(s) and 147 Schema(s) loaded in 0.2800s
DEBUG:apprise:Loaded Discord URL: discord://xxx
DEBUG:apprise:Loading attachment: D:\placeholder.png
DEBUG:apprise:Attachment Plugin 2(s) and 3 Schema(s) loaded in 0.0010s
DEBUG:apprise:Discord POST URL: https://discord.com/api/webhooks/xxx (cert_verify=True)
DEBUG:apprise:Discord Payload: {'tts': False, 'wait': True, 'avatar_url': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png', 'username': 'xxx', 'content': 'my notification title\r\nwhat a great notification service!'}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): discord.com:443
DEBUG:urllib3.connectionpool:https://discord.com:443 "POST /api/webhooks/xxx HTTP/1.1" 204 0
INFO:apprise:Sent Discord notification.
INFO:apprise:Posting Discord Attachment None
DEBUG:apprise:Discord POST URL: https://discord.com/api/webhooks/xxx (cert_verify=True)
DEBUG:apprise:Discord Payload: {'tts': False, 'wait': True, 'avatar_url': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png', 'username': 'xxx'}
ERROR:apprise:Could not access attachment file://D%3A%5Cplaceholder.png.

๐Ÿ’ป Your System Details:

  • OS: Windows 10
  • Python Version: 3..11.9

๐Ÿ”ฎ Additional context
Add any other context about the problem here.

My bad, seems to work now. I don't know what was wrong.

INFO:apprise:Posting Discord Attachment placeholder.png
DEBUG:apprise:Discord POST URL: https://discord.com/api/webhooks/xxx(cert_verify=True)
DEBUG:apprise:Discord Payload: {'tts': False, 'wait': True, 'avatar_url': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png', 'username': 'xxx'}
DEBUG:apprise:Posting Discord attachment file://D%3A%5Cplaceholder.png
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): discord.com:443
DEBUG:urllib3.connectionpool:https://discord.com:443 "POST /api/webhooks/xxx HTTP/1.1" 200 None
INFO:apprise:Sent Discord attachment.