from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext
bot = Client(intents=Intents.default())
slash = SlashCommand(bot)
#slash.slash(name="test")
async def test(ctx: SlashContext):
embed = Embed(title="Embed Test")
await ctx.send(embed=embed)
bot.run("discord_token")
i'm using discord_slash.
but it error everytime
line 2, in <module>
from discord_slash import SlashCommand, SlashContext
ModuleNotFoundError: No module named 'discord_slash'
i installed discord-py-interactions
how to fix this ;(
Discord.py has been deprecated due to the new update of v13
Discord developers are still working on the libraries, so hold on!
Install discord-py-slash-command:
pip install discord-py-slash-command
Try
pip3 install discord_slash
Related
Hey I was trying to edit a telegram bot, but this error keeps coming:
import telegram.ext ModuleNotFoundError: No module named 'telegram.ext'; 'telegram' is not a package.
My code is like this:-
import telegram.ext
with open('token.txt', 'r') as f:
TOKEN = f.read()
def start(update, context):
update.message.reply_text("Helllo")
updater = telegram.ext.Updater(TOKEN, use_context=True)
disp = updater.dispatcher
any help will be appreciated
I've tried reinstalling python-telegram-bot.
Probably you've installed a wrong telegram package, too. Some IDEs install packages automatically and they install telegram instead of python-telegram-bot.
You should find the wrong installed package and uninstall it.
Figure out what package is imported on import telegram.ext, you can find it in the error description. Then you should uninstall it, using a command like this:
pip uninstall telegam
Then install python-telegram-bot if it is not installed:
pip install python-telegram-bot
Hello there I'm currently making a discord bot in python and i get these errors : Click to see photo
import coloredlogs, logging
import discord
from discord.ext import commands
from motor.motor_asyncio import AsyncIOMotorClient
Here is the error when i run python bot.py :
Traceback (most recent call last):
File "C:\Users\%user%\Desktop\Omicron-Entetie\bot.py", line 4, in <module>
import coloredlogs, logging
File "C:\Users\%user%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\coloredlogs\__init__.py", line 212, in <module>
from humanfriendly.compat import coerce_string, is_string, on_windows
ImportError: cannot import name 'on_windows' from 'humanfriendly.compat' (C:\Users\%user%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\humanfriendly\compat.py)
I suggest you try to check if the add-ons are actually installed. Open the command prompt and type "pip install (addon)"
If that doesn't work and the command prompt gives you an error try with: py -m pip install (whatever you need to install).
If that doesn't work either, make sure you have imported all of the add-ons.
I´m having this problem:
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice
This is my code:
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = '.')
#client.event
async def on_ready():
print('Pronto!')
#client.command()
async def join(ctx):
channel = ctx.author.voice.channel
await channel.connect()
#client.command()
async def leave(ctx):
await ctx.voice_client.disconnect()
client.run(TOKEN)
But I have PyNaCl installed what should I do?
You need to install the voice version of discord.py
We do this by doing the following,
pip install discord.py[voice]
This will install discord.py voice edition, which has all needed packages and how they should come :)
I tried to install PyQt5 on Mac (10.12.4 sierra) with pip3 but so far, no success. I saw several answers here on SO, but non helped me. After some different attempts I deleted python3 completely and did a fresh install (downloaded the installer from https://www.python.org/downloads/mac-osx/).
After python3 was working again, I ran pip3 install PyQt5, which finished successfully, but it is still not working.
I'm testing with this script:
import sys
from PyQt5.QTWidgets import QApplication, QWidget
def window():
app = QApplication(sys.argv)
w = QWidget()
w.show()
sys.exit(app.exec_())
window()
and the error message is always
Traceback (most recent call last):
File "MyTestGui.py", line 2, in <module>
from PyQt5.QTWidgets import QApplication, QWidget
ModuleNotFoundError: No module named 'PyQt5.QTWidgets'
I assume, that I either forgot something, or that my old python installation is not fully removed and still in the way...
Edit:
1) Before, I tried the installation via Homebrew, but I had the same problem.
2) Here my pip3 list:
pip (9.0.1)
PyQt5 (5.8.2)
setuptools (28.8.0)
sip (4.19.2)
3) Is there any way to test intermediate steps to understand better, at which step the installation is failing?
You will find that the correct package is PyQt5.QtWidgets and not PyQt5.QTWidgets.
This can be seen by doing a help(PyQt5) after importing it.
I´m using PyQt4 with Mac Yosemite 10.10.5. and Python 2.7. When I try to run a simple script using sublime text I get
´ImportError: cannot import name QtGui.
However when I go into python through the terminal and enter the following line, it seems to accept it.
>>> from PyQt4 import QtGui
>>>
The script I´m trying to run in Sublime Text is:
import sys
from PyQt4 import QtGui
def main():
app = QtGui.QApplication(sys.argv)
w = QtGui.QWidget()
w.resize(250, 150)
w.move(300, 300)
w.setWindowTitle('Simple')
w.show()
sys.exit(app.exec_())
if __name__ == '__main__':
Main()
My Pyqt4 path is at /Library/Python/2.7/site-packages.
My sys-path output is:
['', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Users/cameronmacintyre/Library/Python/2.7/lib/python/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
I installed using sip and PyQt4 was installed with the following:
python configure.py -q /usr/bin/qmake-4.8 -d /Library/
Python/2.7/site-packages/ --use-arch x86_64
•
make
•
sudo make instal
I´ve searched other similar problems for days and can´t find a solution. I´m a bit of a newbie to this, so any help would be appreciated.
ps I did have Python 3 installed for a while but I removed it.