AzurLaneAutoScript
AzurLaneAutoScript copied to clipboard
商店购买时报错 AttributeError: 'function' object has no attribute 'predict'
在提问之前...
- [X] 我已经搜索了现有的 issues
- [X] 我在提问题之前至少花费了 5 分钟来思考和准备
- [X] 我已经阅读了 Wiki 中的 常见问题(FAQ)
- [X] 我正在使用最新版的 Alas
描述你的问题
版本:dev分支,最新提交
如何复现
- 前往 '商店'
预期行为
正常购买无报错
相关 Logs
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
SHOPONCE
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
2023-07-20 00:06:52.849 | INFO | UI get current page
2023-07-20 00:06:52.869 | INFO | [UI] page_munitions
2023-07-20 00:06:52.871 | INFO | Already at page_munitions
2023-07-20 00:06:52.872 | INFO | SHOP_TAB set to left=2
2023-07-20 00:06:52.874 | INFO | Nav item active: 1 from range (0, 1)
2023-07-20 00:06:52.875 | INFO | SHOP_NAV set to left=2 upper=2
2023-07-20 00:06:52.877 | INFO | Nav item active: 0 from range (0, 4)
2023-07-20 00:06:52.879 | INFO | Click ( 347, 313) @ SHOP_NAV_0_1
2023-07-20 00:06:53.048 | INFO | Nav item active: 1 from range (0, 4)
═════════════════════════════════════════════════════ MERIT SHOP ══════════════════════════════════════════════════════
2023-07-20 00:06:53.051 | INFO | MERIT SHOP
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2023-07-20 00:06:53.055 | INFO | SHOP BUY
2023-07-20 00:06:53.057 | INFO | Loading template folder: ./assets/shop/merit
2023-07-20 00:06:53.095 | INFO | [next_template_index] 56
2023-07-20 00:06:53.101 | INFO | New template: 57
2023-07-20 00:06:53.104 | INFO | New template: 58
2023-07-20 00:06:53.110 | INFO | New template: 59
2023-07-20 00:06:53.122 | INFO | New template: 60
2023-07-20 00:06:53.207 | INFO | [Price_ocr 0.070s] [15000, 3000, 20000, 8000, 5000, 600, 600, 300, 100, 100]
2023-07-20 00:06:53.210 | INFO | [Item detected] 10
2023-07-20 00:06:53.384 | INFO | [Price_ocr 0.068s] [15000, 3000, 20000, 8000, 5000, 600, 600, 300, 100, 100]
2023-07-20 00:06:53.386 | INFO | [Item detected] 10
2023-07-20 00:06:53.388 | INFO | Shop row 1: ['BulinT2_x1_Merit_x15000', 'BulinT1_x1_Merit_x3000',
'Kawakaze_x1_Merit_x20000', 'Minsk_x1_Merit_x8000', 'Casablanca_x1_Merit_x5000']
2023-07-20 00:06:53.390 | INFO | Shop row 2: ['BoxT3_x1_Merit_x600', 'BoxT3_x1_Merit_x600', 'BoxT2_x1_Merit_x300',
'60_x1_Merit_x100', '60_x1_Merit_x100']
2023-07-20 00:06:53.408 | INFO | [SHOP_MERIT 0.016s] 4325
2023-07-20 00:06:53.411 | INFO | Merit: 4325
2023-07-20 00:06:53.414 | INFO | Shop buy finished
2023-07-20 00:06:53.416 | INFO | SHOP_TAB set to left=2
2023-07-20 00:06:53.419 | INFO | Nav item active: 1 from range (0, 1)
2023-07-20 00:06:53.421 | INFO | SHOP_NAV set to left=3 upper=3
2023-07-20 00:06:53.423 | INFO | Nav item active: 1 from range (0, 4)
2023-07-20 00:06:53.426 | INFO | Click ( 343, 398) @ SHOP_NAV_0_2
2023-07-20 00:06:53.577 | INFO | Nav item active: 2 from range (0, 4)
═════════════════════════════════════════════════════ GUILD SHOP ══════════════════════════════════════════════════════
2023-07-20 00:06:53.582 | INFO | GUILD SHOP
────────────────────────────────────────────────────── SHOP BUY ───────────────────────────────────────────────────────
2023-07-20 00:06:53.586 | INFO | SHOP BUY
2023-07-20 00:06:53.588 | ERROR | AttributeError: 'function' object has no attribute 'predict'
╭───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────╮
│ │
│ /xxx/AzurLaneAutoScript/alas.py:68 in run │
│ │
│ 65 │ def run(self, command): │
│ 66 │ │ try: │
│ 67 │ │ │ self.device.screenshot() │
│ ❱ 68 │ │ │ self.__getattribute__(command)() │
│ 69 │ │ │ return True │
│ 70 │ │ except TaskEnd: │
│ 71 │ │ │ return True │
│ │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮ │
│ │ command = 'shop_once' │ │
│ │ e = AttributeError("'function' object has no attribute 'predict'") │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x7f7dcd294c90> │ │
│ ╰──────────────────────────────────────────────────────────────────────────╯ │
│ /xxx/AzurLaneAutoScript/alas.py:217 in shop_once │
│ │
│ 214 │ │
│ 215 │ def shop_once(self): │
│ 216 │ │ from module.shop.shop_reward import RewardShop │
│ ❱ 217 │ │ RewardShop(config=self.config, device=self.device).run_once() │
│ 218 │ │
│ 219 │ def shipyard(self): │
│ 220 │ │ from module.shipyard.shipyard_reward import RewardShipyard │
│ │
│ ╭──────────────────────────── locals ─────────────────────────────╮ │
│ │ RewardShop = <class 'module.shop.shop_reward.RewardShop'> │ │
│ │ self = <alas.AzurLaneAutoScript object at 0x7f7dcd294c90> │ │
│ ╰─────────────────────────────────────────────────────────────────╯ │
│ │
│ /xxx/AzurLaneAutoScript/module/shop/shop_reward.py:31 in run_once │
│ │
│ 28 │ │ │
│ 29 │ │ self.shop_tab.set(main=self, left=2) │
│ 30 │ │ self.shop_nav.set(main=self, upper=3) │
│ ❱ 31 │ │ GuildShop(self.config, self.device).run() │
│ 32 │ │ │
│ 33 │ │ self.shop_tab.set(main=self, left=1) │
│ 34 │ │ self.shop_nav.set(main=self, upper=2) │
│ │
│ ╭─────────────────────────────── locals ───────────────────────────────╮ │
│ │ self = <module.shop.shop_reward.RewardShop object at 0x7f7db9eae1d0> │ │
│ ╰──────────────────────────────────────────────────────────────────────╯ │
│ │
│ /xxx/AzurLaneAutoScript/module/shop/shop_guild.py:97 in run │
│ │
│ 94 │ │ # Refresh if enabled and available │
│ 95 │ │ refresh = self.config.GuildShop_Refresh │
│ 96 │ │ for _ in range(2): │
│ ❱ 97 │ │ │ success = self.shop_buy() │
│ 98 │ │ │ if not success: │
│ 99 │ │ │ │ break │
│ 100 │ │ │ if refresh: │
│ │
│ ╭─────────────────────────────── locals ────────────────────────────────╮ │
│ │ _ = 0 │ │
│ │ refresh = True │ │
│ │ self = <module.shop.shop_guild.GuildShop object at 0x7f7d185bb250> │ │
│ ╰───────────────────────────────────────────────────────────────────────╯ │
│ │
│ /xxx/AzurLaneAutoScript/module/shop/clerk.py:292 in shop_buy │
│ │
│ 289 │ │ │ logger.hr('Shop buy', level=2) │
│ 290 │ │ │ # Get first for innate delay to ocr │
│ 291 │ │ │ # shop currency for accurate parse │
│ ❱ 292 │ │ │ items = self.shop_get_items() │
│ 293 │ │ │ self.shop_currency() │
│ 294 │ │ │ if self._currency <= 0: │
│ 295 │ │ │ │ logger.warning(f'Current funds: {self._currency}, stopped') │
│ │
│ ╭────────────────────────────── locals ──────────────────────────────╮ │
│ │ _ = 0 │ │
│ │ self = <module.shop.shop_guild.GuildShop object at 0x7f7d185bb250> │ │
│ ╰────────────────────────────────────────────────────────────────────╯ │
│ │
│ /xxx/AzurLaneAutoScript/module/shop/base.py:245 in shop_get_items │
│ │
│ 242 │ │ │ │ else: │
│ 243 │ │ │ │ │ logger.warning('SHOP_EXTRACT_TEMPLATE enabled but │
│ shop_template_folder is not set, skip extracting') │
│ 244 │ │ │ │
│ ❱ 245 │ │ │ shop_items.predict( │
│ 246 │ │ │ │ self.device.image, │
│ 247 │ │ │ │ name=True, │
│ 248 │ │ │ │ amount=False, │
│ │
│ ╭──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │ record = 0 │ │
│ │ self = <module.shop.shop_guild.GuildShop object at 0x7f7d185bb250> │ │
│ │ shop_items = <bound method GuildShop.shop_guild_items of <module.shop.shop_guild.GuildShop object at │ │
│ │ 0x7f7d185bb250>> │ │
│ │ skip_first_screenshot = False │ │
│ │ timeout = Timer(limit=0.106/3, count=0/9) │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'function' object has no attribute 'predict'
2023-07-20 00:06:53.786 | WARNING | Saving error: ./log/error/1689782813786
截图
还有别的吗?
No response
已修复,可正常购买