Closed thnhub closed 1 year ago
That error occurs because DMOJ site is running by root in the docker container. (ChromeDriver cannot be executed by root user.)
You can avoid this problem by adding a line below in function _make
of dmoj-docker/dmoj/repo/judge/pdf_problems.py
options.add_argument("--no-sandbox")
However, this solution is not recommended because it is dangerous to run ChromeDriver as root. (ref)
That error occur because DMOJ site is running by root in the docker container. (ChromeDriver cannot be executed by root user.)
You can avoid this problem by adding a line below in function
_make
ofdmoj-docker/dmoj/repo/judge/pdf_problems.py
options.add_argument("--no-sandbox")
However, this solution is not recommended because it is dangerous to run ChromeDriver as root. (ref)
Thank you very much for your help!
I followed your solution and it worked. I added the command options.add_argument("--no-sandbox")
into function _make
of SeleniumPDFRender
class.
The PDF file was shown on browsers. But there are some other errors, which are: Unicode font and math equation, they do not appear on PDF.
May I ask further, how should I fix those errors?
Thank you!
It is not because of the DMOJ itself, but because there's no font files for your language in docker container(dmoj-base
). It can be resolved by simply adding Unicode fonts in dmoj-base
.
fonts-noto
package includes almost every fonts in the world. You can install it by appending lines below in dmoj-docker/dmoj/base/Dockerfile
.
RUN apt-get update && \
apt-get install -y fonts-noto && \
fc-cache -f
After adding them, rebuild containers, and start them.
sudo docker-compose down
sudo docker-compose build
sudo docker-compose up -d
Edit: Note that because of the pdfcache
, the generated PDF document may not be changed. In this case, modify problem description slightly, and try again.
OK, thank you @powergee so much! I will try soon.
With e6388ecfe4b59614bb4d032653e2b52765cf7ebb, this should no longer be an issue.
I have successfully installed the DMOJ website on ubuntu 20.04. However, the "View as PDF" function not working. I see the "View as PDF" button on-page, but it occurs an error when I click on it. This is the error:
How can I resolve that error, please guide me? Thank you!