Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 BeautifulSoup Installed but not Found in Atom
#1
Hey everyone, I read a few other threads related to this, but was not able to solve my problem. I'm attempting to write a very simple web scraper in Atom using Python. I added python successfully to my computers Path directory (and checked that it is retrieved within the command line), created and activated a virtual environment within my project folder, and have checked within the command line that beautifulsoup is indeed installed AND upgraded (at least for the virtual environment, as far as I'm aware). However, when I try to run my code within the Atom application, I receive the following error:

Error:
Traceback (most recent call last): File "D:\A_ABlackOpalOps\WebScraperVersions\webScraperv1.py", line 1, in <module> from bs4 import BeautifulSoup ModuleNotFoundError: No module named 'bs4'
I tested a simple python script within Atom to simply print 'Hello' and it worked, so I'm unsure as to why Atom cannot find bs4. Here is my code for the webscraper:

from bs4 import BeautifulSoup
import requests

url = 'http://ethans_fake_twitter_site.surge.sh/'
response = requests.get(url, timeout=5)
content = BeautifulSoup(response.content, "html.parser")

print(content)
Thank you in advance.
Quote
#2
Maybe you have different python installations or Atom is using a virtual environment in which bs4 is not installed.
Quote
#3
(Jun-14-2019, 04:26 PM)ThomasL Wrote: Maybe you have different python installations or Atom is using a virtual environment in which bs4 is not installed.

Do you know how I can check if I have different python installations? I don't believe Atom is using a virtual environment. I only set up a single virtual environment within the project folder containing the files I'm building for the web scraping tool.

Thank you for the reply!
Quote
#4
Unfortunately i don´t use Atom so i can´t help with that.
Btw which OS are you using?
Quote
#5
(Jun-14-2019, 05:25 PM)wakegate Wrote: Do you know how I can check if I have different python installations
For windows as you use.
Command line cmd or better cmder:
E:\
λ python -V
Python 3.7.3

E:\
λ python -c "import sys;print(sys.executable)"
C:\python37\python.exe

E:\
λ pip -V
pip 19.1.1 from c:\python\lib\site-packages\pip (python 3.7)
In code:
import sys

print(sys.executable)
So as you see here python 3.7 is my main version in Windows environment Path.
It most natural that command line main version and Editor is set to same version.
Then can figure out how to use virtual environment and other version later.
Also py that get install,give easy access to other version.
λ py -3.6 -V
Python 3.6.4

E:\
λ py -3.4 -V
Python 3.4.2

E:\
λ py -2.7 -V
Python 2.7.9
Also look at VS Code from start,i did use Atom before but Vs Code dos a lot stuff better for Python.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)