Creating Python GUI Applications using XULRunner

  • What differences are there for AMD64 machines?

    Mozilla (at time of writing) do not provide official builds of XULRunner for 64-bit machines. This means you will need to use 32-bit compatibility libraries in order to run the 32-bit build of XULRunner, or compile your own build.

    You will get errors like: 'Couldn't load XPCOM' if you do not have the necessary 32-bit libraries installed. The library packages required for Ubuntu for example are:
    ia32-libs and ia32-libs-gtk
    On Linux, you can perform a check to see what library dependencies are missing using the following commands (there should be no missing libraries reported):

    $ cd pyxpcom_gui_app/xulrunner
    $ LD_LIBRARY_PATH=. ldd ./xulrunner-bin

  • I get an undefined error when using one of the examples?

    Example error:

    init:: error: TypeError:
    Components.classes[';1'] is undefined 
    This can occur if the XPCOM components did not get registered correctly at startup (and usually indicates an error in the PythonExt extension). On Windows this can occur if the necessary Microsoft Visual Studio runtime libraries are not installed. To fix this, try downloading and installing the "Microsoft Visual C++ 2005 Redistributable Package (x86)" and then retrying the application.

    To further debug the XPCOM registration process on Windows, in a Windows command prompt window, turn on the logging and use the -console option to show the logging output:

    $ set NSPR_LOG_MODULES=nsNativeModuleLoader:5
    $ "C:\Program Files\Mozilla Firefox\firefox.exe" -console

  • How do I include the pywin32 extensions in an application?

    PythonExt uses a standard python build from, which does include the Python for Windows Extensions (pywin32).

    It's certainly possible to bundle the pywin32 python libraries with PythonExt. To add pywin32 to your extension, copy across the necessary site-packages/pywin32 code into your own extension's "pylib" directory, or if you want to have PythonExt with win32, the same applies, pywin32 could be copied to either the "pythonext/pylib" or "pythonext/python/Lib/site-packages/" directory.

    The one thing to keep in mind is that the Python version you copy from must exactly match the PythonExt version (that is 2.5.2 at present).