Re: Listing modules from all installed packages

2013-06-14 Thread Julien Phalip
On Saturday, June 8, 2013 11:22:16 PM UTC-7, Carlos Nepomuceno wrote: > Just realized that you've asked for installed packages. Perhaps the following > will do the trick. I don't know why the 'lib-tk' isn't included. Why not? > > toplevel_packages = ['%s\\%s'%(ml.path,name)for ml,name,ispkg in >

Re: Listing modules from all installed packages

2013-06-09 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年6月9日星期日UTC+8下午1時23分15秒寫道: > print '\n'.join([re.findall("from '(.*)'",str(v))[0] for k,v in > sys.modules.items() if str(v).find('from')>-1]) > > > > > Date: Sat, 8 Jun 2013 21:30:48 -0700 > &

Re: Listing modules from all installed packages

2013-06-09 Thread cclauss
Adding : python -c 'help("modules") to the other two suggestions: #!/usr/bin/env python import commands, pkgutil, re, sys print('sys.modules.items()...') print('\n'.join(sorted([re.findall("from '(.*)'",str(v))[0] for k,v in sys.modules.items() if str(v).find('from')>-1]))) print('\npkgutil.it

RE: Listing modules from all installed packages

2013-06-08 Thread Carlos Nepomuceno
#x27;\n'.join(toplevel_packages) > Date: Sat, 8 Jun 2013 21:30:48 -0700 > Subject: Listing modules from all installed packages > From: jpha...@gmail.com > To: python-list@python.org > > Hi, > > I'm trying to write a function that programmatically obtains and

RE: Listing modules from all installed packages

2013-06-08 Thread Carlos Nepomuceno
print '\n'.join([re.findall("from '(.*)'",str(v))[0] for k,v in sys.modules.items() if str(v).find('from')>-1]) > Date: Sat, 8 Jun 2013 21:30:48 -0700 > Subject: Listing modules from all installed packages > From: jpha...@gmail.com > To: p

Listing modules from all installed packages

2013-06-08 Thread Julien Phalip
Hi, I'm trying to write a function that programmatically obtains and returns the exact location of all first-level modules for all installed packages. For example, if the packages named 'django' and 'django-debug-toolbar' are installed, I'd like this function to return something like: >>> insta