Skip to content

Get "[Errno 22] Invalid argument" when extracting attachment with spaces? #1

@aaykut

Description

@aaykut

Hello, eml-extractor fails while trying to extract an attachment with spaces (or some special characters I cannot see):

C:\Users\test\Downloads>eml-extractor
PROCESSING FILE "C:\Users\test\Downloads\NEW PO.eml"
>> Attachment found: NEW POs _ 234, 233, 232, 231 and 230 for Feb       2022.gz
Traceback (most recent call last):
  File "c:\users\test\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\test\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\test\AppData\Local\Programs\Python\Python39\Scripts\eml-extractor.exe\__main__.py", line 7, in <module>
  File "c:\users\test\appdata\local\programs\python\python39\lib\site-packages\eml_extractor.py", line 101, in main
    extract_attachments(file, destination=args.destination)
  File "c:\users\test\appdata\local\programs\python\python39\lib\site-packages\eml_extractor.py", line 29, in extract_attachments
    save_attachment(filepath, payload)
  File "c:\users\test\appdata\local\programs\python\python39\lib\site-packages\eml_extractor.py", line 36, in save_attachment
    with file.open('wb') as f:
  File "c:\users\test\appdata\local\programs\python\python39\lib\pathlib.py", line 1242, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "c:\users\test\appdata\local\programs\python\python39\lib\pathlib.py", line 1110, in _opener
    return self._accessor.open(self, flags, mode)
OSError: [Errno 22] Invalid argument: 'C:\\Users\\test\\Downloads\\NEW PO\\NEW POs _ 234, 233, 232, 231 and 230 for Feb\t2022.gz'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions