1

I'm trying to create an executable file using Py2Exe. If I use PhantomJS Selenium webdriver instead of Firefox, everything works fine. The problem is when I try to use Firefox webdriver.

It raises this exception (when executing exe file):

Traceback (most recent call last):
  File "main.py", line 218, in <module>
  File "main.py", line 113, in __init__
  File "selenium\webdriver\firefox\webdriver.pyc", line 48, in __init__
  File "selenium\webdriver\firefox\firefox_profile.pyc", line 65, in __init__
IOError: [Errno 2] No such file or directory: 'C:\\Users\\Milano\\PycharmProject
s\\Velvet\\WebDbUploader\\dist\\library.zip\\selenium\\webdriver\\firefox\\webdr
iver_prefs.json'

So I've found inside site-packages...selenium..firefox the webdriver_prefs.json and copied it into the ..WebDbUploader\dist\library.zip\selenium\webdriver\firefox and no change... still the same error occures.

Now, I've solved this. I just unzip library.zip, copy those files inside it and zip it again. But now, there is a new error which says that it can't import os module which is weird since there is no problem with this import when I use PhantomJS.

Is there some way to repair this? Maybe use just not zipped library or something like that?

Milano
  • 18,048
  • 37
  • 153
  • 353

1 Answers1

0

You could try to copy webdriver_prefs.json and webdriver.xpi and from C:\Python34\Lib\site-packages\selenium\webdriver\firefox to dist\selenium\webdriver\firefox. It should be enough.

For more details you can refer to this answer.

Community
  • 1
  • 1
mabe02
  • 2,676
  • 2
  • 20
  • 35