I have a code for a discord bot that plays music in voice channels
and since youtube removed the dislike counter on video i get an error
nextcord.errors.ApplicationInvokeError: Command raised an exception: KeyError: 'dislike_count'
I tried to change the backend_youtube_dl.py file and it worked, but the thing is I am using Heroku to run the code and I can't change the file there
the code is quite large but this is the part causing the problem
async def play_song(self, interaction, link):
vid = pafy.new(link)
url = vid.getbestaudio().url
interaction.guild.voice_client.play(discord.PCMVolumeTransformer(discord.FFmpegPCMAudio(url)), after=lambda e: self.bot.loop.create_task(self.check_queue(interaction)))
Is there any other way to fix this?
pip install git+https://github.com/mps-youtube/pafy.git
Installs the latest Jul 17, 2021 version which doesn't have the issue you are mentioning, while using pip install pafy installs the Nov 22, 2019 version which has the issue you are mentioning.
Related
I get this console error when I try and run the play command.
The code I used is:
#client.command(pass_context=True)
async def play(ctx, url):
guild = ctx.message.guild
voice_client = guild.voice_client
player = await voice_client.create_ytdl_player(url)
players[server.id] = player
player.start()
I have made sure that discord.py, ffmpeg, and youtube_dl are all up to date and I get the same error.
Try to use codeblocks to represent code and errors next time, it'll be easier to view.
You might installed the wrong version of discord.py you need another version for voice clients!
Try reinstall using this pip command:
# Linux/macOS
python3 -m pip install -U "discord.py[voice]"
# Windows
py -3 -m pip install -U discord.py[voice]
I have installed python 3.8.5 and in ipython 7.19.0 via Anaconda installer on Windows 10 machine and I get the following error in Ipython when I import keras and then run ls or any other commands.
It happens when I import other commands or run other commands. Can anybody propose any solution? Is this to do with latest python or Ipython? Or something else.
C:\Users\AA>ipython
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from keras.models import load_model
2021-01-06 10:36:43.729592: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
In [2]: ls
Unhandled exception in event loop:
File "C:\ProgramData\Anaconda3\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
f.result() # may raise
File "C:\ProgramData\Anaconda3\lib\asyncio\windows_events.py", line 808, in _poll
value = callback(transferred, key, ov)
File "C:\ProgramData\Anaconda3\lib\asyncio\windows_events.py", line 457, in finish_recv
raise ConnectionResetError(*exc.args)
Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request
Press ENTER to continue...
It seems to be a bug in the ipython prompt toolkit (version >= 3)
Try doing this for your environment:
conda install prompt-toolkit~=2.0
Generally we can fix this by doing something like this:
py -m pip install -U prompt-toolkit~=2.0
If that does not seem to work, there is an extensive discussion of the bug here with a few other solutions: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1023#issue-534396318
(Discussed in this issue: https://github.com/jquast/blessed/issues/121)
According to this issue: https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1023
Upgrading python to at least 3.8.7 should fix this.
I am trying to follow the Django-autocomplete-light tutorial
However, when I try to run the test_project, I get the following error.
AttributeError: module 'dal.autocomplete' has no attribute
'Select2GenericForeignKeyModelField'
When I check the dal/autocomplete.py which was installed through pip command, I could not find any attribute Select2GenericForeignKeyModelField.
On the other hand, when I check the one in github, I could find this attribute.
I am guessing that the version which is in pip is older than the one in github.
Does anyone know how I can solve this problem?
The latest stable version is DAL 3.2.10, it was released at Aug 28, 2017 and Select2GenericForeignKeyModelField was added at Mar 30, 2018. It's not available even in pre-releases as the most recent pre-release now is 3.3.0rc6 released at Mar 6, 2018.
It seems you have to use older API or install DAL from Github:
pip install -U git+https://github.com/yourlabs/django-autocomplete-light#egg=django-autocomplete-light
UPDATE june 18:
I would like compiling my python code for windows.
I use to work with pyinstaller, python 3.5+, windows 7 and anaconda to control modules pandas, pyqt (v5) and pyqtgraph, but it seems something is not compatible. I would not be surprised if you tell me to change a version.
In previous versions, it worked with python 3.5, windows 7 and Pyinstaller 3.3.1- without pandas; the new version imports pandas and then this doesn’t work anymore:
with the usual config pyinstaller gives a message saying the C libraries are not built. Following the instructions, I should run python setup.py build_ext --inplace --force, except I don’t see the setup.py file, so I don’t know what to do. Forums tell me it should be a problem with pip but not with conda… but I use conda…
with python 3.6, I got an error message ‘RecursionError: maximum recursion depth exceeded’ (https://github.com/steph2016/profiles/blob/master/errorMessage). This problem seems known and solutions I found on forums is either to downgrade python or to replace my PyInstaller-3.3.1 by PyInstaller-3.4.dev0+7b3143612. But with PyInstaller-3.4.dev0+7b3143612 I get a ’’str’ object has no attribute ‘items’’ error (https://github.com/steph2016/profiles/blob/master/ErrorMessage2). I’m not sure pyinstaller is compatible with python 3.6…
with python 3.4, I got an error similar to the ‘str object’ one above. I’m not sure python3.4 is compatible with qt5…
I would be pleased by any solution with any version of whatever to windows-compile my code
I don't know if it is the issue but I didn't find PyQtGraph in Supported-Packages
I eventually applied the first solution proposed in No module named 'pandas._libs.tslibs.timedeltas' in PyInstaller in the original config (python 3.5, PyInstaller 3.3.1, pyqtgraph, pandas, windows 7,...) and it worked.
I don't know why adding def get_pandas_path ..... a.binaries) helps, so I can't justify. But just to be explicit even if it seems obvious: pyinstaller must be run on the spec file, not on the py one (for instance > pyinstaller toto.spec)
I am very much impressed with the spacy documentation but i am struggling to install it in my windows 7 32 bit os ... I have tried installing it from anaconda and pip ...
Also tried to install a wheel package of it from https://www.lfd.uci.edu/~gohlke/pythonlibs/ .... while installing the wheel file also i got unsupported message ...
cymem-1.31.2-cp27-cp27m-win32.whl
spacy-2.0.5-cp27-cp27m-win32_2.whl
murmurhash-0.28.0-cp27-cp27m-win32.whl
numpy-1.13.3+mkl-cp27-cp27m-win32_2.whl
thinc-6.10.2-cp27-cp27m-win32.whl
preshed-1.0.0-cp27-cp27m-win32.whl
Error which I got
spacy-2.0.5-cp27-cp27m-win32_2.whl is not a supported wheel on this platform.
Am trying for an working wheel for spacy is there any source or anyone could provide ??
Ya Found !! The error occured because spacy-2.0.5-cp27-cp27m-win32_2.whl file was renamed (since redownloaded so browser renamed it)
After changing it to spacy-2.0.5-cp27-cp27m-win32.whl it works ... Pip uses file name for platform verification ...
Thanks for ines , https://github.com/explosion/spaCy/issues/1741