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
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte #286
Comments
The |
Tyson seems to be right. You probably want to fix that file. Also this error is inside Django - you should see the same problem if you use |
For the little this is worth, I've just started getting these after upgrading a working site to Django 4.0. Was on Whitenoise, fell back to Still not sure what to do next but.. yeah.. |
I assume this is because Django now tries to rewrite source map references inside JS files, so it now has to read JS files which it never did before: |
That sounds like a legitimate explanation!
Are you sure they're valid? Django is just doing a plain read-and-decode. If you run that yourself for the same file, it should raise the same error. |
Huh, okay. So this is a Thanks for the pointers. |
If you can't face doing the upgrade (know the feeling!) then an alternative would be to work out what encoding it's in (e.g. using chardet), and convert it to utf-8 so Django can read it correctly. |
You may also be able to just download the original version again - it may have switched encoding after you downloaded it. |
TinyMCE seems to completely reinvent itself every three years. They're having another run at making some money. I could build it myself but honestly given how much they've changed all the packaging, that looks like it'll need re-integrating into the project. I'd sooner use something else that isn't quite so aggressive with its users. There are lots of RTE options these days. @evansd your idea worked :) chardet found ISO-8859-1 so I banged it through:
Altered two files, all working. What a pain in the bum over nothing. Thanks again for all your help. You've both made my Wednesday immeasurably better. |
I am trying to push my django project to heroku but each time i try to
python manage.py collectstatic
, I am get this error every time i setSTATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
YET When i run
python manage.py collectstatic
with the defaultSTATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage
'It runs without an issue.
I originally thought one/some of my static files had issues and went through each and everyone of the tens of files but still got the same error.
Then i decided to default the
STATICFILES_STORAGE
setting and to my surprise,python manage.py collectstatic
worked.I would like for someone to help me trouble shoot on this one.
Because the issue seems to be related to whitenoise.
I am using Python 3.9.4 and django 3.2
Below is the error i am getting.
The text was updated successfully, but these errors were encountered: