[Python-ideas] problems with import

Eric Snow ericsnowcurrently at gmail.com
Fri Jun 27 23:39:48 CEST 2014


On Fri, Jun 27, 2014 at 7:05 AM, Neal Becker <ndbecker2 at gmail.com> wrote:
> One problem I often encounter is with import search.
>
> An example of the problem is with the package mercurial.  It has extensions in a
> subdirectory called 'hgext'.
>
> On fedora, I install mercurial using the vendor package.  This creates
>
> /usr/lib64/python2.7/site-packages/hgext/
>
> Later, I want to try out an extension as a non-privileged user.
>
> cd <extension>
> python setup.py install --user
>
> Now I also have
> ~/.local/lib/python2.7/site-packages/hgext
>
> but python won't search there for extensions.  Once if finds the system hgext
> directory, it won't look also in the local one.
>
> Any thoughts?

Use ~/.hgrc to enable extensions:

http://www.selenic.com/mercurial/hgrc.5.html#extensions

In your case give the explicit path.  I've been doing this for years
and it works great.

-eric


More information about the Python-ideas mailing list