Skip to content

更新时发生错误后无法进入更新页面 #5226

@Sena-Ajisai

Description

@Sena-Ajisai

在提问之前...

  • 我已经搜索了现有的 issues
  • 我在提问题之前至少花费了 5 分钟来思考和准备
  • 我已经阅读了 Wiki 中的 常见问题(FAQ)
  • 我正在使用最新版的 Alas

描述你的问题

进入更新器界面报错、更新器界面变成大白页
按钮点击事件 (pywebio)

AlasGUI.dev_update()

update_table()

updater.get_commit()

self.execute_output(...)

subprocess.run(...)

subprocess.Popen._communicate()

stderr = stderr[0] ← 数组越界

在D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\subprocess.py中
将stderr = stderr[0]改为stderr = stderr[0] if stderr else ''后进入更新器界面不再报错并正常显示。
修改后还没有遇到其他问题,但是不确定之后更新时是否会出现问题。

如何复现

  1. 前往 '...'
  2. 点击 '....'
  3. 滑动到 '....'
  4. 出现问题

预期行为

No response

相关 Logs

+-------------------------- Traceback (most recent call last) ---------------------------+
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\site-packages\pywebio\session |
| \threadbased.py:254 in run                                                             |
|                                                                                        |
|   253                 try:                                                             |
| > 254                     callback(event['data'])                                      |
|   255                 except Exception as e:                                           |
|                                                                                        |
| +-------------------------------------- locals --------------------------------------+ |
| | callback = <function put_buttons.<locals>.click_callback at 0x00000171D217A558>    | |
| |        e = IndexError('list index out of range')                                   | |
| |    event = {                                                                       | |
| |                'event': 'callback',                                                | |
| |                'task_id': 'CB-click_callback-q9RiPOQsSJ',                          | |
| |                'data': 0                                                           | |
| |            }                                                                       | |
| |     self = <pywebio.session.threadbased.ThreadBasedSession object at               | |
| |            0x00000171D1F688C8>                                                     | |
| +------------------------------------------------------------------------------------+ |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\site-packages\pywebio\output. |
| py:801 in click_callback                                                               |
|                                                                                        |
|    800         if isinstance(onclick, Sequence):                                       |
| >  801             return onclick[btn_idx]()                                           |
|    802         else:                                                                   |
|                                                                                        |
| +-------------------------------------- locals --------------------------------------+ |
| | btn_idx = 0                                                                        | |
| |    btns = [{'label': '更新器', 'value': 0, 'color': 'menu', 'disabled': False}]    | |
| | onclick = [                                                                        | |
| |               <bound method AlasGUI.dev_update of <module.webui.app.AlasGUI object | |
| |           at 0x00000171D1F4D848>>                                                  | |
| |           ]                                                                        | |
| |  values = ['']                                                                     | |
| +------------------------------------------------------------------------------------+ |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\site-packages\pywebio\output. |
| py:1796 in wrapper                                                                     |
|                                                                                        |
|   1795             try:                                                                |
| > 1796                 return func(*args, **kwargs)                                    |
|   1797             finally:                                                            |
|                                                                                        |
| +------------------------------ locals -------------------------------+                |
| |   args = (<module.webui.app.AlasGUI object at 0x00000171D1F4D848>,) |                |
| |   func = <function AlasGUI.dev_update at 0x00000171D1EE0F78>        |                |
| | kwargs = {}                                                         |                |
| |   self = <pywebio.output.use_scope_ object at 0x00000171D1ECF3C8>   |                |
| +---------------------------------------------------------------------+                |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\module\webui\app.py:927 in dev_update     |
|                                                                                        |
|    926                                                                                 |
| >  927         update_table()                                                          |
|    928         self.task_handler.add(updater_switch.g(), delay=0.5, pending_delete=Tru |
|                                                                                        |
| +-------------------------------------- locals --------------------------------------+ |
| |           self = <module.webui.app.AlasGUI object at 0x00000171D1F4D848>           | |
| |              u = <function AlasGUI.dev_update.<locals>.u at 0x00000171D2048DC8>    | |
| |   update_table = <function AlasGUI.dev_update.<locals>.update_table at             | |
| |                  0x00000171D217A318>                                               | |
| | updater_switch = <module.webui.utils.Switch object at 0x00000171D13F5288>          | |
| +------------------------------------------------------------------------------------+ |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\module\webui\app.py:780 in update_table   |
|                                                                                        |
|    779             with use_scope("updater_info", clear=True):                         |
| >  780                 local_commit = updater.get_commit(short_sha1=True)              |
|    781                 upstream_commit = updater.get_commit(                           |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\module\webui\updater.py:55 in get_commit  |
|                                                                                        |
|    54         log = self.execute_output(                                               |
| >  55             f'"{self.git}" log {revision} --pretty=format:"%{ph}---%an---%ad---% |
|       --date=iso -{n}'                                                                 |
|    56         )                                                                        |
|                                                                                        |
| +--------------------------------- locals ---------------------------------+           |
| |          n = 1                                                           |           |
| |         ph = 'h'                                                         |           |
| |   revision = ''                                                          |           |
| |       self = <module.webui.updater.Updater object at 0x00000171D1EA9088> |           |
| | short_sha1 = True                                                        |           |
| +--------------------------------------------------------------------------+           |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\module\webui\updater.py:43 in             |
| execute_output                                                                         |
|                                                                                        |
|    42         log = subprocess.run(                                                    |
| >  43             command, capture_output=True, text=True, encoding="utf8", shell=True |
|    44         ).stdout                                                                 |
|                                                                                        |
| +-------------------------------------- locals --------------------------------------+ |
| | command = '"D:/A/AlasApp_0.4.4_fullcn/AzurLaneAutoScript/toolkit/Git/mingw64/bin/… | |
| |           l'+55                                                                    | |
| |    self = <module.webui.updater.Updater object at 0x00000171D1EA9088>              | |
| +------------------------------------------------------------------------------------+ |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\subprocess.py:490 in run      |
|                                                                                        |
|    489         try:                                                                    |
| >  490             stdout, stderr = process.communicate(input, timeout=timeout)        |
|    491         except TimeoutExpired as exc:                                           |
|                                                                                        |
| +-------------------------------------- locals --------------------------------------+ |
| | capture_output = True                                                              | |
| |          check = False                                                             | |
| |          input = None                                                              | |
| |         kwargs = {                                                                 | |
| |                      'text': True,                                                 | |
| |                      'encoding': 'utf8',                                           | |
| |                      'shell': True,                                                | |
| |                      'stdout': -1,                                                 | |
| |                      'stderr': -1                                                  | |
| |                  }                                                                 | |
| |      popenargs = (                                                                 | |
| |                      '"D:/A/AlasApp_0.4.4_fullcn/AzurLaneAutoScript/toolkit/Git/m… | |
| |                  l'+55,                                                            | |
| |                  )                                                                 | |
| |        process = <subprocess.Popen object at 0x00000171D1C86448>                   | |
| |        timeout = None                                                              | |
| +------------------------------------------------------------------------------------+ |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\subprocess.py:964 in          |
| communicate                                                                            |
|                                                                                        |
|    963             try:                                                                |
| >  964                 stdout, stderr = self._communicate(input, endtime, timeout)     |
|    965             except KeyboardInterrupt:                                           |
|                                                                                        |
| +------------------------- locals --------------------------+                          |
| | endtime = None                                            |                          |
| |   input = None                                            |                          |
| |    self = <subprocess.Popen object at 0x00000171D1C86448> |                          |
| | timeout = None                                            |                          |
| +-----------------------------------------------------------+                          |
|                                                                                        |
| D:\A\AlasApp_0.4.4_fullcn\AzurLaneAutoScript\toolkit\lib\subprocess.py:1319 in         |
| _communicate                                                                           |
|                                                                                        |
|   1318             if stderr is not None:                                              |
| > 1319                 stderr = stderr[0]                                              |
|   1320                                                                                 |
|                                                                                        |
| +-------------------------------------- locals --------------------------------------+ |
| |      endtime = None                                                                | |
| |        input = None                                                                | |
| | orig_timeout = None                                                                | |
| |         self = <subprocess.Popen object at 0x00000171D1C86448>                     | |
| |       stderr = []                                                                  | |
| |       stdout = 'c9fdefdf9---LmeSzinc---2025-10-17 04:20:20 +0800---Merge pull      | |
| |                request #5225 from'+13                                              | |
| +------------------------------------------------------------------------------------+ |
+----------------------------------------------------------------------------------------+
IndexError: list index out of range

截图

No response

还有别的吗?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions