#๐Ÿ”’ It was working before, I changed nothing!

77 messages ยท Page 1 of 1 (latest)

marble vortex
#

It was working fine, then I decided to restart it, when I tried to restart it I couldn't run it again and it gave me this error:

Traceback (most recent call last):
File "C:\Users\valte\OneDrive\Skrivbord\test\main.py", line 12, in <module>
from discord.ui import InputText
ImportError: cannot import name 'InputText' from 'discord.ui' (C:\Users\valte\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ui_init_.py)

C:\Users\valte\OneDrive\Skrivbord\test>

earnest novaBOT
#

@marble vortex

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

magic wolf
#

Please provide your code

marble vortex
magic wolf
#

Also looks to be a package import error - are you using discordpy?

marble vortex
#

I've installed it, updated it, tried to reinstall it, etc.

magic wolf
#

when you run python --version what's the output?

marble vortex
#

Python 3.12.3 on my RDP

#

Python 3.10.11 on my main PC

#

It's not working on either

magic wolf
#

try python -m pip install -U discord.py

steel totem
#

there's nothing as InputText inside discord.ui

marble vortex
steel totem
#

hmm time to go to docs

earnest novaBOT
magic wolf
#

ah lol

#

you're using pycord code

#

not discordpy

#

they use the same package name import, but are not the same library

steel totem
#

that could be the issue

magic wolf
#

do python -m pip uninstall discord.py followed by python -m pip install -U py-cord

#

that'll fix it salute

marble vortex
#

That changed the error lolhdman

marble vortex
magic wolf
#

you appear to be using multiple different incompatable libraries

steel totem
#

can you run pip freeze and show the output

marble vortex
#

C:\Users\Administrator\Desktop\Boost Bot\DaDixi>pip freeze
aiohttp==3.9.5
aiosignal==1.3.1
anyio==4.3.0
attrs==23.2.0
blinker==1.8.2
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
discord-ui==5.1.6
Flask==3.0.3
frozenlist==1.4.1
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
idna==3.7
itsdangerous==2.2.0
Jinja2==3.1.4
keyauth==1.0.3
MarkupSafe==2.1.5
multidict==6.0.5
py-cord==2.5.0
pycryptodome==3.20.0
pytz==2024.1
pywin32==306
requests==2.31.0
sniffio==1.3.1
tls-client==1.0.1
typing==3.7.4.3
typing_extensions==4.11.0
urllib3==2.2.1
Werkzeug==3.0.3
yarl==1.9.4

C:\Users\Administrator\Desktop\Boost Bot\DaDixi>

magic wolf
#

discord-ui and py-cord at the same time while trying to develop with discord.py

#

this is... an interesting issue

marble vortex
#

let me give you the start of this code

#
import os
os.system("pip install py-cord flask httpx tls_client typing requests")
import discord
from discord.interactions import Interaction
from discord.ui import button
import json, httpx, tls_client, threading, time, random, hashlib, sys, os
from discord.ui.item import Item
from flask import request, Flask, jsonify
from discord.ui import Modal, InputText
import typing
from keyauth import api```
magic wolf
#

w...

#

why are you installing packagaes at run time

#

why are you installing standard lib packages ๐Ÿ˜ญ

marble vortex
#

I'm taking inspiration from it

#

Trying it, seeing what works.

magic wolf
#

i uh, strongly advice you don't take further inspiration from this code

marble vortex
#

What do I do in this case then? This seems like it's going horrible.

marble vortex
#

Let's try to start it at least, It was working.

magic wolf
#

what are you trying to make

steel totem
#

from discord.interactions import Interaction this change to from discord import Interactions

magic wolf
marble vortex
#

Holy

magic wolf
#

๐Ÿ˜…

marble vortex
steel totem
#

๐Ÿ’€

marble vortex
#

Doesn't seem to be going that great is it

steel totem
#

oh wait remove the s

marble vortex
# steel totem oh wait remove the ``s``

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Boost Bot\DaDixi\main.py", line 4, in <module>
from discord import Interaction
ImportError: cannot import name 'Interaction' from 'discord' (unknown location)

steel totem
#

tf

#

!d discord.Interaction

earnest novaBOT
#

class discord.Interaction```
Represents a Discord interaction.

An interaction happens when a user does an action that needs to be notified. Current examples are slash commands and components.

New in version 2.0.
steel totem
#

it's the same for both py-cord and dpy

marble vortex
#

I have 0 idea what has changed since I last used it, I haven't changed anything and I even went back to a earlier version, which is the EXACT one that was working before.

magic wolf
#

welcome to programming

steel totem
#

and when was the last time you started it?

marble vortex
magic wolf
#

developers would like you to believe that computers are exact calculating machines that are infallible but they are not

marble vortex
steel totem
#

as far as i can say you might need to rewrite the code my doubt lies with that discord-ui lib you have since the latest wrappers have in-built ui kit

marble vortex
steel totem
#

can't be sure then what's causing the issue

marble vortex
earnest novaBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.