Import error using pdftotext - symbol not found in flat namespace

Viewed 53

I have an issue running a python script. I'm running the latest version of MacOS with python 2.7.

I've tried downgrading my modules, python version, and pip version which hasn't done anything. I tried uninstalling pdftotext and updating it. I have poppler installed via homebrew on the latest version. Nothing I'm doing is working and I think I'm looking in the wrong direction.

  File "run.py", line 4, in <module>
    import controllers
  File ".../controllers.py", line 33, in <module>
    import common.parser as parser
  File ".../parser.py", line 36, in <module>
    from common.parse.coned import get_building_coned_data, get_coned_reports_list
  File ".../coned.py", line 17, in <module>
    from common.coned.bill_scraper import RE_TOTAL_CHARGES_TYPE
  File ".../scraper.py", line 6, in <module>
    import pdftotext
ImportError: dlopen(.../env/lib/python2.7/site-packages/pdftotext.so, 0x0002): symbol not found in flat namespace (__ZN7poppler24set_debug_error_functionEPFvRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPvES9_)




1 Answers

You need to install poppler-utils. poppler-utils are precompiled command-line utilities (based on Poppler) for manipulating PDF files and converting them to other formats. poppler-utils is available for Python 3.x only, so you will need to update your Python script to be compatible with Python 3.x.

To install poppler-utils run the following commands:

brew install poppler
brew install --cask pdftotext
python3 -m pip install poppler-utils
Related