valueerror: mutable default <class 'discord.utils._missingsentinel'> for field name is not allowed: use default_factory when imporint discord.ext - discord.py

I am trying to make a discord bot, but I can't use discord.ext, I have the error in the title and I can't fix it.
valueerror: mutable default <class 'discord.utils._missingsentinel'> for field name is not allowed: use default_factory
here is what I tried:
Not importing the discord.py library
Reinstalling discord.py library

I uninstalled discord.py then installed it on version 2.0 then installed version 2.1.0 then it worked, tbh I don't know why

Related

TypeError: Updater.__init__() got an unexpected keyword argument 'use_context'

It occurred when I perform this :
updater = Updater('5502935975:AAGcE8wtPOUMXVCOI3PXr0fygpXsdaEn-HI', use_context=True)
Many Thanks!
You should revoke the token that you just posted. Also double check which version of python-telegram-bot you are using and followng the resources that PTB provides for that version.
Disclaimer: I'm currently the maintainer of python-telegram-bot.
"Down grade" or "upgrade" the python-telegram-bot to the relevant version , e.g i downgraded by using "pip install python-telegram-bot==13.7" from the lastest python-telegram-bot 20.0 version, and it worked for me,
NOTE: my version might be different from yours so use the right version that wont call the error

Cant use the module 'DynamicFactorMQ'

I get the error:
AttributeError: module 'statsmodels.tsa.api' has no attribute 'DynamicFactorMQ'
model = sm.tsa.DynamicFactorMQ(
endog_m, endog_quarterly=endog_q,
factors=factors, factor_orders=factor_orders,
factor_multiplicities=factor_multiplicities)
This error is most likely coming up because you have an older version of Statsmodels installed. DynamicFactorMQ was introduced in version 0.12, so you should make sure that you're using a new enough version. You can check using:
import statsmodels.api as sm
print(sm.__version__)

pythonAnywhere AttributeError : module 'pytube' has no attribute 'YouTube'

I am making a project with Django and pytube in python 3.6, but when I run the code below in my python anywhere project, I get this error:
AttributeError : module 'pytube' has no attribute 'YouTube'.
import pytube
url = input()
yt = pytube.YouTube(url)
This probably is because there are multiple packages named pytube, and I think that I installed the wrong one. Which one do I have to install? And should I than use pip or pip3?
I already tried uninstalling pytube and reinstalling (also via the GitHub link which you can find from other people who are having issues with this: git+https://github.com/nficano/pytube.git)

pypiwin32 alternatives for Mac

Is there an alternative for pypiwin32 on Mac?
I'm doing a tutorial on how to create a chatbot, however I keep getting an import error. I was given advice to install pypiwin32 but soon realized it only works for windows and not on osx. Below is the code for the chatbot where I get the import error on.
import speech_recognition as sr
import pyttsx3
try:
engine = pyttsx3.init()
except ImportError:
print("Requested driver is not found")
except RuntimeError:
print("Driver failed to initialize")
voices = engine.getProperty('voices')
for voice in voices:
print(voice.id)
I don't think there is an alternative to pypiwin32 for OSX, maybe you can share what your error is so we can help you that way?
Not an answer but I can't comment yet...
If you are running it on mac OSX, you need to additionally install:
pip install pyobjc
it will work. I had tried the following:
import pyttsx3
engine = pyttsx3.init('nsss')
voices = engine.getProperty('voices')
after installing pyobj and it is working now :)

import tensorflow SyntaxError: invalid syntax

Using Virtualenv on Mac I have encountered the showing SyntaxError when I
import tensorflow
I tried many times uninstall but now working... please help me!
Tensorflow is not supported on Python 3.7. You'll need to use python3.6 or earlier.
async which was fine as a variable name in earlier versions of Python, is a keyword in Python 3.7. This is why it is failing to import.

Resources