[Python-Dev] is the 'path' argument to an importer's find_module() just a hint?

glyph at divmod.com glyph at divmod.com
Mon Oct 27 21:32:10 CET 2008


On 08:24 pm, brett at python.org wrote:
>On Mon, Oct 27, 2008 at 12:31 PM,  <glyph at divmod.com> wrote:
>>On 07:24 pm, brett at python.org wrote:
>>>
>>>On Mon, Oct 27, 2008 at 3:50 AM, Nick Coghlan <ncoghlan at gmail.com> 
>>>wrote:

>>For what it's worth, Twisted uses the __path__ attribute to facilitate 
>>its
>>plugin mechanism.

>But how do you manipulate it for frozen packages currently? Importing
>a frozen package currently has a bad __path__ value::

>  >>> import __phello__; __phello__.__path__
>  '__phello__'
>
>Notice how that is not a list. Do you special-case frozen packages?

Oh.  Well, in that case, it's already broken, nevermind :).  I naively 
assumed that someone would have reported a bug in Twisted if it were 
different from i.e. zip importing.  I suppose it makes sense - plugins 
are used for "twistd" subcommands, and it's unlikely that you'd want to 
freeze "twistd"; few applications use Twisted plugins themselves yet.

I misunderstood your earlier description; I thought that this (the 
invalid __path__) was the desired change, not the current state of the 
world.

(Of course if you could *change* frozen packages to have a valid 
__path__ I'd appreciate that...)


More information about the Python-Dev mailing list