1

i am trying to export Python app With GUI & Selenium, using "py2exe"

setup.py :

from distutils.core import setup
import py2exe

data_files = [('selenium\\webdriver\\firefox', ['C:\Python34\Lib\site-packages\selenium-2.44.0-py3.4.egg\selenium\webdriver\\firefox\webdriver.xpi']),
              ('selenium\\webdriver\\firefox', ['C:\Python34\Lib\site-packages\selenium-2.44.0-py3.4.egg\selenium\webdriver\\firefox\webdriver_prefs.json'])]

setup(
    name='app',
    version='1.0',
    console = {'Main.py'}, requires=['easygui', 'selenium'], 
    data_files=data_files,

) 

i get a error -
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Python34\dist\lib rary.zip\selenium\webdriver\firefox\webdriver_prefs.json'

i try to add the files manually to the zip, did not work.
any suggestions ?

Bar
  • 603
  • 1
  • 7
  • 19

2 Answers2

1

I met and have solved the similar problem:

  1. Copy webdriver.xpi and webdriver_prefs.json into your exe directoy.
  2. Modify C:\Python27\Lib\site-packages\selenium\webdriver\firefox\firefox_profile.py:

Change "os.path.join(os.path.dirname(file)" into -> "os.path.join(os.path.dirname(file), '..\..\..\..\'", has two places.

redice
  • 8,437
  • 9
  • 32
  • 41
0

You need to configure MANIFEST.in file:

A MANIFEST.in file can be added in a project to define the list of files to include in the distribution built by the sdist command.

For example, you can include all .json files to the build:

recursive-include *.json

Also see:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • i having some trouble understanding this, i have a manifest.py, so where i can enter the command "recursive-include *.json" ? – Bar Dec 01 '14 at 22:58
  • @user2920421 MANIFEST.in file has a special meaning, please study the docs and the mentioned in the answer links, thanks – alecxe Dec 01 '14 at 23:02