[PyQt] Deploying PyQt in a C++ Application

Ferguson, Eric W (397B) Eric.W.Ferguson at jpl.nasa.gov
Fri Aug 7 01:02:54 BST 2015

When I tried to use pyqtdeploycli to create a static version of PyQt I got
unexpected errors. I am targeting a 64-bit os platform (which is the same
platform as my host).

pyqtdeploycli --package pyqt4 --target osx-64 configure
Traceback (most recent call last):
line 11, in <module>
ges/pyqtdeploy/main_cli.py", line 74, in main
    rc = configure(args)
ges/pyqtdeploy/main_cli.py", line 138, in configure
    configure_package(args.package, args.target, args.output)
ges/pyqtdeploy/packages/packages.py", line 74, in configure_package
    macros={'@PY_PLATFORM@': py_platform})
ges/pyqtdeploy/file_utilities.py", line 105, in copy_embedded_file
    contents.replace(key, value)
TypeError: arguments did not match any overloaded call:
  QByteArray.replace(int, int, QByteArray): argument 1 has unexpected type
  QByteArray.replace(QByteArray, QByteArray): argument 1 has unexpected
type 'str'
  QByteArray.replace(str, QByteArray): argument 2 has unexpected type 'str'


Eric Ferguson
NASA/Jet Propulsion Laboratory
Mission Operations Engineer (397B)

"It’s human nature to stretch, to go, to see, to        understand.
Exploration is not a choice, really; it’s an imperative." - Michael Collins

On 8/6/15, 3:40 PM, "Phil Thompson" <phil at riverbankcomputing.com> wrote:

>On 06/08/2015 11:22 pm, Ferguson, Eric W (397B) wrote:
>> Phil,
>> Thanks for answering my questions so quickly. Again, pardon my
>> ignorance
>> since I am new to python deployment.
>> Since you said using pydeployqt was possible, I had a few additional
>> questions regarding that tool:
>> 1.The first tab of the pydeployqt GUI is for your application source.
>> Since I am embedding python into my C++ application, I don¹t really
>> think
>> I have an application source. It seems like something has to be
>> specified
>> on this tab though and I am not sure what to include.
>Your Python code that you want to embed in your application. You might
>have a problem if there isn't any - that particular corner case won't
>have been tested - but that can be fixed.
>> 2. I definitely know which PyQt modules and standard library modules I
>> want to include, so those tabs were easy. However, the location tab is
>> a
>> bit confusing for me as well. I want to use python2.7 as the
>> interpreter.
>> The next tab requests the source location for python. Python 2.7 came
>> preinstalled on my mac - does that include the python source code or do
>> I
>> need to get a tarballed source from python.org?
>You need to get the source.
>> 3. For the target python locations, I know where to find the python
>> include directory for 2.7 on my machine. In the tutorial for the python
>> library, it looks like you are pointing to a static library (.a). Does
>> this mean I need to statically build the python library before using
>> this
>> tool, or will the tool do that for me? Do I give it the path to a
>> library
>> that already exists or is this a path to the library that will be
>> built?
>Whether you embed a static version of the library with your application,
>or distribute a copy of the dynamic version with your application is up
>to you.
>The path is to a library that already exists.
>> I also noticed your static build section after the pyqtdeploy tutorial
>> using the command line interface tool. Perhaps I shouldn¹t be using the
>> pydeployqt GUI and instead should be using that tool instead? If so,
>> how
>> can I include more than a small sub-set of the standard libraries in my
>> static build of python?
>You can't. pyqtdeploycli is intended to be used by build systems - it
>never modifies a .pdy project file.

More information about the PyQt mailing list