Pergunta

I'm making an application in Python using PySide and Qt, and I need to open a webpage, so I used QtWebKit's QWebView.

On my development machine it works just fine, both running the code directly and running the output of py2exe. On a "clean" machine (no Python and no Qt installed), the output of py2exe doesn't show the webpage. The rest of the application works fine and there is no crash or exception, but the QWebView just stays blank.

I tried opening an URL without images or other stuff to prevent any problems related to missing WebKit plugins. I also tried a simple program that just opens example.com on a QWebView and nothing else, and it also didn't work.

Has anyone encountered anything similar? Also, anybody knows if QWebKit has any sort of "less documented " dependencies that py2exe might not be pulling into the "package"?

Foi útil?

Solução

I would try PyInstaller. It seems to work well when compiling PyQT stuff, as it sniffs dependencies and packages them too (well, it seems to do that). I was making a QT application with Python too, and it spit out a single binary that worked right off the bat.

Here's a link: http://www.pyinstaller.org/

Good luck!

Outras dicas

For anyone who will still have some troubles with it, there you go:

http://developer.qt.nokia.com/wiki/Packaging_PySide_applications_on_Windows

You need to include it manually from py2exe side :)

Try this in py2exe options:

packages = ["PySide.QtNetwok"]

chosen answer doesn't actually answer the question. I had a similar problem, my application uses pyside and QtWebKit, on my dev machine worked fine, on user machine after bundled with py2exe didn't.

first of all your setup.py should explicitly include PySide.QtNetwork: link

...
setup(
    ...
    options = {
        'py2exe': {
            ...
            'includes': ['PySide.QtNetwork'],
            ...
        }
    }
...

after that you should package openSSL DLLs: link

go here and get win32openssl (you may use the light version) copy libeay32.dll and ssleay32.dll to your project folder and add both as as data files in your setup.py like this:

...
setup(data_files=[('', ['libeay32.dll','ssleay32.dll'])],
...

and finally you need to add image support: add the image plugins as data files, at the end it should be something like this:

...
setup(data_files=[("imageformats", glob(r'C:\Python27\Lib\site-packages\PySide\plugins\*.*')),('', ['libeay32.dll','ssleay32.dll'])],
...
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top