GithubHelp home page GithubHelp logo

Comments (6)

virusbcn avatar virusbcn commented on June 9, 2024

Sorry, I don't know if more data is needed, if it has not been possible to look at it or if the project is simply abandoned, I would like to ask for some kind of answer please.

from attachment-downloader.

jamesridgway avatar jamesridgway commented on June 9, 2024

The error in the logs suggests the download folder doesn't exist, or there are permission issues that mean that the script can't write to it

I did note you use the argument --output d:\Factu2 but the logs show d:\\Fact u2\\. Not sure where the additional space is coming from?

I wrote this script years ago to solve a problem I had at the time. I no longer have an ongoing need for this, so I can't justify spending my time on issues that aren't easy to reporduce. I do however welcome pull requests from anyone who wants to submit features or bug fixes

from attachment-downloader.

virusbcn avatar virusbcn commented on June 9, 2024

First of all thank you and thank you, thank you for answering and thank you for this script and merry christmas.

From James to James, the d:\factu2 folder exists and has the permissions, the bug is random, there are emails that it processes and moves attachments to this folder and others that it does not. The script works under Windows, in the paths that I can control I do not use any strange characters (spaces, ! , ñ, etc.. ) but in the mails that come in and attachments I can not control this, I suspect that the failure comes from there, but I do not know what I can do in the script so that it does not fail in these mails.

I copy and paste the output of the script that I am running now, in the last week it has processed 60 mails correctly and 60 I have had to set aside because it could not process it, it gave error, curiously setting aside these mails to another folder the system works again, it is as if some of them "stuck" it.

I will give you an output of the error that occurs with these 60 emails that I have set aside because it does not process them, I can not see anything abnormal.

Output with several e-mails, including one that does get processed.

c:\Users\Administrador.EMPRESA\AppData\Local\Programs\Python\Python39\Scripts>p
y ./attachment-downloader --host 192.168.x.x --username facturas --password Tei
password --imap-folder Inbox --output "d:\facturas" --unsecure --date-after="2
021-12-01T01:00:00" --delete --delete-copy-folder Inbox/Procesado
2021-12-22 12:22:32,759 - INFO - Logging in to: '192.168.x.x' as 'facturas'
2021-12-22 12:22:33,306 - INFO - Connected to IMAP Server with user facturas on
192.168.x.x
2021-12-22 12:22:33,308 - INFO - Listing messages matching the following criteri
a: folder=Inbox, date__gt=2021-12-01
2021-12-22 12:22:33,315 - INFO - Fetch list of messages from folder 'Inbox'
2021-12-22 12:22:33,361 - INFO - Downloaded and parsed mail 'Facturas Enviadas p
or E-Mail Empresa: Sentry Cia. Espec. Control y Serv. S.L.
 Factura: 22847 Fecha: 30/11/2021' with 0 attachments
2021-12-22 12:22:33,365 - INFO - Processing message 'b'30284'' subject 'Facturas
 Enviadas por E-Mail Empresa: Sentry Cia. Espec. Control y Serv. S.L.
 Factura: 22847 Fecha: 30/11/2021'
2021-12-22 12:22:33,423 - INFO - Downloaded and parsed mail 'C/ DE VI1, 1
11-113  002808   ' with 1 attachments
2021-12-22 12:22:33,425 - INFO - Processing message 'b'30285'' subject 'C/ DE VI
1, 111-113  002808   '
2021-12-22 12:22:33,427 - INFO - Downloading attachment '' to path d:\facturas\
2021-12-22 12:22:33,428 - ERROR - [Errno 2] No such file or directory: 'd:\\fact
uras\\'
Traceback (most recent call last):
  File "c:\Users\Administrador.EMPRESA\AppData\Local\Programs\Python\Python39\S
cripts\attachment-downloader", line 182, in <module>
    with open(download_path, "wb") as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'd:\\facturas\\'
2021-12-22 12:22:33,432 - ERROR - Error saving file. Continuing...
2021-12-22 12:22:33,570 - INFO - Downloaded and parsed mail 'Parte Ascensors Sal
es Dast, S.L.' with 1 attachments
2021-12-22 12:22:33,572 - INFO - Processing message 'b'30286'' subject 'Parte As
censors Sales Dast, S.L.'
2021-12-22 12:22:33,574 - INFO - Downloading attachment '' to path d:\facturas\
2021-12-22 12:22:33,575 - ERROR - [Errno 2] No such file or directory: 'd:\\fact
uras\\'
Traceback (most recent call last):
  File "c:\Users\Administrador.EMPRESA\AppData\Local\Programs\Python\Python39\S
cripts\attachment-downloader", line 182, in <module>
    with open(download_path, "wb") as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'd:\\facturas\\'
2021-12-22 12:22:33,578 - ERROR - Error saving file. Continuing...
Traceback (most recent call last):
  File "c:\Users\Administrador.EMPRESA\AppData\Local\Programs\Python\Python39\S
cripts\attachment-downloader", line 140, in <module>
    for (uid, message) in messages:
  File "c:\users\administrador.EMPRESA\appdata\local\programs\python\python39\l
