473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Static linking of python and pyqt

Hello,

I'm trying to link python statically with qt and pyqt. I've tried this in
several ways but never succeeded. At the moment the final make runs without
errors but I get import errors when accessing pyqt.
How can I solve this problem?

Markus

# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /opt/python-2.4.4/lib/python2.4/site.pyc
matches /opt/python-2.4.4/lib/python2.4/site.py
import site # precompiled from /opt/python-2.4.4/lib/python2.4/site.pyc
# /opt/python-2.4.4/lib/python2.4/os.pyc
matches /opt/python-2.4.4/lib/python2.4/os.py
import os # precompiled from /opt/python-2.4.4/lib/python2.4/os.pyc
import posix # builtin
# /opt/python-2.4.4/lib/python2.4/posixpath.pyc
matches /opt/python-2.4.4/lib/python2.4/posixpath.py
import posixpath # precompiled
from /opt/python-2.4.4/lib/python2.4/posixpath.pyc
# /opt/python-2.4.4/lib/python2.4/stat.pyc
matches /opt/python-2.4.4/lib/python2.4/stat.py
import stat # precompiled from /opt/python-2.4.4/lib/python2.4/stat.pyc
# /opt/python-2.4.4/lib/python2.4/UserDict.pyc
matches /opt/python-2.4.4/lib/python2.4/UserDict.py
import UserDict # precompiled
from /opt/python-2.4.4/lib/python2.4/UserDict.pyc
# /opt/python-2.4.4/lib/python2.4/copy_reg.pyc
matches /opt/python-2.4.4/lib/python2.4/copy_reg.py
import copy_reg # precompiled
from /opt/python-2.4.4/lib/python2.4/copy_reg.pyc
# /opt/python-2.4.4/lib/python2.4/types.pyc
matches /opt/python-2.4.4/lib/python2.4/types.py
import types # precompiled from /opt/python-2.4.4/lib/python2.4/types.pyc
# /opt/python-2.4.4/lib/python2.4/warnings.pyc
matches /opt/python-2.4.4/lib/python2.4/warnings.py
import warnings # precompiled
from /opt/python-2.4.4/lib/python2.4/warnings.pyc
# /opt/python-2.4.4/lib/python2.4/linecache.pyc
matches /opt/python-2.4.4/lib/python2.4/linecache.py
import linecache # precompiled
from /opt/python-2.4.4/lib/python2.4/linecache.pyc
import encodings # directory /opt/python-2.4.4/lib/python2.4/encodings
# /opt/python-2.4.4/lib/python2.4/encodings/__init__.pyc
matches /opt/python-2.4.4/lib/python2.4/encodings/__init__.py
import encodings # precompiled
from /opt/python-2.4.4/lib/python2.4/encodings/__init__.pyc
# /opt/python-2.4.4/lib/python2.4/codecs.pyc
matches /opt/python-2.4.4/lib/python2.4/codecs.py
import codecs # precompiled from /opt/python-2.4.4/lib/python2.4/codecs.pyc
import _codecs # builtin
# /opt/python-2.4.4/lib/python2.4/encodings/aliases.pyc
matches /opt/python-2.4.4/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled
from /opt/python-2.4.4/lib/python2.4/encodings/aliases.pyc
# /opt/python-2.4.4/lib/python2.4/encodings/utf_8.pyc
matches /opt/python-2.4.4/lib/python2.4/encodings/utf_8.py
import encodings.utf_8 # precompiled
from /opt/python-2.4.4/lib/python2.4/encodings/utf_8.pyc
Python 2.4.4 (#1, Dec 7 2007, 11:16:51)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import QtCore
import QtCore # builtin
import sip # builtin
Traceback (most recent call last):
File "<stdin>", line 1, in ?
SystemError: _PyImport_FixupExtension: module QtCore not loaded
>>import sys
print sys.builtin_module_names
('QtCore', 'QtGui', '__builtin__', '__main__', '_codecs', '_sre', '_symtable', 'errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'pwd', 'signal', 'sip', 'sys', 'thread', 'time', 'xxsubtype', 'zipimport')
>>>
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] site
# cleanup[1] encodings
# cleanup[1] _codecs
# cleanup[1] zipimport
# cleanup[1] PyQt4.QtCore
# cleanup[1] warnings
# cleanup[1] encodings.utf_8
# cleanup[1] codecs
# cleanup[1] types
# cleanup[1] signal
# cleanup[1] linecache
# cleanup[1] posix
# cleanup[1] encodings.aliases
# cleanup[1] exceptions
# cleanup[2] copy_reg
# cleanup[2] sip
# cleanup[2] posixpath
# cleanup[2] os.path
# cleanup[2] stat
# cleanup[2] UserDict
# cleanup[2] os
# cleanup sys
# cleanup __builtin__
# cleanup ints: 7 unfreed ints in 1 out of 3 blocks
# cleanup floats
Dec 17 '07 #1
4 2460
I'm trying to link python statically with qt and pyqt. I've tried this in
several ways but never succeeded. At the moment the final make runs without
errors but I get import errors when accessing pyqt.
How can I solve this problem?
You'll need to include QtCore into Modules/config.c, preferably by
adding it to Modules/Setup.local.

HTH,
Martin
Dec 19 '07 #2
I'm trying to link python statically with qt and pyqt. I've tried this in
several ways but never succeeded. At the moment the final make runs without
errors but I get import errors when accessing pyqt.
How can I solve this problem?
You'll need to include QtCore into Modules/config.c, preferably by
adding it to Modules/Setup.local.

HTH,
Martin
Dec 19 '07 #3
I'm trying to link python statically with qt and pyqt. I've tried this in
several ways but never succeeded. At the moment the final make runs
without errors but I get import errors when accessing pyqt.
How can I solve this problem?

You'll need to include QtCore into Modules/config.c, preferably by
adding it to Modules/Setup.local.

HTH,
Martin
I tried this in combination with the QtCore libs from pyqt. But there seems to
be a conflict between the pyqt package and the linked libs. Therefore I tried
to link only qt statically and import pyqt dynamically. But in the
Setup.local you need to specify a module:

<module<lib>

I just want the qt libs linked to the interpreter without accessing them by a
module. I tried the configure option '--with-libs='lib ...''. The make did
fine but the executable is too small and the qt symbols are not known by it.
How can I just link qt statically?

Thank you.

Markus
Dec 19 '07 #4
I just want the qt libs linked to the interpreter without accessing them by a
module. I tried the configure option '--with-libs='lib ...''. The make did
fine but the executable is too small and the qt symbols are not known by it.
How can I just link qt statically?
Why do you want to do this? If qt isn't actually *used* in Python (as
you don't include the pyqt modules), what effect do you expect from
such linking?

I think it linked just fine - it just didn't include any symbols,
because none were needed. That is the correct, expected behavior.
It all worked fine.

Regards,
Martin
Dec 19 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

59
by: Hugh Macdonald | last post by:
I've recently been trying out various different GUI frameworks in Python and was wondering if I could get your input on the pros and cons of the different ones... wxPython: I love the...
0
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module...
3
by: Grzegorz Dostatni | last post by:
Cheers. First what I am trying to do: I am trying to create a version of pytho23.dll that contains everything inside of it. It is staticaly linked. It also needs to contain the qt library. For...
10
by: Simon John | last post by:
After quite a while of wxPython I'm getting back into PyQt, mainly due to the announcement by Trolltech that they will make a GPL version of Qt4 for Windows (and Phil-T said he will make a PyQt to...
4
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v3.14 available from http://www.riverbankcomputing.co.uk/. Changes since the last release include support for QScintilla v1.5. ...
3
by: Kenneth McDonald | last post by:
If this is not an appropriate newsgroup for this type of posting, please let me know and (if possible) suggest an alternative. I've done a fair bit of research on the net, but information is...
59
by: Kevin Walzer | last post by:
From the introduction to PyObjC, the Python-Objective-C bridge on Mac OS X: "As described in Objective-C for PyObjC users the creation of Objective-C objects is a two-stage process. To initialize...
0
by: abarun22 | last post by:
HI I am new to SWIG & Python and right now i am in the process of wrapping some "C" functionalities present in a static library for python. I do have my C file "name.c" which just contains some...
9
by: cgrebeld | last post by:
Is it possible for a Qt C++ application, which embeds the python interpreter, to import and use PyQt? There can be only one QApplication, which is created in the C++ side, so how would I use that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.