Invalid Argument Error When Using Special Characters in Output Filename #166

Closed
opened 11 months ago by Anangaya · 6 comments

I am encountering an error when trying to use img2pdf command with a special character in the output filename. Here is the command I ran:

D:Tempimages>img2pdf * -o "Umbrella ☂.pdf"

And this is the error message I received:

usage: img2pdf [-h] [-v] [-V] [--gui] [--from-file FILE] [-o out] [-C colorspace] [-D] [--engine engine]
               [--first-frame-only] [--pillow-limit-break] [--pdfa [PDFA]] [-S LxL] [-s LxL] [-b L[:L]] [-f FIT] [-a]
               [-r ROT] [--crop-border L[:L]] [--bleed-border L[:L]] [--trim-border L[:L]] [--art-border L[:L]]
               [--title title] [--author author] [--creator creator] [--producer producer]
               [--creationdate creationdate] [--moddate moddate] [--subject subject] [--keywords kw [kw ...]]
               [--viewer-panes PANES] [--viewer-initial-page NUM] [--viewer-magnification MAG]
               [--viewer-page-layout LAYOUT] [--viewer-fit-window] [--viewer-center-window] [--viewer-fullscreen]
               [infile ...]
img2pdf: error: argument -o/--output: can't open 'Mushroom ?.pdf': [Errno 22] Invalid argument: 'Mushroom ?.pdf'

It seems like the tool has issues with filenames that contain special characters. Any help resolving this would be appreciated.

I am encountering an error when trying to use `img2pdf` command with a special character in the output filename. Here is the command I ran: ```bash D:Tempimages>img2pdf * -o "Umbrella ☂.pdf" ``` And this is the error message I received: ```bash usage: img2pdf [-h] [-v] [-V] [--gui] [--from-file FILE] [-o out] [-C colorspace] [-D] [--engine engine] [--first-frame-only] [--pillow-limit-break] [--pdfa [PDFA]] [-S LxL] [-s LxL] [-b L[:L]] [-f FIT] [-a] [-r ROT] [--crop-border L[:L]] [--bleed-border L[:L]] [--trim-border L[:L]] [--art-border L[:L]] [--title title] [--author author] [--creator creator] [--producer producer] [--creationdate creationdate] [--moddate moddate] [--subject subject] [--keywords kw [kw ...]] [--viewer-panes PANES] [--viewer-initial-page NUM] [--viewer-magnification MAG] [--viewer-page-layout LAYOUT] [--viewer-fit-window] [--viewer-center-window] [--viewer-fullscreen] [infile ...] img2pdf: error: argument -o/--output: can't open 'Mushroom ?.pdf': [Errno 22] Invalid argument: 'Mushroom ?.pdf' ``` It seems like the tool has issues with filenames that contain special characters. Any help resolving this would be appreciated.
Owner

I just ran

img2pdf image.png -o "Umbrella ☂.pdf"

and it works fine on my system.

Which operating system are you using?

I just ran img2pdf image.png -o "Umbrella ☂.pdf" and it works fine on my system. Which operating system are you using?
Poster

I ran it on windows 10

I ran it on windows 10
Owner

Okay. I do not have access to a Windows machine. Maybe other Windows users like @soheday or @bbbradsmith have some knowledge about encoding problems like this on Windows?

@soheday, @bbbradsmith: I hope it's okay to ping you on a windows issue like this?

Thanks!

Okay. I do not have access to a Windows machine. Maybe other Windows users like @soheday or @bbbradsmith have some knowledge about encoding problems like this on Windows? @soheday, @bbbradsmith: I hope it's okay to ping you on a windows issue like this? Thanks!

Works fine for me, Win10. I suspect that @Anangaya has used a question mark (illegal file name character) instead of umbrella character.

img2pdf could check if specified output file name contains illegal characters and inform user about it.

Works fine for me, Win10. I suspect that @Anangaya has used a question mark (illegal file name character) instead of umbrella character. img2pdf could check if specified output file name contains illegal characters and inform user about it.
Owner

Thank you for your input. I'm tempted to just close this issue because:

  • another Windows user is not able to reproduce it
  • i do not think that implementing platform specific filename checks are something that should be done by img2pdf (is any other software doing this?)
Thank you for your input. I'm tempted to just close this issue because: - another Windows user is not able to reproduce it - i do not think that implementing platform specific filename checks are something that should be done by img2pdf (is any other software doing this?)
Poster

The renaming works file when I ran it inside a windows sandbox. There might be something in my system that's causing this problem with img2pdf (other cli renaming methods with mv and ren works). I can work around it using a intermediate file name so I'll close this issue.

The renaming works file when I ran it inside a windows sandbox. There might be something in my system that's causing this problem with img2pdf (other cli renaming methods with mv and ren works). I can work around it using a intermediate file name so I'll close this issue.
Anangaya closed this issue 11 months ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#166
Loading…
There is no content yet.