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

Bug: sample() got an unexpected keyword argument 'counts' #2

Closed
abrahum opened this issue May 21, 2021 · 1 comment
Closed

Bug: sample() got an unexpected keyword argument 'counts' #2

abrahum opened this issue May 21, 2021 · 1 comment

Comments

@abrahum
Copy link

abrahum commented May 21, 2021

使用中报错:

> File "/usr/local/lib/python3.8/dist-packages/nonebot/message.py", line 154, in _run_matcher
    await matcher.run(bot, event, state)
          │       │   │    │      └ {'_prefix': {'raw_command': None, 'command': None}, '_suffix': {'raw_command': None, 'command': None}, '_matched': '赛马娘10抽', ...
          │       │   │    └ PrivateMessageEvent(time=1621578618, self_id=917767625, post_type='message', sub_type='friend', user_id=307887491, message_ty...
          │       │   └ <nonebot.adapters.cqhttp.bot.Bot object at 0x7f75e8838bb0>
          │       └ <function Matcher.run at 0x7f75f336d280>
          └ <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False>

  File "/usr/local/lib/python3.8/dist-packages/nonebot/matcher.py", line 544, in run
    await handler(self, bot, event, state_)
          │       │     │    │      └ {'_prefix': {'raw_command': None, 'command': None}, '_suffix': {'raw_command': None, 'command': None}, '_matched': '赛马娘10抽', ...
          │       │     │    └ PrivateMessageEvent(time=1621578618, self_id=917767625, post_type='message', sub_type='friend', user_id=307887491, message_ty...
          │       │     └ <nonebot.adapters.cqhttp.bot.Bot object at 0x7f75e8838bb0>
          │       └ <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False>
          └ <Handler _(bot: <class 'nonebot.adapters.cqhttp.bot.Bot'>, event: <class 'nonebot.adapters.cqhttp.event.MessageEvent'>, state...

  File "/usr/local/lib/python3.8/dist-packages/nonebot/handler.py", line 81, in __call__
    await self.func(
          │    └ <function _ at 0x7f75ec327d30>
          └ <Handler _(bot: <class 'nonebot.adapters.cqhttp.bot.Bot'>, event: <class 'nonebot.adapters.cqhttp.event.MessageEvent'>, state...

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/__init__.py", line 121, in _
    await pretty.send(await pretty_draw(num, pool_name), at_sender=True)
          │      │          │           │    └ 'horse'
          │      │          │           └ 10
          │      │          └ <function pretty_draw at 0x7f75ec3270d0>
          │      └ <classmethod object at 0x7f75f33d6700>
          └ <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False>

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/pretty_handle.py", line 28, in pretty_draw
    obj_list, obj_dict, three_list, star_list, three_olist = _format_card_information(count, pool_name)
                                                             │                        │      └ 'horse'
                                                             │                        └ 10
                                                             └ <function _format_card_information at 0x7f75ec327550>

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/pretty_handle.py", line 90, in _format_card_information
    obj, code = _get_pretty_card(pool_name)
                │                └ 'horse'
                └ <function _get_pretty_card at 0x7f75ec3274c0>

  File "/usr/local/lib/python3.8/dist-packages/nonebot_plugin_gamedraw/pretty_handle.py", line 74, in _get_pretty_card
    star = random.sample([3, 2, 1],
           │      └ <bound method Random.sample of <random.Random object at 0x22555a0>>
           └ <module 'random' from '/usr/lib/python3.8/random.py'>

TypeError: sample() got an unexpected keyword argument 'counts'

Ubuntu 20.04
Python 3.8.5
Nonebot 2.0.0a13.post1

@HibiKier
Copy link
Owner

错误原因:需要python 3.9 以上

修复:已经重构向下兼容的方法,对包进行升级即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants