Discord.py uses opus, but I didn't find how to install it.How can I do it?
This method doesn't work https://github.com/discordrb/discordrb/wiki/Installing-libopus
(or I am stupid)
Opus should be installed but not been loaded.
For this just put in your script:
if not discord.opus.is_loaded():
discord.opus.load_opus(opuspath)
discord.opus.is_loaded() now should return True
Related
So I was trying to use a ttk theme named "Sun Vally" (Link) But when I tried to use it, it gave an error of "ModuleNotFoundError: No module named 'sv_ttk'" even though I already have pip installed it.. I am still new to all this.. thanks in advance!
For starters, try running the command pip list in your terminal. Does the module sv_ttk 1.0 appear in the list? If not, you may need to try running pip install sv-ttk again. This also assumes you aren't using a Python virtual environment, but I imagine you aren't.
You may also want to check if the module is properly installing into your site packages directory (the location of which is platform dependent). Are you on Mac OS or Windows?
Please update this question with a minimal example of what you've already tried so we can help you further.
IF FIGURED IT OUT! I was using cmd to install pip but never realized I needed to use a different terminal... Turns out PyCharm has its own terminal and wont work if you used a different one...
I am trying to get the download and upload speed in python by using the "speedtest" module, but it gives me that error when I use the module:
AttributeError: module 'speedtest' has no attribute 'Speedtest'.
and I was only declaring the variable,
that is my code :
import speedtest
speedtester = speedtest.Speedtest()
The module actually doesn't have the functions for some reason.
Please tell me what is wrong with my code I was sure to import the module from the cmd and also the pycharm terminal and still got the same error.
Thanks in advance
I had the same issue. I was using PyCharm IDE.
The issue occurs when you install speedtest using pip install speedtest
In order to solve the above mentioned issue, you need to use the following command.
pip install speedtest-cli
But before doing this, uninstall the previous one by using pip uninstall speedtest
Screenshot to installation
I was getting the same error. Then I google the problem and eventually came here. Later I realised that I have named my python file speedtest.py. I renamed it to something else (which is not the name of any python module) and it works just fine now.
<--Screenshot-->
So make sure this case.
If you installed "speedtest" and "speedtest-cli" libraries together then this issue will arise.
So first uninstall "speedtest" library using "pip uninstall speedtest" command.
Then try your code like :
"import speedtest
st = speedtest.Speedtest()
print(st.download()/1024)"
You will get output
i was also facing the same issue , what i have done is :
i have uninstall the speedtest and speedtest-cli
pip uninstall speedtest
pip uninstall speedtest-cli
then again install speedtest-cli
pip install speedtest-cli
The issue got solved after moving the speedtest.py file to the same directory as my script and it worked just fine. So just make sure the file is in the same folder as your python script.
Bumped into the issue and investigated the content of the module...
It appears what inside my venv folder I got a module folder "speedtest" with EMPTY init.py file and that is it...
Next to the folder was speedtest.py with actual code...
So deleting the empty folder/module helped me...
You should uninstall before speedtest whit the command 'pip uninstall speedtest' . After that, this use this code to find download and upload, speeds and ping:
import speedtest
test = speedtest.Speedtest()
print("Loading server list...")
test.get_servers()
print("Choosing best server...")
best = test.get_best_server()
print(f"Found: {best['host']} located in {best['country']}")
print("Performing download test...")
download_result = test.download()
print("Performing upload test...")
upload_result = test.upload()
ping_result = test.results.ping
print(f"Download speed: {download_result / 1024 / 1024:.2f}Mbit/s")
print(f"Upload speed: {upload_result / 1024 / 1024:.2f}Mbit/s")
print(f"Ping: {ping_result}ms")
I was facing the same problem,but main problem might be you are installing speedtest library which is not suitable instead use pip install speedtest-cli but before that remember to delete the previous one using pip uninstall speedtest and check the spelling of get_servers which is in the plural form
I want to write a telegram bot via Python, but it doesn't work.
import telebot
bot = telebot.TeleBot("my_token")
#bot.message_handler(content_types=['text'])
def sending(message):
bot.send_message(message.chat.id, message.text)
# RUN
bot.polling(non_stop=True)
Returns to me the following problem.
AttributeError: 'TeleBot' object has no attribute 'message_handler'
This is a common issue, unfortunately. I guess you installed the lib as "pip install telebot", which leads to another package. You need to uninstall telebot, install pytelegrambotapi, but leave "import telebot" in code.
Try this one. At first write:
pip3 uninstall telebot
After you do it write:
pip3 uninstall PyTelegramBotAPI
And the last step:
pip3 install PyTelegramBotAPI==2.2.3
It worked for me, I'm working on debian 9. So if you are working on Debian or on linux, it should work for you.
As the source code shows (assuming you import the module obtained from pip, that is this), there is no definition for message_handler. In which case you need to use #bot.route which takes a string as argument as shown in the example within the repository readme (second link or here).
Example:
#bot.route('/command ?(.*)')
def sending(message, cmd):
bot.send_message(something, something_else)
I am working on a project which has SUMOLIB module as a dependency on , but I have no idea how to install it. I tried doing pip install sumolib, but it shows me that no such module exists.
Can someone tell me how to install SUMOLIB?
Maybe look at the downloads page of Sumolib.
https://sumo.dlr.de/docs/Downloads.html
sumolib is installed as a part of the SUMO package. It can be found under SUMO_HOME/tools/sumolib.
To use sumolib in a script, check here.
I found this script (tutorial) on GitHub (https://github.com/amyoshino/Dash_Tutorial_Series/blob/master/ex4.py) and I am trying to run in my local machine.
Unfortunately I am having and Error
I would really appreciate if anyone can help me to run this script.
Perhaps this is something easy but I am new in coding.
Thank you!
You probably just need to pip install the dash-core-components library!
Take a look at the Dash Installation documentation. It currently recommends running these commands:
pip install dash==0.38.0 # The core dash backend
pip install dash-html-components==0.13.5 # HTML components
pip install dash-core-components==0.43.1 # Supercharged components
pip install dash-table==3.5.0 # Interactive DataTable component (new!)
pip install dash-daq==0.1.0 # DAQ components (newly open-sourced!)
For more info on using pip to install Python packages, see: Installing Packages.
If you have run those commands, and Flask still throws that error, you may be having a path/environment issue, and should provide more info in your question about your Python setup.
Also, just to give you a sense of how to interpret this error message:
It's often easiest to start at the bottom and work your way up.
Here, the bottommost message is a FileNotFound error.
The program is looking for the file in your Python37/lib/site-packages folder. That tells you it's looking for a Python package. That is the directory to which Python packages get installed when you use a tool like pip.