1

I have never made an executable application before but from what I have read its pretty easy, using py2exe to generate the exe. But I have a GUI that uses Selenium to scrape data from a backend (No I can not use API calls). How do I add chromedriver to the executable? Also, would all the imports go along when using a compiler?

Hugo Iriarte
  • 65
  • 1
  • 8

2 Answers2

0

When you compile a .py file into an .exe (from my personal experience) all of the imports are included.

I would personally suggest using pyinstaller. I had quite a few problems using py2exe and as a beginner I found pyinstaller much more user-friendly and easier to troubleshoot.

As compiling a file does not alter the .py file, I would suggest getting it to a fully working state and trying it. If it doesn't appear to work or if some of the imports are lost, we can troubleshoot with the error code.

visualnotsobasic
  • 428
  • 3
  • 17
  • Thanks for this! Was very easy to make to an exe and works perfect on my computer. But when testing on another computer got 2 errors, Tkinter filenotfound error, and chromedriver executable needs to be in path. – Hugo Iriarte Jan 31 '19 at 22:51
  • Hmmm, interesting. How large is the program? – visualnotsobasic Feb 01 '19 at 15:21
0

You can also use cx_Freeze to create an executable from your python script.

You can install cx_Freeze by issuing the command

python -m pip install cx_Freeze --upgrade

in a cmd prompt / terminal.

As far as tkinter is concerned, you'll find a working example of how to freeze a tkinter-based application with the current version of cx_Freeze in this answer. In the setup.py script you find there, you need to replace the name of the Executable by the name of your main script. Place this setup.pyin the same directory than your main script and run

python setup.py build

from a cmd prompt / terminal.

As far as chromedriver is concerned, I've no experience, if you choose this approach and still have problems, please add the exact error message and a Minimal, Complete, and Verifiable example to your question.

jpeg
  • 2,372
  • 4
  • 18
  • 31