-1

I'm trying to make an exe file that uses the phantomjs exe and the chromedriver exe files in it and will have those files included in the python exe I'm making with PyInstaller. I'm not sure if the problem is that PyInstaller isn't adding the exes to the single exe being made or that the location of them isn't correct in the python file that uses them within the exe.

Here's the code for the bat file that makes the python exe:

    pyinstaller --noconfirm --log-level=WARN ^
        --onefile --nowindow ^
        --add-data="chromedriver.exe;."^
        --add-data="phantomjs.exe;." ^
        Grade_Submitter.py

Here's the code that is supposed to get the phantomjs exe in the main exe file

    driver = webdriver.PhantomJS("/phantomjs.exe")

I appreciate the help. I believe the main problem is accessing the files in the exe and my program not looking outside of the exe for the files. However, I'm not quite sure how to get it to retrieve the files from the exe. My program works if the files are in the same folder outside of the exe, but I need it to get everything working with only one file and not multiple.

Kyle Henry
  • 15
  • 1
  • 7
  • windows (.exe) uses \ (backslash) not / (forward slash), besides that you would be telling the code to look in the main OS roots directory! You want ` driver = webdriver.PhantomJS("phantomjs.exe")` if it's in the same directory or even use the full path? – Jamie Lindsey Nov 11 '18 at 09:55
  • Possible duplicate of [Bundling data files with PyInstaller (--onefile)](https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile) – stovfl Nov 11 '18 at 12:28
  • No, I'm looking inside the exe for the file. I see what you mean with the backslash though. I tried using those too, but I still can't locate the files within the exe file. I looked at the above question thatis similar to mine too but it wasn't able to help me. – Kyle Henry Nov 11 '18 at 20:49
  • Okay, so I found a possible solution with the above question, but everytime it gives me a permission error when `driver = webdriver.PhantomJS("phantomjs.exe")` tries to get the phantomjs.exe. – Kyle Henry Nov 12 '18 at 03:30

1 Answers1

0

You guys were right, I didn't look at Bundling data files with PyInstaller enough. One of the given solutions worked for me. Also, the permission error I was given was just me adding the .exe files as data files and not binary files.

Kyle Henry
  • 15
  • 1
  • 7