1

I am very new to Python and have used BeautifulSoup to parse and scrape information from some webpages. Now I need to fill out a form. submit it, and scrape some data after filling in the form, and it seems the easiest way is to use robobrowser.

However, I can't import robobrowser. I have installed robobrowser several different ways and robobrowser is located here:

C:\Users\(USERNAME)\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

Here is my script:

import requests

from bs4 import BeautifulSoup

import datetime

import webbrowser

import re

from robobrowser import RoboBrowser

br = RoboBrowser()

etc....

The problem is the script will not run past "from robobrowser import RoboBrowser" and I get the following message:

ImportError: cannot import name 'RoboBrowser' from 'robobrowser'
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
SergeNYC
  • 77
  • 11

1 Answers1

1

Maybe your robobrowser package is corrupted

Now try Installing robobrowser using PyPI

first check if python package named as PyPI is installed on your system using this command in your terminal

pip --version

if it is installed then it will show the output like that

image showing the message if Pip is installed

To install robobrowser using PyPI run this command in your terminal

pip install robobrowser

now import it

from robobrowser import RoboBrowser
br = RoboBrowser()
Ahwar
  • 1,746
  • 16
  • 30
  • Thank you very much Ahwar, I tried to re-install pip but it was installed already, so I upgraded it then re-installed it. Then I tried to install robobrowser, but it keep saying it's already satisfied. I ran the script again and kept getting the same error. Is there another method I can use besides robobrowser? I was thinking of Scrapy or Selenium, but those seem more advanced for my level. Thank you again. – SergeNYC Oct 27 '19 at 18:04
  • Your import error says that it can't import specific function from the package 'robobrowser' it means that your package is successfully installed but the issue is in importing that specific RoboBrowser() function or class please tell us specifically in detail what you want to do with RoboBrowser – Ahwar Oct 28 '19 at 01:29
  • I want robobrowser to open a webpage, then I want to submit_form to enter information in a search bar, then click the search button to search for what I entered into the form – SergeNYC Oct 28 '19 at 02:00
  • Serge! i have no experience in robobrowser But Open this link https://colab.research.google.com/drive/1t2f2koZeiiiY-xbEr1aAcq-r1Qk7DF-c In this link robobrowser is working you can try whatever you want here This is [Google Colab](https://colab.research.google.com) You need google acocunt to run Python Programs online with it. If you don't know how to use this [Google Colab](https://colab.research.google.com) you can follow this tutorial: https://colab.research.google.com/notebooks/welcome.ipynb – Ahwar Oct 28 '19 at 04:23