0

Running the script gives this unexpected token error and beautifulsoup error. I've looked at a LOT of guides and none seem to work. This would suggest a problem with my python setup rather than requests or BS. I've just run apt-get remove python and get-get remove python-pip, then reinstalled both.

Anyway, the output errors:

$./test.py
import-im6.q16: not authorized `urllib3' @ error/constitute.c/WriteImage/1037.
from: can't read /var/mail/bs4
./test.py: line 3: syntax error near unexpected token `('
./test.py: line 3: `http = urllib3.PoolManager()'
import urllib3
from bs4 import BeautifulSoup
http = urllib3.PoolManager()
r = http.request('GET', 'http://dustyfeet.com')
soup = BeautifulSoup(r.data, 'lxml')
print (soup.title)
print (soup.title.text)
Ivan Vinogradov
  • 4,269
  • 6
  • 29
  • 39
leopheard
  • 101
  • 7

1 Answers1

1

Are you sure python is executing this file?
Try running it with $ python ./test.py instead of $ ./test.py to ensure that your script is not being executed by the default shell.

jchung
  • 903
  • 1
  • 11
  • 23