-
Notifications
You must be signed in to change notification settings - Fork 4
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
[tacoshack] Hourly Income #6
Comments
I think I have addressed this issue, can you run .cog update and tell me if it works? I was reading: As of Python 3.8 this leads to a depreciation warning and starting from Python 3.11 it is an error. The correct way to use asyncio.wait() is by passing tasks created from your coroutines. Use create_task() to create these tasks explicitly. Sorry for my late response, I was moving to another part of the country and did not have my computer :) |
Hey James! I updated the cog, [2023-06-25 18:11:39] [ERROR] discord.ext.tasks: Unhandled exception in internal background task 'hourly_income'.13 | Traceback (most recent call last):
14 | File "/home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
15 | await self.coro(*args, **kwargs)
16 | File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/CogManager/cogs/tacoshack/tacoshack.py", line 163, in hourly_income
17 | await asyncio.wait(schedule.run_pending())
18 | File "/usr/lib/python3.11/asyncio/tasks.py", line 406, in wait
19 | raise TypeError(f"expect a list of futures, not {type(fs).__name__}")
20 | TypeError: expect a list of futures, not coroutine [2023-06-25 18:13:40] [ERROR] asyncio: Task exception was never retrieved4 | future: <Task finished name='Task-7877' coro=<Loop._loop() done, defined at /home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/tasks/__init__.py:200> exception=TypeError('expect a list of futures, not coroutine')>
5 | Traceback (most recent call last):
6 | File "/home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/tasks/__init__.py", line 264, in _loop
7 | raise exc
8 | File "/home/ubuntu/redenv/lib/python3.11/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
9 | await self.coro(*args, **kwargs)
10 | File "/home/ubuntu/.local/share/Red-DiscordBot/data/dusky/cogs/CogManager/cogs/tacoshack/tacoshack.py", line 163, in hourly_income
11 | await asyncio.wait(schedule.run_pending())
12 | File "/usr/lib/python3.11/asyncio/tasks.py", line 406, in wait
13 | raise TypeError(f"expect a list of futures, not {type(fs).__name__}")
14 | TypeError: expect a list of futures, not coroutine |
For anyone who encounters this problem, I found a work around to this. The only downside is that you can't schedule to update the balance at an exact time, It will run after 3600 seconds (1 hour) since the last time it was executed. You will need to comment (recommended) / remove the following lines in the tacoshack.py file: 9 | import aioschedule as schedule
158 | schedule.every().hour.at(":00").do(self.update_balance)
167 | schedule.clear() Now, head to the following line: 161 | @tasks.loop(seconds=1) There you have to specify in seconds how often do you want the payments to be made. (3600 = 1 hour recommended) Once done all of above, reload the tacoshack cog and you are all set. PD: To @jmesfo0, I know this isn't the best solution nor how you originally planned it, but it is the easiest way to get everything working without errors. |
Getting this error on the console on Shack's
hourly income
.[2023-06-04 17:00:00] [ERROR] discord.ext.tasks: Unhandled exception in internal background task 'hourly_income'.
The text was updated successfully, but these errors were encountered: