#Help - Class `UserFlags` received an invalid and unexpected value
1 messages · Page 1 of 1 (latest)
Can you send a snippet of your code?
i dont know exactly whats causing this
im guessing something in 3.12.3 specifically broke our code
@undone terrace i dont actually have problems with 3.12 necessarily
which makes me almost certain its a patch change that caused this
I'm getting issues with using 3.12.1 specifically
This is interesting to hear
I'll check in case I have a corrupt venv, I'm working with pyenv
try patch incrementals and tell me if there's a specific one it starts to error on for you, mine is .1
a temporary workaround would be us needing to add pyver condition checks and exhaustively specifying different logic but i hate the idea of doing that
i don't want to start monkey patching for edge cases
3.12.0 - works fine, wsl ubuntu
can you cat your os release
in a sec, installing 3.12.1
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
ty, i'll try keeping our versions the same
okay so my basic code on 3.12.2 is still working the same
its literally
import interactions
interactions.Intents(0)
so, uh, this is fun
that traceback implies 0 isn't declared
no, take a closer look
File "C:\Users\...\AppData\Local\Programs\Python\Python312\Lib\enum.py", line 1422, in _missing_
raise ValueError(
ValueError: (0, None) is not a valid Intents
thats the actual error
(0, None) isnt declared
however 0 is
i see
@pearl moat can you send me your code where intents are declared and then inserted into the bot instantiation?
meaning its becoming a tuple somewhere
does (intents) do anything..?
the value is at some point coerced into a tuple yeah
this shouldn't be a problem, which is the only thing i can theorise without seeing their code, e.g. intents=(intents)
the type still remains <flag 'Intents'>
but how is the flag value itself becoming a tuple???
that doesn't make any sense whatsoever, our intents decl is explicit to ints
I GOT A HIT!
3.12.3 seems to cause it for sure
you have no idea how excited i am
i'm not excited, idk wtf the people at cpython are thinking lmao
its something to work off of lmao
alright gang time to look through the list
3.12.3 isn't available in pyenv yet, leaving this one for you
regardless, enum issues in 3.12.3:
Bug report Bug description: Hello, I tried to define an enum with custom initializer and tuple values, akin to the Planet example. When instantiating this enum from values it works for some values ...
i think i see it
the call signature was changed
welp
i can reimplement the bug patch easily
so this shouldnt be a major issue, but its annoying
i can't even import it normally
i0@sophia:~$ pip show interactions-py
Name: interactions.py
Version: 5.11.0
Summary: Easy, simple, scalable and modular: a Python API wrapper for interactions.
Home-page: https://github.com/interactions-py/interactions.py
Author: LordOfPolls
Author-email: [email protected]
License:
Location: /home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages
Requires: aiohttp, attrs, discord-typings, emoji, tomli
Required-by:
i0@sophia:~$ pyenv global
3.12.3
>>> import interactions
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/__init__.py", line 2, in <module>
from .client import (
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/client/__init__.py", line 36, in <module>
from .client import Client
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/client/client.py", line 33, in <module>
import interactions.api.events as events
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/__init__.py", line 1, in <module>
from . import events
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/events/__init__.py", line 1, in <module>
from . import processors
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/events/processors/__init__.py", line 1, in <module>
from .channel_events import ChannelEvents
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/events/processors/channel_events.py", line 6, in <module>
from interactions.models.discord.channel import BaseChannel
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/models/__init__.py", line 1, in <module>
from .discord import (
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/models/discord/__init__.py", line 150, in <module>
from .modal import InputText, Modal, ParagraphText, ShortText, TextStyles
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/models/discord/modal.py", line 11, in <module>
from interactions.models.internal.application_commands import CallbackType
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/models/internal/__init__.py", line 13, in <module>
from .active_voice_state import ActiveVoiceState
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/models/internal/active_voice_state.py", line 8, in <module>
from interactions.api.voice.player import Player
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/voice/player.py", line 11, in <module>
from interactions.api.voice.audio import BaseAudio, AudioVolume
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/voice/audio.py", line 13, in <module>
from interactions.api.voice.opus import Encoder
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/site-packages/interactions/api/voice/opus.py", line 2, in <module>
import ctypes
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
>>>
that seems like your installation messed up somewhere
wacko, i'll try again
ig bad tarballs install
i0@sophia:~$ pyenv install 3.12.3
pyenv: /home/i0/.pyenv/versions/3.12.3 already exists
continue with installation? (y/N) y
Downloading Python-3.12.3.tar.xz...
-> https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tar.xz
Installing Python-3.12.3...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/bz2.py", line 17, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/curses/__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
WARNING: The Python curses extension was not compiled. Missing the ncurses lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_tkinter'
WARNING: The Python tkinter extension was not compiled and GUI subsystem has been detected. Missing the Tk toolkit?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/i0/.pyenv/versions/3.12.3/lib/python3.12/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
WARNING: The Python lzma extension was not compiled. Missing the lzma lib?
Installed Python-3.12.3 to /home/i0/.pyenv/versions/3.12.3
bad pyenv, count me out
oof
this issue is evil
we are going to have to use version specific code here
oh i am murdering someone tonight
they use a fucking is check on a singleton that isnt exposed in the imports
sounds like a great opportunity for you to make some prs to cpython and get yourself bragging rights with a profile repo pin LMAO
i dont think cpython is going to expose it
nah, but 1 merged pr will at least give you 15 mins of glory
fixed pyenv and installed, issue reproduces on my end 🎉
what im likely going to have to do is reproduce __call__
if you hated the words i said, good
i'll put it in my novel
#1658
• Pull Request Type: Bugfix
• Created: <t:1713379356:R>
On Python 3.12.3 onwards (specifically 3.12.3), a change to EnumType.__call__ messed up our own overriding of the same function at DistinctFlag.__call__, causing issues like those seen in #1657. This PR fixes that with version-specific code.
- Make
DistinctFlag.__call__use a separate branch of code for 3.12.3+.- This code is forced to recreate the entirety
EnumType.__call__due to a singleton that is not exported. This adds quite a burden to us, but hopefully it should be already. - Versions before 3.12.3 should still use the same code as previously.
- This code is forced to recreate the entirety
Fixes #1657.
[CODEBLOCK]
- ✅ I've ensured my code works on Python
3.10.x - ✅ I've ensured my code works on Python
3.12.3
- ✅ I've run the
pre-commitcode linter over all edited files - ✅ I've tested my changes on supported Python versions
- ❌ I've added tests for my code, if applicable
- ❌ I've updated / added documentation, where applicable
in the future we should absolutely rework this logic
yeah, i'll probably refactor the entirety of this code in the future
probably a better way to do this, but it's what came to mind.
Since we're just calling the super, rather than using version specific handing of the defaults in the function, let the super handle it
def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1) -> "DistinctFlag":
kwargs = {"names":names} if names else {}
try:
int_value = int(value)
return super().__call__(int_value, module=module, qualname=qualname, type=type, start=start, **kwargs)
except (TypeError, ValueError):
return _return_cursed_enum(cls, value)
well, we may actually want to use the names (why? i have no idea but still)
actually no way you just put it in kwargs
Oh, this is wild
i feel like that would cause issues
yeah it would
the inner functions not checking for a falsey, its specifically checking for a singleton
so that input would be treated like an actual name instead of being "empty"
if there's any issues, I couldn't see one in testing
by the depth of that was just
>>> import interactions
>>> interactions.Intents(0)
<Intents.NONE: 0>
>>> interactions.Intents(4)
<Intents.GUILD_MODERATION: 4>
>>> interactions.Intents(7)
<Intents.GUILD_MODERATION|GUILD_MEMBERS|GUILDS: 7>
>>> ^Z
on a different versions
even on 3.12.3?
oh right
okay i see
okay im dumb
yeah that would fix it
...i literally just left my pc though
if you open a pr i'll close mine
drafting it rn