Error - UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character
Error: UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character
Occurs when trying to run the project with the command: python manage.py runserver
Treatment:
Look for the file: python\lib\site-packages\django\utils\autoreload.py
Then add the line to the function restart_with_reloader:
new_environ[\'PATH\'] = os.path.abspath(new_environ[\'PATH\'].encode(\'ascii\', \'replace\'))
Should look something like this:
def restart_with_reloader():
while True:
args = [sys.executable] + [\'-W%s\' % o for o in sys.warnoptions] + sys.argv
if sys.platform == "win32":
args = [\'"%s"\' % arg for arg in args]
new_environ = os.environ.copy()
new_environ["RUN_MAIN"] = \'true\'
new_environ[\'PATH\'] = os.path.abspath(new_environ[\'PATH\'].encode(\'ascii\', \'replace\'))
exit_code = os.spawnve(os.P_WAIT, sys.executable, args, new_environ)
if exit_code != 3:
return exit_code
After these changes, personally, everything worked for me, Python 3.4 + Windows 10.
Hoping it will work for you too.
Comments (0)
No comments yet.