[Nix-dev] Re: python search path and PyQt4&dbus

Yury G. Kudryashov urkud+nix at ya.ru
Fri Aug 27 01:19:56 CEST 2010


Peter Simons wrote:

> Hi Yury,
> 
>  > 1) Apply my patch.
>  > 2) Build pyqt4.
>  > 3) use PYTHONPATH from $pyqt/bin/* wrappers
>  > 4) strace python -c "import dbus.mainloop.qt". It finds dbus.mainloop
>  > in
>  >    $pythonDBus, then looks for dbus.mainloop.qt ONLY in $pythonDBus.
> 
> I am sorry, but I can't do these steps right now. Could you please post
> the results of running the commands
> 
>  - find $pytonDBus -exec ls -lhd {} \;
>  - find $pyqt -exec ls -lhd {} \;
>  - cat $pyqt/bin/<some-wrapper-script>
> 
> ...? Then I can take a look at the results without building everything
> myself.
I've asked my question on #python, and arkanes told me that if module is 
supposed to be a part of a package (in our case dbus.mainloop.qt is a part 
of dbus.mainloop, so python looks for it in dbus.mainloop directory only.

For more information read 
http://docs.python.org/reference/simple_stmts.html#the-import-statement

We can add a custom sys.meta_path that ignores the second argument.
http://www.python.org/dev/peps/pep-0302/

Currently I've just symlinked pythonDBus to pyqt, but it is not a proper 
scalable solution ;)




More information about the nix-dev mailing list