A
A
Andrew2017-10-22 21:46:05
Python
Andrew, 2017-10-22 21:46:05

How to run phantomjs python in .exe when console=False?

Generate .exe via pyinstaller .
I add phantomjs to the composition through . If in the .spec file (when generated via pyinstaller) - then everything works fine. If , then the phantom does not even start :( Tell me how to solve this? Thanks . The full code of the .spec file:Tree('phantomjs\\bin')
console=True
console = False

# -*- mode: python -*-

block_cipher = None


a = Analysis(['generate.py'],
             pathex=['D:\\python35_64'],
             binaries=[],
             datas=[],
             hiddenimports=['queue'],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
      Tree('phantomjs\\bin'),
          a.zipfiles,
          a.datas,
          name='generate',
          debug=False,
          strip=False,
          upx=True,
          console=True, icon='D:\\download\\generate.ico')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lastedge, 2018-02-12
@lastedge

It is possible that phantomjs creates a hidden console window during its execution. Based on this, using the console=False parameter disables the window and phantomjs. Possible workaround in python: https://stackoverflow.com/a/28661459/7646284
https://stackoverflow.com/a/37823699/7646284 - or alternatively using patched file for selenium after which webdriver doesn't create hidden windows. On the results of the assembly, the last option did not affect me in any way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question