EnokiUN / voltage

A simple asynchronous pythonic wrapper for the revolt api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot import name "get" from voltage.utils

HGStyle opened this issue · comments

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

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

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)

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

commented

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