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

python でのsubmit時のlanguage_number取得時のerror #204

Open
Schumi543 opened this issue Aug 16, 2020 · 0 comments
Open

python でのsubmit時のlanguage_number取得時のerror #204

Schumi543 opened this issue Aug 16, 2020 · 0 comments

Comments

@Schumi543
Copy link

version: 1.1.7.1
対象の問題: ABC123/A

#192 と同様でlanguage_number取得時に正規表現でマッチしていないようです。

❯ atcoder-tools submit -u ABC123/A
Traceback (most recent call last):
  File "/Users/user/.local/bin/atcoder-tools", line 8, in <module>
    sys.exit(main())
  File "/Users/user/.local/pipx/venvs/atcoder-tools/lib/python3.8/site-packages/atcodertools/atcoder_tools.py", line 61, in main
    exit_program(submit_main(prog, args))
  File "/Users/user/.local/pipx/venvs/atcoder-tools/lib/python3.8/site-packages/atcodertools/tools/submit.py", line 117, in main
    submission = client.submit_source_code(
  File "/Users/user/.local/pipx/venvs/atcoder-tools/lib/python3.8/site-packages/atcodertools/client/atcoder.py", line 178, in submit_source_code
    task_number = task_select_area.find(
AttributeError: 'NoneType' object has no attribute 'find'

対象のhtmlをdumpして, grepかけると以下のようになりました。

❯ grep -i 'python' actual_submit.html | sort |uniq 
                                                                        <option value="4006" data-mime="text/x-python">Python (3.8.2)</option>
                                                                        <option value="4046" data-mime="text/x-python">PyPy2 (7.3.0)</option>
                                                                        <option value="4047" data-mime="text/x-python">PyPy3 (7.3.0)</option>
                                                                        <option value="4065" data-mime="text/x-python">Cython (0.29.16)</option>

これが以下の正規表現でmatchしないため, language codeが取得できないようです。

submission_lang_pattern=re.compile(".*Python3.*|^Python$"),

手元ではworkaroundとして, 正規表現を以下のように変更しました

diff --git a/atcodertools/common/language.py b/atcodertools/common/language.py
index 10a5bef..935d69e 100644
--- a/atcodertools/common/language.py
+++ b/atcodertools/common/language.py
@@ -80,7 +80,7 @@ PYTHON = Language(
     name="python",
     display_name="Python",
     extension="py",
-    submission_lang_pattern=re.compile(".*Python3.*|^Python$"),
+    submission_lang_pattern=re.compile(".*Python.*|^Python$"),
     default_code_generator=python.main,
     default_template_path=get_default_template_path('py'),
 )
kyasbal added a commit to kyasbal/atcoder-tools that referenced this issue Nov 9, 2020
…onger matching with the submission page.

Submission language pattern for python was no longer matching with the submission page.
Just fixing regex pattern.
firewood pushed a commit to firewood/atcoder-tools that referenced this issue May 2, 2021
…onger matching with the submission page.

Submission language pattern for python was no longer matching with the submission page.
Just fixing regex pattern.
firewood pushed a commit to firewood/atcoder-tools that referenced this issue May 3, 2021
…onger matching with the submission page.

Submission language pattern for python was no longer matching with the submission page.
Just fixing regex pattern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant