简体   繁体   中英

Can't find files in exe PyInstaller

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM