0
votes

I am trying to write a script to get data from an internal website that exports to Excel, that data gets broken into smaller pieces and gets emailed to technicians. (metric data) I am trying to get into the website using robobrowser but I keep getting this:

C:\Users\user\AppData\Local\Programs\Python\Python36-32\Aging.py Traceback (most recent call last):

File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\Aging.py", line 3, in from robobrowser import RoboBrowser

File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\robobrowser-0.5.3-py3.6.egg\robobrowser__init__.py", line 3, in from .browser import RoboBrowser

File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\robobrowser-0.5.3-py3.6.egg\robobrowser\browser.py", line 7, in from bs4 import BeautifulSoup

File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4__init__.py", line 30, in from .builder import builder_registry, ParserRejectedMarkup

File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4\builder__init__.py", line 308, in from . import _htmlparser

File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4\builder_htmlparser.py", line 7, in from html.parser import ( ImportError: cannot import name 'HTMLParseError'

Here is the code:

import webbrowser
import re
from robobrowser import RoboBrowser

#Set BR module
br = RoboBrowser()

#open a website
br.open("https://www.whatever.com")

form = br.get_form()
form ['username'] = "username"
form ['password'] = "password"
br.submit_form(form)

Any help would be appreciated.

1
I'm not sure, if RoboBrowser comes with it, but I would assume that you need to install the package BeautifulSoup and Request by yourself. - tangoal

1 Answers

0
votes

You should try reinstalling RoboBrowser and BeautifulSoup. What's happening is that when you import robobrowser, RoboBrowser then tries to import BeautifulSoup (a python module) which then tries to import _htmlparser (a python module that is part of the BeautifulSoup package), but it can't find that file and the load fails.

This is most likely caused by a missing or corrupted file (or maybe an out of date version). If you reinstall BeautifulSoup (and probably robobrowser to be safe) it should fix the problem.