New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving PDF documents with a char ':' in filename #4861
Comments
What exception does Pillow give? Please could you paste the full traceback? I'd guess some OS or file system exception? That would sound appropriate, and this is probably not a Pillow error. I suggest you pass in a filename to |
No. It DOES NOT give Exception. But I think that the behavior of the function, when it creates a file with a partial name and without extension, does not write anything to it and simply terminates, is wrong. It should throw an exception that the file should not have ':' in the name |
Ah sorry, I misread the report. Then it sounds like you're running into this:
See the rest of the answer for more info. So something like |
Thanks I got it |
What did you do?
I needed to save an list of PIL Images to one pdf file. So I wrote code like this:
And get_time func:
What happend
But when I ran the program, the pdf file was created, but it had an incomplete name and size of 0 bytes
The problem was that Windows does not support ':' in file names and Python cannot to create the file. But PIL does not give an error because of this and simply terminates the program. If the function is changed in this way
return str(str(datetime.datetime.now().time())[0:5]).replace(":", "-")
, then everything will work.What did you expect to happen?
PIL Image.save raise Exception
P.S.
P.P.S
OS Windows 10 with all updates
Python 3.7.6
Pillow==7.2.0
Other libs:
The text was updated successfully, but these errors were encountered: