cheran-senthil / TLE

🤖 Discord Bot for Competitive Programming
https://discordapp.com/invite/2CJ6qvY
MIT License
318 stars 202 forks source link

HTTP error 403 forbidden #516

Closed ayush-india closed 8 months ago

ayush-india commented 8 months ago
root@87420:~/TLE# ./run.sh
Already up to date.
Installing dependencies from lock file

No dependencies to install or update

Installing the current project: TLE (0.2.0)
ujson module not found, using json
msgpack not installed, MsgPackSerializer unavailable
10-01-2024 16:57:02:INFO:tle.util.font_downloader:Downloading font `NotoSansCJK-Bold.ttc`.
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/root/TLE/tle/__main__.py", line 90, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/root/TLE/tle/__main__.py", line 57, in main
    setup()
  File "/root/TLE/tle/__main__.py", line 44, in setup
    font_downloader.maybe_download()
  File "/root/TLE/tle/util/font_downloader.py", line 34, in maybe_download
    _download(font_path)
  File "/root/TLE/tle/util/font_downloader.py", line 27, in _download
    with urllib.request.urlopen(f'{URL_BASE}{font}.zip') as resp:
  File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.10/urllib/request.py", line 525, in open
    response = meth(req, response)
  File "/usr/lib/python3.10/urllib/request.py", line 634, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.10/urllib/request.py", line 563, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
root@87420:~/TLE#

Python 3.10.12

i think it might be an issue with the vps not letting http requests || coz it works locall ||

I am not that experinced in these things, so i just want to make sure

ayush-india commented 8 months ago

let me know if any other details are needed

ayush-india commented 8 months ago

Should i retry with py 3.7

algmyr commented 8 months ago

This has nothing to do with versions. It's probably working locally because you already have the fonts downloaded.

Seems the download link we're using for Noto Sans CJK is no longer valid, and seems that it's now split into several more specific fonts based on chinese variants, japanese, ...

Need to figure out what we need to replace it with.

If you want a short term fix, copy the fonts downloaded to (I think) data/assets/fonts from your local machine to the new one

ayush-india commented 8 months ago

ok let me try that

ayush-india commented 8 months ago

thanks

to the future reader:

just copy the fonts files from the fonts folder in your local machine to the one over ssh(if you are using ssh).

i not then just look in the src code and mannually download the font files.

algmyr commented 8 months ago

No, please keep this open since we need to fix the download links. Manual downloads won't help you if the hosted file is no longer there.

ayush-india commented 8 months ago

@algmyr it would be nice if you would had placed the font files in the src code it self

algmyr commented 8 months ago

@algmyr it would be nice if you would had placed the font files in the src code it self

Putting big binary blobs on github is a bad idea

ayush-india commented 8 months ago

oh, ok

algmyr commented 8 months ago

Tentatively, using one of the fonts in https://github.com/notofonts-cjk/tree/main/Sans#ttf seems like a good idea if it works properly. Would need some minor code updates since the file name changed and it's all in one TTF. Would also need some manual testing that commands using the fonts work as intended

ayush-india commented 8 months ago

or simply just tell the user to manually add it

algmyr commented 8 months ago

It's also possible I messed up when checking if the file was online. Re-checking withnthe proper URLs they seem to be there. If so it might actually have been an issue with your host as you suspected, but that also seems very weird. Considering things actually seems to work as intended for now, closing for now