2đź‘Ť
What solved it for me was switching from backslashes to forward slashes! Who would’ve thought?!
Similar post: ioerror invalid mode w
👤Stef g
1đź‘Ť
Check your file path if it’s valid:
C:/Users/Silent/Documents/Python/karnadash/karnadash/static/tempfiles/temp.jpg
Perhaps it contains one karnadash
too much.
👤matino
- [Answered ]-Django enable anonymous user session
- [Answered ]-Validate multiple related objects through foreign key field in Django ModelForm
- [Answered ]-Django Rest Framework – main url HTTP/1.1" 404 Not Found
-1đź‘Ť
I had a similar problem when I was trying to save some figures in a fowder. Some figures I could save, but couldn’t save others, and I was using the same code. I realized that the name of the figure and the backslash were in conflict with a reserved code.
IOError: [Errno 22] invalid mode ('wb') or filename: '02102016\nDTG.png'
I think "\n"
was interpreted as “enter”. The problem had been solved when I changed it to forward slash.
👤Cristiano
- [Answered ]-How to sync django models with pre-existing database?
- [Answered ]-Django / DRF – Changing the timezone does not work
- [Answered ]-Displaying form content instead of form object name
- [Answered ]-Creating Generic Views in Django
- [Answered ]-Django Rest Framework : managing relations
Source:stackexchange.com