AdarshVShetty
AdarshVShetty

Reputation: 33

Include poppler while generating an application using pyinstaller

I am using poppler to read pdfs

Poppler folder is located with my source file as shown below. Code below:

    pages = convert_from_path(pdf_file,500,poppler_path = r'.\\poppler\\bin',
                              first_page=pageNo[0],last_page =pageNo[len(pageNo)-1] )

I want to generate the exe for my python application using pyinstaller. However i include them in pyinstaller command.It doesnt seem to work.

I get the below error: Exception Unable to get page count. Is poppler installed and in PATH? occurred while creating the DB dataframes

Below are the ways i have tried to include the poppler in my pyinstaller command:

pyinstaller --noconfirm --onefile --windowed --add-data --add-data "C:/Users/projectPath/poppler/*;./poppler" "C:/Users/projectPath/AutoUpdate.py"

pyinstaller --noconfirm --onefile --windowed --add-data --add-data "C:/Users/projectPath/poppler;./poppler" "C:/Users/projectPath/AutoUpdate.py"

pyinstaller --noconfirm --onefile --windowed --add-data --add-data "C:/Users/projectPath/poppler;poppler/" "C:/Users/projectPath/AutoUpdate.py"

Upvotes: 1

Views: 697

Answers (1)

AdarshVShetty
AdarshVShetty

Reputation: 33

Started using onedir approach instead of onefile.Works fine now.

Below is the updated pyinstaller command:

pyinstaller --noconfirm --onedir --windowed --add-data --add-data "C:/Users/projectPath/poppler/*;./poppler" "C:/Users/projectPath/AutoUpdate.py"

Upvotes: 0

Related Questions