How to run Python + Qt application in Squish testing tool? - python

I am having a trouble with starting testing my Python + Qt4.8 application using Squish.
I am new to that, so if anyone has some experience with using Squish, please read my question.
So I have a couple of Python files which make my application.
The Squish IDE requires an .exe or .bat file in order to start recording. So I successfully generated .exe from all .py files using PyInstaller. When I open the .exe file generated it works fine.
Then I select New Test Suite in Squish I select that .exe I mentioned.
It seems to be fine, but when I try to start recording, Squish cannot open my application. I get an error message like the picture below. I am sure I am using Squish with the right version of Qt. I read about the problem and I found out that it might be because I am using debug version of my application. So do anyone know how can I make my application as non-debug? Or is there any other way to fix this problem? Any help will be really appreciated, thanks.
EDIT: I found the information:
py2exe distributions: Exclude Qt libraries With py2exe on Windows the
Qt libraries must be excluded from the distribution/.exe file.
This is required because Squish for Qt only supports application that
dynamically load the Qt libraries.
But I tried to use py2exe and excluded the libraries. Maybe I am excluding the wrong ones? Does anyone know which exactly libraries should be excluded? Thank you in advance.

#Nela, all Qt libraries included in your packaged application must be excluded (QtCore4.dll, etc.).
If it still does not work please contact froglogic's technical support and provide the support information (Help > Collect Support Information...) directly after reproducing the problem.

Related

Is there any way to take executable binary (.exe) and somehow "compile" .wasm

I'm working on a 2d game in pygame, and I want it to be available on the web. In my head, a fun way to challenge myself is to use web assembly to make the game available on the web. So I'm wondering if there is any way to take executable binary (.exe) and somehow "compile" .wasm if that's still sayable at this point) to
Running a .exe via WebAssembly (WASM) in the browser will be extremely slow and inefficient but is still possible with a Wasm PC emulator ( eg v86 ) + an OS ( eg ReactOS ).
But if you can gain access to game sourcecode then
what you could do is using CPython 3.11 which supports WebAssembly target ( with the help of Emscripten a C/C++ compiler targeting WASM ).
Add to that the latest development version of PyGame and minor changes to the game main loop source code.
You can now run directly the game if you pack both sourcecode and assets with the emscripten File Packager instead of a .exe you will have a .wasm (cpython) + one .data (assets+code) and some javascript glue to load them.
Please note that currently there is no straightforward tool to do that at once, but situation will most likely evolve very quickly after release of CPython 3.11.
Personally, I don't have much experience with combining .py and .wasm files, but I do know some stuff regarding running Pygame:
First of all, you can run basic Pygame files here. I scoured the internet in search of an independent Pygame running engine, and this is the only one I could find.
Second, you can use PyInstaller to convert your Pygame file itself to .exe (it packages it nicely, but can't be signed, so some computers might think it's a virus). I have no idea how to run this specifically on the web, but if you can manage to find a web platform that can run it with a window, then you can maybe try and run that .exe with Javascript and connect the .wasm to that.
Third, I'm not sure there's a way to run .exe files with a separate window in web assembly, but I'm not too familiar with wasm.
I hope that helped!

Is there any way to compile a wireshark dissector plugin in Windows 7 without using QT?

I have been writing a dissector of some protocol for wireshark in C language.I have successfully compiled its plugin in Linux.But I want to develop a plugin for windows too(dll file).All the posts related to wireshark plugin development innvolve the use of QT in compiling the plugin.But I was wondering if there could be some way that I can compile it without using QT because QT is required for GUI and I dont need any gui for my plugin.I just want to use its dll file in wireshark.So if there is any way by which I can compile my plugin alone without compiling whole wireshark,It would be very helpful.
In short,I dont want to use QT for making plugin.So please suggest some way .I am really stuck on this problem .
Have you tried passing -DBUILD_wireshark=OFF to CMake as described in the Developer's Guide?

How to run QGIS plugin from python script

I would like to access external qgis plugins through a python script. I have been able to access the built in qgis processing and vector toolboxs, but have been unsuccessful with external plugins such as the topology checker plugin. I have tried this both using the built in qgis python console, and an exteranl IDE, but attempts have failed.
I am sure that there is a way to do this, has someone done this before?
Thank you!
You could add the qgis plugin folder to your path. That way you should be able to import them as a module.
Have a look at my blog to find a way to load QGIS plugins in a standalone PyQGIS application (in Spanish):
http://geotux.tuxfamily.org/index.php/en/component/k2/item/229-cargando-plugins-de-quantum-gis-en-el-visor-de-pyqgis
There you'll find a QgisInterface class, which you must use to be able to run plugins out of QGIS. This class is now being employed by QGIS devs to run PyQGIS tests.
As you can se, the blog post is very old, so I don't warrant it'll work out of the box, but for sure it's a very good guide for you to accomplish what you want.

Solutions for freezing a pyqt4 application in Windows?

Is there a workable and proven way to freeze a pyqt4 application in windows? I heard that there are some issues for py2exe.
I used py2exe for a PyQt4 project at work but ended up switching to PyInstaller.
py2exe worked great for the most part. I remember having to manually tell it to include the sip libraries in my setup.py file along with some others depending on the program. PyInstaller seems to handle this better in my opinion, although I often find myself removing DLL files from the final folders' qt4_plugins folder that it has decided to include that I don't actually need. For example, qt4_plugins\imageformats\qjpeg4.dll when I'm not using JPEG files at all. This does not hinder the frozen application in any way, it'll just increases the filesize.
The manual for PyInstaller is pretty good as well and with it's 'Getting Started' section you should quickly be able to get things set up. It's as simple as creating a .spec file per project which is automatically generated but is also a normal Python file so that you have the option to tweak it or add any extra tasks such as code signing or maybe creating a setup.exe program using NSIS.
I have a windows batch file named pybuild.bat in my path who's contents consist of:
python -O c:\python27\pyinstaller-1.5\build.py "%~f1"
so that I can easily build a project from the command line by running 'pybuild projectname.spec' on the projects .spec file. I've also added this to the registry's entry for the .spec file so that I can freeze a project quickly from Explorer:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.SPEC\shell\Freeze\command]
#="C:\\Python27\\Scripts\\pybuild.bat \"%1\""
My main reason for switching from py2exe though is that some users complained that the frozen apps would not run on their machines. I kept running into the error:
The application has failed to start
because the application configuration
is incorrect. Reinstalling the
application may fix the problem.
but only on some machines, usually running Windows XP. I found that getting the user to install the Microsoft Visual C++ 2008 Runtimes made the problem go away.
Frozen apps created with PyInstaller didn't have this problem as it seems to package these runtimes into the output folder. If UPX is available somewhere in your path it will compress your DLL and PYD files as well, resulting in a smaller output folder.
Long story short - both py2exe and PyInstaller work fine. I hit a few issues with py2exe when using it and although there may be workarounds for these if you hunt around I found that PyInstaller worked better without any modifications. I've distributed frozen apps from PyInstaller that make use of image and database libraries from PyQt4 as well as a few other third party libraries and haven't hit any problems yet.

Deploying python executables- PyInstaller, cx-freeze, etc

I'm looking to find a way to bundle a python app into stand-alone executables so my windows and mac using friends can use it without installing ugly dependencies. Looking online I've found a few utilities to help do this, including py2exe for windows and py2app for mac, as well as PyInstaller, cx-freeze, and bbfreeze. What have ya'll used and what would you recommend?
I've been building a python app with PyQt and PyQwt for the past few weeks and have had the same problem. I found py2app completely impossible to use, I kept running into so many problems constantly that I gave up. A few days later found PyInstaller which is fantastic. It understands both PyQt and PyQwt out of the box - and does a very nice job in wrapping everything into an app bundle. Haven't tried building a Windows executable with it yet though.
I found a good article at arstechnica on how to use py2exe and py2app although it's a bit old (you can probably skip the python 2.5 stuff) http://arstechnica.com/open-source/guides/2009/03/how-to-deploying-pyqt-applications-on-windows-and-mac-os-x.ars/
I would highly recommend using PyInstaller. There are a couple of tricks though you need to do for OS X since the support is currently only preminary http://diotavelli.net/PyQtWiki/PyInstallerOnMacOSX
I use py2exe to create a windows executable. The documentation is somewhat messy, but once I pulled together a working setup.py to use as a template I haven't had any problems altering it to generate any given exe. I've usually been able to find helpful information though Google searches, like when I needed to bundle in pngs for the UI to use.

Categories

Resources