4

From Beautiful import Beautiful immediately responds with error "from: can't read /var/mail/BeautifulSoup". Also tried with BS4 same result. Used synaptic package to uninstall and re-install BS4 and BeautifulSoup. Same result. Tried complete removal and had same result. Used Terminal and it showed that BS4 and BeautifulSoup are not installed.

Using Python 2.7.6

Reviewed questions but only 2 respones and they did not help.

Any suggestions?

Yankee26
  • 73
  • 1
  • 5

3 Answers3

9

I ran into this error because I forgot to add a shebang statement to my python script. Just add this to the top of your script:

#!/usr/bin/python
infosecDaemon
  • 603
  • 5
  • 7
1

The way to run a Python program is to type the code into a text file, or use a Python IDE. The error message you are getting suggests that you are typing Python code at the shell prompt; but the shell understanda shell script commands, not Python. (Once you have code in a file, typing python filename.py in the shell will run the Python code in the file filename.py.)

tripleee
  • 175,061
  • 34
  • 275
  • 318
0

To import BeautifulSoup you are going to need an import statement like this:

from bs4 import BeautifulSoup

Note that you must have BeautifulSoup installed before through pip. In your command line write:

pip install beautifulsoup4
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Nhor
  • 3,860
  • 6
  • 28
  • 41