The server encountered an internal error or misconfiguration and was unable to complete your request

При создании и запуске Python скрипта в Xampp появляется ошибка на сервере (хотя обычные страницы html грузятся без ошибок)

Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.4.15 Server at localhost Port 80
Чтобы понять, что за ошибка переходим в логи в директорию
C:\xampp\apache\logs
и открываем файл error.log и видим ошибку
AH01215: SyntaxError: Non-ASCII character ‘\\xd1’ in file C:/xampp/htdocs/test/index.py on line 15, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details\r: C:/xampp/htdocs/test/index.py
Ошибка связана с неправильной кодировкой файла, меняем кодировку и скрипт на сервере должен заработать.
Как запустить скрипт в Xampp, пример показан здесь.
384

Leave a Reply

Ваш адрес email не будет опубликован.