Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install -U online-judge-tools で online-judge-api-client が更新されない #836

Closed
beet-aizu opened this issue Oct 24, 2020 · 1 comment · Fixed by #839
Closed

Comments

@beet-aizu
Copy link
Contributor

Description

yukicoderに提出しようとするとエラーを吐くのでメッセージに従って更新しようとしたらうまくいかなかった

[INFO] load cookie from: /Users/beet/Library/Application Support/online-judge-tools/cookie.jar
[NETWORK] GET: https://yukicoder.me
[NETWORK] redirected to: https://yukicoder.me/
[NETWORK] 200 OK
[INFO] You are logged in.
[NETWORK] GET: https://yukicoder.me/problems/no/1269
[NETWORK] 200 OK
[INFO] both GCC and Clang are available for C++ compiler
[INFO] use: GCC
[INFO] chosen language: cpp17 (C++17(1z) (gcc 10.1.0 + boost 1.73.0))
[INFO] sleep(3.00)
Are you sure? [y/N] y
[NETWORK] GET: https://yukicoder.me/problems/no/1269/submit
[NETWORK] 200 OK
[NETWORK] POST: https://yukicoder.me/problems/no/1269/submit
[NETWORK] 403 Forbidden
[ERROR] 403 Client Error: Forbidden for url: https://yukicoder.me/problems/no/1269/submit
Traceback (most recent call last):
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/onlinejudge_command/main.py", line 271, in main
    run_program(parsed, parser=parser)
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/onlinejudge_command/main.py", line 241, in run_program
    submit(args)
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/onlinejudge_command/subcommand/submit.py", line 136, in submit
    submission = problem.submit_code(code, language_id=LanguageId(args.language), session=sess)
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/onlinejudge/service/yukicoder.py", line 195, in submit_code
    resp = form.request(session=session)
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/onlinejudge/_implementation/utils.py", line 108, in request
    return request(method, url, session=session, raise_for_status=raise_for_status, data=self.payload, files=self.files, **kwargs)
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/onlinejudge/_implementation/utils.py", line 173, in request
    resp.raise_for_status()
  File "/Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://yukicoder.me/problems/no/1269/submit
[HINT] try updating the version of online-judge-tools

try updating the version of online-judge-tools と言われたので pip install -U online-judge-tools をしたが解決せず

Error log

$ oj --version
[INFO] GET: https://pypi.org/pypi/online-judge-tools/json
[INFO] 200 OK
[INFO] GET: https://pypi.org/pypi/online-judge-api-client/json
[INFO] 200 OK
[WARNING] update available for online-judge-api-client: 10.4.0 -> 10.5.0
[INFO] run: $ pip3 install -U online-judge-api-client
online-judge-tools 11.1.0 (+ online-judge-api-client 10.4.0)
$ pip install -U online-judge-tools
Requirement already up-to-date: online-judge-tools in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (11.1.0)
Requirement already satisfied, skipping upgrade: diff-match-patch>=20181111 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-tools) (20200713)
Requirement already satisfied, skipping upgrade: requests<3,>=2 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-tools) (2.24.0)
Requirement already satisfied, skipping upgrade: colorama<1,>=0.3 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-tools) (0.4.3)
Requirement already satisfied, skipping upgrade: online-judge-api-client<11,>=10.3.0 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-tools) (10.4.0)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from requests<3,>=2->online-judge-tools) (2020.6.20)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from requests<3,>=2->online-judge-tools) (1.25.10)
Requirement already satisfied, skipping upgrade: chardet<4,>=3.0.2 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from requests<3,>=2->online-judge-tools) (3.0.4)
Requirement already satisfied, skipping upgrade: idna<3,>=2.5 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from requests<3,>=2->online-judge-tools) (2.10)
Requirement already satisfied, skipping upgrade: toml>=0.10 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-api-client<11,>=10.3.0->online-judge-tools) (0.10.1)
Requirement already satisfied, skipping upgrade: beautifulsoup4>=4 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-api-client<11,>=10.3.0->online-judge-tools) (4.9.1)
Requirement already satisfied, skipping upgrade: jsonschema>=3.2 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-api-client<11,>=10.3.0->online-judge-tools) (3.2.0)
Requirement already satisfied, skipping upgrade: lxml>=4 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-api-client<11,>=10.3.0->online-judge-tools) (4.5.2)
Requirement already satisfied, skipping upgrade: appdirs>=1 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-api-client<11,>=10.3.0->online-judge-tools) (1.4.4)
Requirement already satisfied, skipping upgrade: colorlog>=4.1.0 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from online-judge-api-client<11,>=10.3.0->online-judge-tools) (4.2.1)
Requirement already satisfied, skipping upgrade: soupsieve>1.2 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from beautifulsoup4>=4->online-judge-api-client<11,>=10.3.0->online-judge-tools) (2.0.1)
Requirement already satisfied, skipping upgrade: six>=1.11.0 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from jsonschema>=3.2->online-judge-api-client<11,>=10.3.0->online-judge-tools) (1.15.0)
Requirement already satisfied, skipping upgrade: pyrsistent>=0.14.0 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from jsonschema>=3.2->online-judge-api-client<11,>=10.3.0->online-judge-tools) (0.16.0)
Requirement already satisfied, skipping upgrade: setuptools in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from jsonschema>=3.2->online-judge-api-client<11,>=10.3.0->online-judge-tools) (41.2.0)
Requirement already satisfied, skipping upgrade: attrs>=17.4.0 in /Users/beet/.pyenv/versions/3.8.2/lib/python3.8/site-packages (from jsonschema>=3.2->online-judge-api-client<11,>=10.3.0->online-judge-tools) (19.3.0)
WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available.
You should consider upgrading via the '/Users/beet/.pyenv/versions/3.8.2/bin/python3.8 -m pip install --upgrade pip' command.
$ oj --version
[WARNING] update available for online-judge-api-client: 10.4.0 -> 10.5.0
[INFO] run: $ pip3 install -U online-judge-api-client
online-judge-tools 11.1.0 (+ online-judge-api-client 10.4.0)
$

oj --version の警告に従って pip install -U online-judge-api-client したら直りました

Other notes

  • Will you try to create a pull request?
    • no
@kmyk
Copy link
Member

kmyk commented Oct 24, 2020

[HINT] try updating the version of online-judge-tools というメッセージで pip install -U online-judge-api-client を実行させるのはかなり不親切だし修正しておきたい。
こういう場面で「このコマンドを実行してね!」を表示しないのもまた不親切であり、今回の例だと Please run `$ pip install -U online-judge-tools online-judge-api-client` などを追加で出力してやればよくなるように思う。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants