Search code examples
pythonimportstanford-nlpfractions

Ipython from progressbar import ProgressBar Error


I want to do something according to this github code.

from progressbar import Progressbar, Fraction
ImportError: cannot import name 'Fraction'

I use ipython 2 or 3


Solution

  • The Github repo you linked to contains a file progressbar.py, which is an ancient (2006-era) version of progressbar. progressbar.py contains a Fraction class, while the progressbar module does not. So, you'll need to change your code to point to the progressbar.py file from the Standford NLP Github repo.