D
D
Dmitry2017-02-21 12:27:23
Python
Dmitry, 2017-02-21 12:27:23

How to convert Python+Selenium+PhantomJS to exe?

C:\Users\1>"C:\Users\1\Desktop\don't kill me\portSel.exe"
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 74, in start
File "subprocess.py", line 676, in __init__
File "subprocess.py", line 955, in _execute_child
FileNotFoundError: [WinError 2] The specified file could not be found
During handling of the above exception, another exception occurred :
Traceback (most recent call last):
File "portSel.py", line 6, in
File "site-packages\selenium\webdriver\phantomjs\webdriver.py", line 52, in __
init__
File "site-packages\selenium \webdriver\common\service.py", line 81, start
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable n
eeds to be in PATH.
Failed to execute script portSel
Exception ignored in: >
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver \common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
the bottom line is that, as I understand it, there is no phantom driver, but how to make it so that the application is converted and it runs without any problems on any machine

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chupasaurus, 2017-02-21
@chupasaurus

The directory with phantomjs.exe must be in the PATH environment variable, the rest falls off because of this.
Without pre-installed dependencies, the application will not be able to run on other machines, if you want to install by clicking the "Do me good" button - create an msi installer with installing phantomjs, your application and prescribing everything where necessary.

W
WorldEn, 2017-02-21
@WorldEn

Try to download this driver and install it as shown here (if you have Windows OS).
Then you might need some solutions from here: one , two
Then you should install a great compiler for Python (if you have Python 3) called Pyinstaller which usually compiles everything without problems.
PS: and yes, as mentioned above, this driver will need to be installed wherever you want to run the exe file.
In order for this driver to be automatically installed in PATH on another computer, when you run your exe file, you can write special code in the py script before compiling. For example, I was creating an application, and I needed to have ffmpeg pre-installed on the computer where I will run the exe file of my program. So I wrote in the script so that when the program starts, ffmpeg is automatically downloaded from off. site to the desired folder and unpacked there (before that, the condition was checked to see if there was ffmpeg on the disk), then cmd was called on behalf of the administrator, where the user himself indicated where to install the utility. Of course, this is not ideal, and perhaps there was an easier way for the user to have everything installed automatically.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question