[Python-ideas] problems with import
Antoine Pitrou
antoine at python.org
Fri Jun 27 20:33:07 CEST 2014
Le 27/06/2014 13:12, Steven D'Aprano a écrit :
> On Fri, Jun 27, 2014 at 09:05:48AM -0400, Neal Becker wrote:
> [...]
>> 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.
>
> Re-arrange sys.path so that the local site-packages comes first,
> before the global site-packages. (I'm surprised Python doesn't
> already do this.)
Then he would have the reverse problem: once he installs a user-local hg
extension, the bundled (official) hg extensions wouldn't be reachable
anymore.
The answer here comes into two possibilities, both of which have to do
with Mercurial and none with Python itself:
1) Mercurial could make hgext a namespace package (see Peter Otten's
answer above)
2) third-party extensions for Mercurial should never install into the
"hgext" package but rather in a separate top-level package or module
(presumable called "hgsomething")
Regards
Antoine.
More information about the Python-ideas
mailing list