Search code examples
pythonwindowspython-2.7seleniumcx-freeze

Python cx_Freeze on Windows 10 gives IOError: [Errno 9] Bad File descriptor


I have a selenium python 2.7 application which searches for flights on different websites. I created an executable with cx_freeze and it works perfect on Windows 7, but gives this Error on Windows 10.

Here is the Error: enter image description here

Here is my setup.py:

import sys
import os
from cx_Freeze import setup, Executable
exe = Executable(
script=r"selenium_start.py",
base="Win32GUI",
appendScriptToExe = True,
appendScriptToLibrary = True, 
)

setup(
name = "GoPepper Search Tool",
version = "0.1",
description = "GoPepper Search Tool",
options = {"build_exe": {"create_shared_zip": True,"append_script_to_exe": True, "packages": ["selenium"]} },
executables = [exe]
)

Thats the folder structre after I created the executable. There was a problem with the webdriver json file, but I found a solution here which said to copy the whole selenium folder into the folder with the .exe (I dont know if this causes a problem on windows 10). enter image description here

The notebook with windows 10 is completely new, there is no python etc. installed, can this cause the problem? But actually an exe has to work without anything? Thanks!


Solution

  • Okay, I solved the issue.

    I had to download the Mozilla Firefox Browser in order to access its binaries.

    Note: Before I solved it I also installed the same python version on the new notebook and also imported selenium etc. But it didnt solved the problem. I had to download the Firefox browser.

    Now it also works perfect for Windows 10.