import dbus returns the following traceback >>> import dbus Traceback (most recent call last): File "<stdin>", line 1, in <module> File "dbus\__init__.py", line 82, in <module> import dbus.types as types File "dbus\types.py", line 6, in <module> from _dbus_bindings import ( ImportError: DLL load failed: %1 is not a valid Win32 application. steps to reproduce: 1. install python-2.7.3 using windows installer 2. install pygtk-2.24 using windows all-in-one installer 3. download, build & install dbus-1.6, dbus-python, dbus-glib mingw32 on windows xp-sp3 (x86) Python 2.7.3 - win32 GTK 2.0 - win32 PyGTK 2.24 - win32 dbus_glib 0.100 - compiled with mingw32 dbus-python 1.1.1 - compiled with mingw32 dbus 1.6.0 - mingw32 using sh.exe in msys ./configure PYTHON="/c/Python27/python" \ PYTHON_INCLUDES="-I/c/Python27/include/" \ PYTHON_LIBS="-L/c/Python27/libs -lpython27.lib" \ PKG_CONFIG="C:\Python27\Lib\site-packages\gtk-2.0\runtime\bin\pkg-config.exe" \ PKG_CONFIG_PATH=/usr/local/bin:/usr/local/include/dbus-1.0/dbus:/usr/local/lib:/usr/local/lib/dbus-1.0/include/dbus:/usr/local/lib/pkgconfig * there's also libpython27.a * also dbus 1.6.2 compiles very nicely with msvc and cmake, but I haven't tried it yet with dbus-python * the pkg-config.exe is from the gtk-2.0 win32 build from their all in one windows installer, it all comes in pyGTK 2.24 * I tried LDFLAGS="\$(PYTHON_LIBS) -no-undefined -shrext .pyd" but configure said that no-undefined and shext were unknown
(In reply to comment #0) > ./configure PYTHON="/c/Python27/python" \ > PYTHON_INCLUDES="-I/c/Python27/include/" \ > PYTHON_LIBS="-L/c/Python27/libs -lpython27.lib" \ I would have expected PYTHON_LIBS to be more like: PYTHON_LIBS="-L/c/Python27/libs -lpython27" (you don't normally have to use an extension in the argument to -l). > * I tried LDFLAGS="\$(PYTHON_LIBS) -no-undefined -shrext .pyd" but configure > said that no-undefined and shext were unknown Please try the wip-windows branch from dbus-python git, or this snapshot of it: http://people.freedesktop.org/~smcv/dbus-python-1.1.1.20120704.tar.gz which should make changing LDFLAGS unnecessary. If it works, I'll merge that branch.
(In reply to comment #1) > If it works, I'll merge that branch. Merged in git based on positive feedback on the mailing list, will be in 1.1.2. If you want to contribute documentation on how to compile dbus-python with mingw, I'd be happy to review it.
Created attachment 63911 [details] Instructions for building dbus-python for windows with mingw
I've attached the instructions to follow to build dbus-python for windows. But there are still some issues, although I think they are with dbus, and not dbus-python. Steps to reproduce: >>> import dbus # this works, yay! >>> session_bus = dbus.SessionBus() # this does start the daemon Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\mingw\msys\1.0\local\lib\site-packages\dbus\_dbus.py", line 211, in __new__ return Bus.__new__(cls, Bus.TYPE_SESSION, private=private, mainloop=mainloop) File "c:\mingw\msys\1.0\local\lib\site-packages\dbus\_dbus.py", line 100, in __new__ bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop) File "c:\mingw\msys\1.0\local\lib\site-packages\dbus\bus.py", line 122, in __new__ bus = cls._new_for_bus(address_or_type, mainloop=mainloop) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Failed: Failed to get autolaunch address from launched dbus-daemon System config: see below
Created attachment 64472 [details] updated instructions for dbus-python, dbus and dbus-glib add `--with-dbus-session-bus-default-address=autolaunch:` so that dbus works on ms-windows out of the box
Created attachment 64557 [details] version 1.1 updated directions to install dbus-python on windows Remove makefile.patch for dbus-glib/dbus/examples, since not needed. The issue was with GTK setenv.cmd, not dbus-glib, added my comment to existing GTK issue 677470 [https://bugzilla.gnome.org/show_bug.cgi?id=677470]. Do **not** use quotes in MS-Windows PATH environment variable.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.