osuAkatsuki / bancho.py

An osu! server for the generic public, optimized for maintainability in modern python
https://akatsuki.gg
MIT License
212 stars 127 forks source link

bug: `cryptography` missing from requirements #392

Closed lokillo-0 closed 1 year ago

lokillo-0 commented 1 year ago

Describe the bug

bpy has an error when executing after a shutdown or restart of wsl and you have to delete the database and re-import the sql file

To Reproduce

run bpy and then shutdown or reboot the system and try to run bpy again and get the error https://youtu.be/5udn-7wrAQw

Expected behavior

so it works lol

bancho.py Version

4.7.2

Python Version

3.9.X (Default)

Relevant log output

lokillo@PC-GAMER:~/bancho.py$ make run
pipenv run python main.py
Loading .env environment variables...
ERROR:    Traceback (most recent call last):
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/connection.py", line 540, in _connect
    await self._request_authentication()
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/connection.py", line 854, in _request_authentication
    await self.caching_sha2_password_auth(auth_packet)
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/connection.py", line 973, in caching_sha2_password_auth
    data = _auth.sha2_rsa_encrypt(
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/pymysql/_auth.py", line 143, in sha2_rsa_encrypt
    raise RuntimeError(
RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 671, in lifespan
    async with self.lifespan_context(app):
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 566, in __aenter__
    await self._router.startup()
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/starlette/routing.py", line 648, in startup
    await handler()
  File "/home/lokillo/bancho.py/app/api/init_api.py", line 131, in on_startup
    await app.state.services.database.connect()
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/databases/core.py", line 82, in connect
    await self._backend.connect()
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/databases/backends/mysql.py", line 66, in connect
    self._pool = await aiomysql.create_pool(
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/pool.py", line 29, in _create_pool
    await pool._fill_free_pool(False)
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/pool.py", line 182, in _fill_free_pool
    conn = await connect(echo=self._echo, loop=self._loop,
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/connection.py", line 75, in _connect
    await conn._connect()
  File "/home/lokillo/bancho.py/.venv/lib/python3.9/site-packages/aiomysql/connection.py", line 558, in _connect
    raise OperationalError(2003,
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost'")

ERROR:    Application startup failed. Exiting.
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f570d702c10>
make: *** [Makefile:30: run] Error 3
lokillo@PC-GAMER:~/bancho.py$

Additional context

No response

cfgexe commented 1 year ago

that just means mysql isnt on doesnt it? try doing sudo service mysql start

cmyui commented 1 year ago

real error is the

RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods
cmyui commented 1 year ago

this is a bug - i'll fix it soon - basically you need to add cryptography = "*" to project requirements, and then reinstall dependencies