LmeSzinc / StarRailCopilot

崩坏:星穹铁道脚本 | Honkai: Star Rail auto bot (简体中文/繁體中文/English/Español)
GNU General Public License v3.0
3.16k stars 159 forks source link

ImportError: cannot import name 'WrapValidator' from 'pydantic' #506

Open FatumCrux opened 5 months ago

FatumCrux commented 5 months ago

在提问之前...

描述你的问题

按识别角色养成规划教程将将游戏画面保持在计算结果后,用src扫描。结果报错

如何复现

  1. 前往 游戏工具
  2. 选择培养角色
  3. 点击材料计算
  4. 切换到SRC
  5. 在角色养成规划页面内开启调度器
  6. 出现问题

预期行为

SRC正常扫描完成并输出扫描结果

相关 Logs

═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
                                                         START                                                         
═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
2024-06-11 21:25:02.795 | INFO | [Lang] cn                                                                             
2024-06-11 21:25:02.803 | INFO | Bind task ['Alas']                                                                    
═══════════════════════════════════════════════════════ DEVICE ════════════════════════════════════════════════════════
2024-06-11 21:25:02.806 | INFO | DEVICE                                                                                
2024-06-11 21:25:02.818 | INFO | [AdbBinary] D:\StarRailCopilot\toolkit\Lib\site-packages\adbutils\binaries\adb.exe    
2024-06-11 21:25:02.820 | INFO | [AdbClient] AdbClient(127.0.0.1, 5037)                                                
2024-06-11 21:25:02.822 | INFO | <<< DETECT DEVICE >>>                                                                 
2024-06-11 21:25:02.823 | INFO | Here are the available devices, copy to Alas.Emulator.Serial to use it or set         
Alas.Emulator.Serial="auto"                                                                                            
2024-06-11 21:25:02.825 | INFO | 127.0.0.1:16384                                                                       
2024-06-11 21:25:02.829 | INFO | already connected to 127.0.0.1:16384                                                  
2024-06-11 21:25:02.830 | INFO | [AdbDevice] AdbDevice(serial=127.0.0.1:16384)                                         
2024-06-11 21:25:02.831 | INFO | [Server] CN-Official                                                                  
2024-06-11 21:25:02.832 | INFO | [PackageName] com.miHoYo.hkrpg                                                        
2024-06-11 21:25:02.833 | INFO | [Lang] cn                                                                             
2024-06-11 21:25:02.851 | INFO | [nemud.app_keep_alive] false                                                          
2024-06-11 21:25:02.853 | INFO | NemuIpcImpl init, nemu_folder=D:\Program Files\Netease\MuMuPlayer-12.0,               
ipc_dll=D:\Program Files\Netease\MuMuPlayer-12.0\shell\sdk\external_renderer_ipc.dll, instance_id=0, display_id=0      
2024-06-11 21:25:02.859 | INFO | [nemu_ipc_available] True                                                             
2024-06-11 21:25:02.861 | INFO | Screenshot interval set to 0.2s                                                       
2024-06-11 21:25:02.889 | INFO | [Screen_size] 1280x720                                                                
2024-06-11 21:25:03.423 | ERROR | ImportError: cannot import name 'WrapValidator' from 'pydantic'                      
(C:\Users\Providence\AppData\Roaming\Python\Python310\site-packages\pydantic\__init__.cp310-win_amd64.pyd)             
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ D:\StarRailCopilot\module\alas.py:79 in run                                                                         │
│                                                                                                                     │
│    76 │   │   try:                                                                                                  │
│    77 │   │   │   self.device.screenshot()                                                                          │
│    78 │   │   │   self.device.screenshot_tracking.clear()                                                           │
│ >  79 │   │   │   self.__getattribute__(command)()                                                                  │
│    80 │   │   │   return True                                                                                       │
│    81 │   │   except TaskEnd:                                                                                       │
│    82 │   │   │   return True                                                                                       │
│                                                                                                                     │
│ ┌──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────┐ │
│ │ command = 'planner_scan'                                                                                        │ │
│ │       e = ImportError("cannot import name 'WrapValidator' from 'pydantic'                                       │ │
│ │           (C:\\Users\\Providence\\AppData\\Roaming\\Python\\Python310\\site-packages\\pydantic\\__init__.cp310… │ │
│ │    self = <src.StarRailCopilot object at 0x0000025E6A3D6230>                                                    │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                                     │
│ D:\StarRailCopilot\src.py:70 in planner_scan                                                                        │
│                                                                                                                     │
│   67 │   │   Daemon(config=self.config, device=self.device, task="Daemon").run()                                    │
│   68 │                                                                                                              │
│   69 │   def planner_scan(self):                                                                                    │
│ > 70 │   │   from tasks.planner.scan import PlannerScan                                                             │
│   71 │   │   PlannerScan(config=self.config, device=self.device, task="PlannerScan").run()                          │
│   72                                                                                                                │
│   73                                                                                                                │
│                                                                                                                     │
│ ┌───────────────────────── locals ──────────────────────────┐                                                       │
│ │ self = <src.StarRailCopilot object at 0x0000025E6A3D6230> │                                                       │
│ └───────────────────────────────────────────────────────────┘                                                       │
│                                                                                                                     │
│ D:\StarRailCopilot\tasks\planner\scan.py:15 in <module>                                                             │
│                                                                                                                     │
│    12 from tasks.planner.assets.assets_planner_result import *                                                      │
│    13 from tasks.planner.keywords import ITEM_CLASSES                                                               │
│    14 from tasks.planner.keywords.classes import ItemCurrency                                                       │
│ >  15 from tasks.planner.model import PlannerMixin, PlannerResultRow                                                │
│    16                                                                                                               │
│    17 CALCULATE_TITLE.load_search(RESULT_CHECK.search)                                                              │
│    18 MATERIAL_TITLE.load_search(RESULT_CHECK.search)                                                               │
│                                                                                                                     │
│ ┌──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────┐ │
│ │                    AdaptiveScroll = <class 'module.ui.scroll.AdaptiveScroll'>                                   │ │
│ │                       area_center = <function area_center at 0x0000025E7EF288B0>                                │ │
│ │                      area_in_area = <function area_in_area at 0x0000025E7EF28A60>                               │ │
│ │                       BoxedResult = <class 'pponnxcr.predict_system.BoxedResult'>                               │ │
│ │                            Button = <class 'module.base.button.Button'>                                         │ │
│ │                     ButtonWrapper = <class 'module.base.button.ButtonWrapper'>                                  │ │
│ │                   CALCULATE_TITLE = CALCULATE_TITLE                                                             │ │
│ │                               cv2 = <module 'cv2' from                                                          │ │
│ │                                     'D:\\StarRailCopilot\\toolkit\\lib\\site-packages\\cv2\\__init__.py'>       │ │
│ │                      DETAIL_TITLE = DETAIL_TITLE                                                                │ │
│ │                      ITEM_CLASSES = [                                                                           │ │
│ │                                     │   <class 'tasks.planner.keywords.classes.ItemAscension'>,                 │ │
│ │                                     │   <class 'tasks.planner.keywords.classes.ItemCalyx'>,                     │ │
│ │                                     │   <class 'tasks.planner.keywords.classes.ItemCurrency'>,                  │ │
│ │                                     │   <class 'tasks.planner.keywords.classes.ItemExp'>,                       │ │
│ │                                     │   <class 'tasks.planner.keywords.classes.ItemTrace'>,                     │ │
│ │                                     │   <class 'tasks.planner.keywords.classes.ItemWeekly'>                     │ │
│ │                                     ]                                                                           │ │
│ │                      ItemCurrency = <class 'tasks.planner.keywords.classes.ItemCurrency'>                       │ │
│ │                            logger = <Logger alas (INFO)>                                                        │ │
│ │                    MATERIAL_TITLE = MATERIAL_TITLE                                                              │ │
│ │                               Ocr = <class 'module.ocr.ocr.Ocr'>                                                │ │
│ │                        OCR_RESULT = OCR_RESULT                                                                  │ │
│ │ OcrWhiteLetterOnComplexBackground = <class 'module.ocr.ocr.OcrWhiteLetterOnComplexBackground'>                  │ │
│ │                      page_planner = <tasks.base.page.Page object at 0x0000025E2A9014B0>                         │ │
│ │                                re = <module 're' from 'D:\\StarRailCopilot\\toolkit\\lib\\re.py'>               │ │
│ │                      RESULT_CHECK = RESULT_CHECK                                                                │ │
│ │                     RESULT_SCROLL = RESULT_SCROLL                                                               │ │
│ │                      SynthesizeUI = <class 'tasks.daily.synthesize.SynthesizeUI'>                               │ │
│ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
│                                                                                                                     │
│ D:\StarRailCopilot\tasks\planner\model.py:5 in <module>                                                             │
│                                                                                                                     │
│     2 from datetime import datetime                                                                                 │
│     3 from functools import partial                                                                                 │
│     4                                                                                                               │
│ >   5 from pydantic import BaseModel, ValidationError, WrapValidator, field_validator,                              │
│       model_validator                                                                                               │
│     6                                                                                                               │
│     7 from module.base.decorator import cached_property, del_cached_property                                        │
│     8 from module.config.stored.classes import now                                                                  │
│                                                                                                                     │
│ ┌──────────────────────────────────────── locals ─────────────────────────────────────────┐                         │
│ │       BaseModel = <class 'pydantic.main.BaseModel'>                                     │                         │
│ │        datetime = <class 'datetime.datetime'>                                           │                         │
│ │         partial = <class 'functools.partial'>                                           │                         │
│ │               t = <module 'typing' from 'D:\\StarRailCopilot\\toolkit\\lib\\typing.py'> │                         │
│ │ ValidationError = <class 'pydantic.error_wrappers.ValidationError'>                     │                         │
│ └─────────────────────────────────────────────────────────────────────────────────────────┘                         │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
ImportError: cannot import name 'WrapValidator' from 'pydantic'                                                        
(C:\Users\Providence\AppData\Roaming\Python\Python310\site-packages\pydantic\__init__.cp310-win_amd64.pyd)             
2024-06-11 21:25:03.532 | WARNING | Saving error: ./log/error/1718112303532

截图

No response

还有别的吗?

UU模拟器12 HONOR 70 PRO

LmeSzinc commented 5 months ago

480

Law2333 commented 4 months ago

480

没有这2个环境变量的话,是什么原因呢