EnokiUN / voltage

A simple asynchronous pythonic wrapper for the revolt api
MIT License
42 stars 14 forks source link

Cannot import name "get" from voltage.utils #85

Closed HGStyle closed 1 year ago

HGStyle commented 1 year ago

Summary

If you run your revolt bot, an error will occurs.

Reproduction Steps

I only coded a Revolt bot.

Minimal Reproducible Code

import voltage, os
rvl_cli = voltage.Client()
rvl_token = os.getenv('revolt')

@rvl_cli.listen('ready')
async def on_rdy():
    print('Revolt bot is ready !')

rvl_cli.run(rvl_token)

Expected Results

Run the bot

Actual Results

It crashed.

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import voltage
  File "/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/__init__.py", line 32, in <module>
    from .client import Client
  File "/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/client.py", line 10, in <module>
    from .internals import CacheHandler, HTTPHandler, WebSocketHandler
  File "/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/internals/__init__.py", line 7, in <module>
    from .cache import CacheHandler
  File "/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/internals/cache.py", line 11, in <module>
    from ..server import Server
  File "/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/server.py", line 9, in <module>
    from .invites import Invite
  File "/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/invites.py", line 7, in <module>
    from .utils import get
ImportError: cannot import name 'get' from 'voltage.utils' (/home/runner/Discord2Revolt/venv/lib/python3.8/site-packages/voltage/utils/__init__.py)

Checklist

Additional Context

I have found a fix :

  1. Copy all the content of the voltage/utils.py file
  2. Go to the file voltage/utils/__init__.py.
  3. Paste all the code in the file
  4. Move the line from __future__ import annotations at the first line
  5. Fixed ! (i think)
HGStyle commented 1 year ago

I'm just waiting for anyone to fix it in the repo (because idk how to suggest a fix :/ )

EnokiUN commented 1 year ago

pip uninstall voltage && pip install git+https://github.com/enokiun/voltage is the current solution for this, why this occurs escapes me and I'm left to assume that it's merely PyPI's fault, if you have any ideas why the PyPI version of voltage is always borked like this besides the old utils submodule being cached then please do LMK