[pygtk] Segfault importing gtk within distutils / unittest

Johannes Wienke languitar at semipol.de
Tue Jun 17 19:47:39 WST 2008


Hi again,

maybe someone can help me if I narrow the problem? I've found out that =

this segfault only occurs if one of my own extension modules that also =

link against gtk is loaded before the gtk import statement. Moreover it =

is unrelated to pyunit or distutils. What could be the problem?

Thanks in advance
Johannes


Am 06/09/2008 06:45 PM schrieb Johannes Wienke:
> Hi,
> =

> I've programmed a custom distutils command to run my unit tests. The
> important part looks like this:
> =

> def __runTests(self):
>     '''
>     Runs all unit tests found in the folder 'test'.
>     '''
> =

>     print "--- start run tests"
> =

>     # append the build path to the pythonpath
>     sys.path.append(self.__buildDir)
> =

>     # append test path to pythonpath
>     sys.path.append(os.path.join(os.getcwd(), "test"))
> =

>     testFiles =3D self.__findTestModules()
> =

>     print "--- before load tests"
> =

>     tests =3D TestLoader().loadTestsFromNames(testFiles)
> =

>     print "--- after load tests"
> =

>     t =3D TextTestRunner(verbosity =3D 1)
>     t.run(tests)
> =

> As you can see, I've added a few print statements to explain my problem.
> =

> Now a part of my system uses pygtk and is used by one of the unit tests
> that are being loaded in the code above. The module using pygtk works
> without problem - but not within the unit tests. There I get a
> segmentation fault while importing gtk. The import at the top of that
> module looks like this:
> =

> print "--- before import pygtk"
> import pygtk
> print "--- after import pygtk"
> pygtk.require('2.0')
> print "--- after require"
> import gtk
> print "--- after import pygtk"
> =

> Running the tests I get this output:
> =

> --- start run tests
> --- before load tests
> --- before import pygtk
> --- after import pygtk
> --- after require
> Segmentation fault
> =

> What could be the problem? Running python 2.4 on Gentoo Linux with pygtk
> 2.12.0
> =

> Thanks in advance.
> =

> Johannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080617/fa0a9d56/s=
ignature.pgp


More information about the pygtk mailing list