On Wed, Jul 30, 2014 at 11:22 PM, Leo Jay <python.leo...@gmail.com> wrote:
> On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano <st...@pearwood.info> wrote:
>> I'm looking for a programmatic way to get a list of all Python modules
>> and packages. Not just those already imported, but all those which
>> *could* be imported.
>>
>
> If you don't actually import it, how can you know it could be imported?
> Not all .so files are valid python modules.
> Not all .py files could be imported by all python interpreters.

What if you define it as "modules you could attempt to import"? Sure,
any module might fail during importing, but you've still taken a
statement of "import spam" and turned it into an attempt to read some
specific file from the disk.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to