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

IndexError: list index out of range #18

Closed
ata666 opened this issue Sep 23, 2023 · 4 comments
Closed

IndexError: list index out of range #18

ata666 opened this issue Sep 23, 2023 · 4 comments
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@ata666
Copy link

ata666 commented Sep 23, 2023

2023-09-23 18:02:33.486463 距离抢购开始还剩:00 天 00 时 05 分 28 秒
2023-09-23 18:02:34.549085 距离抢购开始还剩:00 天 00 时 05 分 27 秒
2023-09-23 18:02:35.616211 距离抢购开始还剩:00 天 00 时 05 分 26 秒
2023-09-23 18:02:37.916294 开始选择手机规格
2023-09-23 18:02:38.595376 选择手机规格完成,颜色:白沙银 版本:12GB+512GB
Traceback (most recent call last):
File "C:\Users\mmm\Desktop\hw_seckill\main.py", line 14, in
main()
File "C:\Users\mmm\Desktop\hw_seckill\main.py", line 9, in main
huawei.start_process()
File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 38, in start_process
self.__countdown()
File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 98, in __countdown
print("{0} 距离抢购开始还剩:{1}".format(datetime.now(), self.__format_countdown_time(countdown_times)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 150, in __format_countdown_time
countdown_all_times.append(countdown_time_units[index])
~~~~~~~~~~~~~~~~~~~~^^^^^^^
IndexError: list index out of range

运行中突然报上面的错,然后就结束了,这个什么原因啊

@hy198346
Copy link

有时候countdown_time_units长度会超过4,加一个if index == 4: break,暂时用着,不过偶尔还是会报其他错闪退

@christinkaka
Copy link

有时候countdown_time_units长度会超过4,加一个if index == 4: break,暂时用着,不过偶尔还是会报其他错闪退

2023-09-23 18:02:33.486463 距离抢购开始还剩:00 天 00 时 05 分 28 秒 2023-09-23 18:02:34.549085 距离抢购开始还剩:00 天 00 时 05 分 27 秒 2023-09-23 18:02:35.616211 距离抢购开始还剩:00 天 00 时 05 分 26 秒 2023-09-23 18:02:37.916294 开始选择手机规格 2023-09-23 18:02:38.595376 选择手机规格完成,颜色:白沙银 版本:12GB+512GB Traceback (most recent call last): File "C:\Users\mmm\Desktop\hw_seckill\main.py", line 14, in main() File "C:\Users\mmm\Desktop\hw_seckill\main.py", line 9, in main huawei.start_process() File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 38, in start_process self.__countdown() File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 98, in __countdown print("{0} 距离抢购开始还剩:{1}".format(datetime.now(), self.__format_countdown_time(countdown_times))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mmm\Desktop\hw_seckill\huawei.py", line 150, in __format_countdown_time countdown_all_times.append(countdown_time_units[index]) ~~~~~~~~~~~~~~~~~~~~^^^^^^^ IndexError: list index out of range

运行中突然报上面的错,然后就结束了,这个什么原因啊

主要问题是有时候刷新页面没有返回倒计时,楼上老哥的方式可以解决,但可以考虑再来刷一下页面。。。

@ancoka ancoka self-assigned this Sep 25, 2023
@ancoka ancoka added the duplicate This issue or pull request already exists label Sep 25, 2023
@wwccz1
Copy link

wwccz1 commented Sep 25, 2023

有时候countdown_time_units长度会超过4,加一个if index == 4: break,暂时用着,不过偶尔还是会报其他错闪退

请问加载哪里纯小白

@geddeng
Copy link

geddeng commented Sep 26, 2023

@wwccz1 加在countdown_all_times.append(countdown_time_units[index])前面或者直接注释掉countdown_all_times.append(countdown_time_units[index])也行

ancoka added a commit that referenced this issue Sep 29, 2023
1. 修复时间倒计时索引溢出问题
2. 增加抢购等待判断
3. 增加提交订单
Closes #11 #12 #13 #14 #18
@ancoka ancoka closed this as completed Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

6 participants