[Distutils] Problem importing pylirc egg
Ian Bicking
ianb at colorstudy.com
Mon Apr 24 18:24:24 CEST 2006
Philippe Normand wrote:
> Hi,
>
> i've easy_installed pylirc from sourceforge as an Egg. It's correctly
> compiled/installed on my system. But i can't import it, though it's
> found by pkg_resources:
>
>
>>>>import pylirc
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ImportError: No module named pylirc
>
>>>>import pkg_resources
>>>>pkg_resources.require('pylirc')
>
> [pylirc 0.0.5
> (/home/phil/lib/python2.4/pylirc-0.0.5-py2.4-linux-i686.egg)]
>
> What am i supposed to do with that Requirement object so as to get
> pylirc module in my namespace ?
You have to require and then import:
import pkg_resources
pkg_resources.require('pylirc')
import pylirc
Also, if you list pylirc as a requirement in your setup.py of your
pylirc-using-project and then require your own package, this will make
sure pylirc is also required (along with any other requirements you put
in setup.py).
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Distutils-SIG
mailing list