ib\site-packages\imbox\messages.py", line 55, in _fetch_email_list
    yield uid, self._fetch_email(uid)
  File "c:\users\administrador.EMPRESA\appdata\local\programs\python\python39\l
ib\site-packages\imbox\messages.py", line 42, in _fetch_email
    return fetch_email_by_uid(uid=uid,
  File "c:\users\administrador.EMPRESA\appdata\local\programs\python\python39\l
ib\site-packages\imbox\parser.py", line 155, in fetch_email_by_uid
    email_object = parse_email(raw_email, policy=parser_policy)
  File "c:\users\administrador.EMPRESA\appdata\local\programs\python\python39\l
ib\site-packages\imbox\parser.py", line 212, in parse_email
    attachment = parse_attachment(part)
  File "c:\users\administrador.EMPRESA\appdata\local\programs\python\python39\l
ib\site-packages\imbox\parser.py", line 122, in parse_attachment
    filename_parts.insert(int(s_name[1]),value[1:-1] if value.startswith('"') el
se value)
ValueError: invalid literal for int() with base 10: ''
c:\Users\Administrador.EMPRESA\AppData\Local\Programs\Python\Python39\Scripts>

leaving only the mail that works

c:\Users\Administrador.EMPRESA\AppData\Local\Programs\Python\Python39\Scripts>p
y ./attachment-downloader --host 192.168.x.x --username facturas --password Tei
password --imap-folder Inbox --output "d:\facturas" --unsecure --date-after="2
021-12-01T01:00:00" --delete --delete-copy-folder Inbox/Procesado
2021-12-22 12:23:39,191 - INFO - Logging in to: '192.168.x.x' as 'facturas'
2021-12-22 12:23:39,342 - INFO - Connected to IMAP Server with user facturas on
192.168.x.x
2021-12-22 12:23:39,344 - INFO - Listing messages matching the following criteri
a: folder=Inbox, date__gt=2021-12-01
2021-12-22 12:23:39,351 - INFO - Fetch list of messages from folder 'Inbox'
2021-12-22 12:23:39,399 - INFO - Downloaded and parsed mail 'RV: DEV SUMINISTRES
 22-12-2021' with 4 attachments
2021-12-22 12:23:39,401 - INFO - Processing message 'b'30294'' subject 'RV: DEV
SUMINISTRES 22-12-2021'
2021-12-22 12:23:39,403 - INFO - Downloading attachment '1C22D001.S9D_DT (3).pdf
' to path d:\facturas\1C22D001.S9D_DT (3).pdf
2021-12-22 12:23:39,405 - INFO - Copy UID 30294 to "Inbox/Procesado" folder
2021-12-22 12:23:39,434 - INFO - Mark UID 30294 with \Deleted FLAG and expunge.
2021-12-22 12:23:39,479 - INFO - Downloading attachment '1C22D001.S9D_DT (2).pdf
' to path d:\facturas\1C22D001.S9D_DT (2).pdf
2021-12-22 12:23:39,481 - INFO - Copy UID 30294 to "Inbox/Procesado" folder
2021-12-22 12:23:39,493 - INFO - Mark UID 30294 with \Deleted FLAG and expunge.
2021-12-22 12:23:39,515 - INFO - Downloading attachment '1C22D001.S9D_DT (1).pdf
' to path d:\facturas\1C22D001.S9D_DT (1).pdf
2021-12-22 12:23:39,517 - INFO - Copy UID 30294 to "Inbox/Procesado" folder
2021-12-22 12:23:39,523 - INFO - Mark UID 30294 with \Deleted FLAG and expunge.
2021-12-22 12:23:39,545 - INFO - Downloading attachment '1C22D001.S9D_DT.pdf' to
 path d:\facturas\1C22D001.S9D_DT.pdf
2021-12-22 12:23:39,547 - INFO - Copy UID 30294 to "Inbox/Procesado" folder
2021-12-22 12:23:39,553 - INFO - Mark UID 30294 with \Deleted FLAG and expunge.
2021-12-22 12:23:39,575 - INFO - Finished processing messages
2021-12-22 12:23:39,576 - INFO - Logging out of: 192.168.x.x

Maybe Windows, python and paths are not welcome ???

thank you

from attachment-downloader.

jamesridgway avatar jamesridgway commented on June 9, 2024

I think this part of the log is quite telling:

2021-12-22 12:22:33,425 - INFO - Processing message 'b'30285'' subject 'C/ DE VI
1, 111-113  002808   '
2021-12-22 12:22:33,427 - INFO - Downloading attachment '' to path d:\facturas\

What attachments does that email have? What are they called? For some reason it looks like the imbox library isn't able to pull back the filename?

from attachment-downloader.

virusbcn avatar virusbcn commented on June 9, 2024

sorry James, I didn't see your answer (my name is Jaime too, James in Spanish).

Well yes, it seems to have something to do with the name of the attachments, mysteriously some get through and others don't.

Right now I have a lot of stopped emails again, in the end what I have to do is to remove emails until it "hooks" and downloads them, but I can't find any relation other than that the attachments come with spaces, strange characters, etc... but some go through and others don't... ¿??

I don't know if I can or you can send me a private to talk to you.

from attachment-downloader.

github-actions avatar github-actions commented on June 9, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

from attachment-downloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.