floydwch / kaggle-cli

(Deprecated, use https://github.com/Kaggle/kaggle-api instead) An unofficial Kaggle command line tool.
MIT License
674 stars 92 forks source link

submit.py: list index out of range error when rerieving team_id #45

Closed YaMolekula closed 6 years ago

YaMolekula commented 6 years ago

Hi! I get error "list index out of range" in mehod take_action of script submit.py. This error occures at lines

team_id = submit_page.soup.select(
    '.comp-content-inside h4 strong a'
)[0].attrs['href'].split('/')[2]

I found the fast solution - commenting out the following two blocks: 1)

team_id = submit_page.soup.select(
    '.comp-content-inside h4 strong a'
)[0].attrs['href'].split('/')[2]

2)

        status_url = (
            'https://www.kaggle.com/'
            'c/{}/submissions/status.json'
            '?apiVersion=1&teamId={}'.format(competition, team_id)
        )

        while True:
            status = browser.get(status_url).json()
            if status['submissionStatus'] == 'pending':
                time.sleep(1)
                continue
            elif status['submissionStatus'] == 'complete':
                print(status['publicScoreFormatted'])
                break
            else:
                print('something went wrong')
                break

After that you won't see submission score in console, but submissions will success.

floydwch commented 6 years ago

Thanks for the report, I'll try another method to get the team id.

floydwch commented 6 years ago

fixed via https://github.com/floydwch/kaggle-cli/commit/9e505774ab542e45d7acc015608f37dc8de1b180 .