Mercurial's Python 2 support is likely to drop too soon, so I built Python 3.8 and then migrated to it, and it got stuck and fixed.
The original index.cgi looks like this, and if I rewrite this python to python3, 500: Internal Server Error.
#!/home/xxxx/local/bin/python
from mercurial import hgweb
from cgitb import enable
enable()
hgweb.hgweb("/home/xxxx/hg", "xxxx-hg").run()
Looking at the Apache error log, Response header name'<!-' Contains invalid characters, aborting request
. It seems that cgitb is bad, so if you drop it, a stack trace will be output to the Apache error log. The error message for Mercurial only supports encoded strings
is no, and hgweb.hgweb ("/ home / xxxx / hg" .encode ('utf-8'), "xxxx-hg" Rewrite to ".encode ('utf-8')). run ()
and check the operation.
If you think about it, you don't need to encode it, and the final source code is settled below.
#!/home/xxxx/local/bin/python3
from mercurial.hgweb import hgweb
hgweb(b"/home/xxxx/hg", b"xxxx-hg").run()
Related: Python 3 was strayly built on Sakura's rental server (memorial)
Recommended Posts