I searched some solution for this error code and I realized that this error's meaning requires rechecking in spelling and I retry to install module 'beautifulsoup'.
The error:
name 'BeautifulSoup' is not defined error
Frankly I don't have any idea for this error I think there is no error in code.
from bs4 import BeautifulSoup
from urllib.request import urlopen
url="http://finance.naver.com/marketindex"
page=urlopen(url)
soup=BeatifulSoup(page,"html.parser")
Just check whether your installation is not complete or not. To use beautiful soup, you need to install it:
$ pip install beautifulsoup4
Then you can use as the following
from bs4 import BeautifulSoup4
Note: You were doing
from bs4 import BeautifulSoup
which will not work as it is not correctly formatted.
Related
I have installed pydea in google colab using pip method.
Now when I am importing pydea as dea, it gives an error.
it says- 'No module named pydea'
The module to import is pyDEA, not pydea.
Try this:
first, do: !pip install pydea
and then: import pyDEA
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
Having some trouble importing the Binance package into python. Specifically, I can't run the following lines:
from binance.client import Client
from binance.enums import *
When I install binance into my environment using this link [pip install python-binance], The code gets hung up on line one at >> from binance.client import Client. The import error I get is the following:
ImportError: dlopen(/Users/name/.local/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so, 2): no suitable image found. Did find:
/Users/name/.local/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so: mach-o, but wrong architecture
/Users/name/.local/lib/python3.9/site-packages/regex/_regex.cpython-39-darwin.so: mach-o, but wrong architecture
Admittedly I'm not an expert in managing envs so any help would be greatly appreciated!
Cheers
I've installed gensim, however I keep getting an error when I try to import it
from gensim.models import Word2Vec
ImportError: cannot import name 'open'
I'm using the updated version of gensim 3.8.0 and smart_open 2.1.0.
I have reinstalled several times but still can't get it to work.
I also have the same problem, after that I found a solution:
pip install --upgrade gensim
You can install first , then you can import:
import gensim.downloader as gensim_api
import gensim
Works for Mac.
I'm running Python 2.7 on windows and I've installed the pywin extension here.
Having done so, if I launch a normal python shell, I can import win32api perfectly.
If I do the same on IPython, I get this :
In [1]: import win32api
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
C:\Windows\system32\<ipython console> in <module>()
ImportError: DLL load failed: The specified module could not be found.
In [2]:
Why would it work in a normal python shell, but not IPython?
I had the same issue, and found a solution for my problem here. Apparently it's a conflict between pythoncom24.dll and pywintypes24.dll.
Look in your root Python install folder. If you find these two DLLs there, move them to \Python24\Lib\site-packages\win32 instead. This should fix your import conflict.
Alternately, you can control the imports explicitly. Add the following to your script in this order:
import pywintypes
import pythoncom
import win32api