1

I got problems while converting. I tryed: Auto py to exe - gui - I added chromedriver(1 file) || whole folder(site-packages\chromedriver_binary) I created .spec file and wrote there:

a = Analysis(['tk.py'],
binaries=[],
datas=[("chromedriver.exe",".")])

But got some errors:

File "c:\python36_32\lib\site-packages\PyInstaller\building\buildne 782, in build with open(spec, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: 'tkk.spec'

I have got .spec, chromedriver and python script in same folder.

When i'm run exe on Windows 7 i got something like it: https://gyazo.com/0152ca0998e2e0895ff91c9cfb7db0c2 I have got no clue how to stop view of console to read error

Can you tell what's I'm doing wrong?

Andersson
  • 51,635
  • 17
  • 77
  • 129
R.Pitagram
  • 31
  • 7

1 Answers1

0

One way to preserve this error is to run tk.exe through the command prompt / terminal. On Windows this can be done by opening cmd, changing your directory to the location of tk.exe and executing ./tk.exe which will run the executable and preserve the output for you to see.

From what I can see (it's not clear), you are getting a FileNotFoundError saying "Nie mozna odnalezc okreslonego pliku" which I believe is The specified file can not be found in English. Below this, selenium has raised an error saying that chromedriver.exe cannot be found.

Looking at the video you provided, it looks like you used onefile mode. If you did some research on bundling files with PyInstaller's --onefile then you would know that you will need to tell selenium specifically where chromedriver.exe is.

I have not done this myself but I believe the process would look something like:

    from selenium import webdriver
    options = webdriver.ChromeOptions()
    options.binary_location = resource_path('.')
    driver = webdriver.Chrome(chrome_options=options)

Of course this won't be everything but this is telling selenium to look at the scripts temporary directory (due to --onefile) for chromedriver.exe

Also as a quick note, you said you used auto-py-to-exe. When using this tool, it tells you explicitly to take this into consideration when adding files and using --onefile.

Brent Vollebregt
  • 149
  • 2
  • 10