[python-win32] py2exe issues with script using selenium

Mark Hammond skippy.hammond at gmail.com
Wed Jul 18 04:37:19 CEST 2012


The problem is a "conflict" between the firefox_profile module and 
py2exe.  firefox_profile is attempting to open 
'C:\\Users\\ferdinand\\Desktop\\Landmark_Ops\\dist\\library.zip\\selenium\\webdriver\\firefox\\webdriver.xpi' 
as a regular file (a .xpi file is a .zip file, hence the fact zipfile 
itself is throwing the error), but that file doesn't exist as a regular 
file.

You probably need to look into the source of firefox_profile and see if 
you can tell it where the .xpi file lives.  Then you would take 
advantage of py2exe's "data_files" option to arrange for the .xpi file 
to be packaged as a regular file, then tell firefox_profile where that 
location is.

HTH,

Mark

On 18/07/2012 4:05 AM, Ferdinand Sousa wrote:
> Hi List,
>
> My environment: Win 7 Professional 64-bit, Python 2.7 64-bit and
> appropriate 64-bit libraries installed over that.
> I downloaded the 64-bit py2exe package. Though I did not specifically
> download the Distutils package, I guess I have it from having installed
> 3rd party Python libraries.
>
> I'm trying to create a py2exe executable of a script that automates
> Firefox using selenium webdriver.
> The script also uses a couple of other libraries including the python
> imaging library and pywin32.
>
> When I try to run the generated exe I get the following traceback: (the
> 1st 2 lines after the script starts are print statement output)
>
> ##-------------------------------------------------------------------------------------------------------------------------------
> C:\Users\ferdinand\Desktop\Landmark_Ops\dist>make_ELOG.exe
> Starting CLI commands
> CLI output parsed
> Traceback (most recent call last):
>    File "make_ELOG.py", line 220, in <module>
>    File "selenium\webdriver\firefox\webdriver.pyc", line 51, in __init__
>    File "selenium\webdriver\firefox\extension_connection.pyc", line 45,
> in __init__
>    File "selenium\webdriver\firefox\firefox_profile.pyc", line 136, in
> add_extension
>    File "selenium\webdriver\firefox\firefox_profile.pyc", line 289, in
> _install_extension
>    File "zipfile.pyc", line 701, in __init__
> IOError: [Errno 2] No such file or directory:
> 'C:\\Users\\ferdinand\\Desktop\\Landmark_Ops\\dist\\library.zip\\selenium\\webdriver\\firefox\\webdriver.xpi'
> ##-------------------------------------------------------------------------------------------------------------------------------
>
> I checked the zip folder mentioned in the path and it is missing the
> webdriver.xpi file.
> I manually added the missing file into the zip folder from a similar
> path in my python setup, but it still doesn't work.
> The start of the traceback ( line 220, in <module> ) refers to the line
> where I 1st instantiate the Firefox() selenium webdriver automation object.
>
> I had earlier tried the same with pyinstaller and faced a similar kind
> of issue with the same webdriver.xpi file. It that case, pyinstaller
> used some other file format (not zip) and I was not able to edit that file.
>
> The script works quite ok in the normal python environment.
> Any pointers?
>
> Thanks,
> Ferdi
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



More information about the python-win32 mailing list