def list_packages(self):
        """ An ambitious function which attempts to list all Python packages
        in your system, according to the configuration """

        # First extract loaded module names from sys.modules
        sys_modules = sys.modules.keys()

        packages = {}

        # First add moduels in sys.modules (built-ins,
        # preloads and already loaded ones)
        for name in sys_modules:
            d = self.find_package(name)
            if not d: continue
            try:
                pkginfo = packages[d['type']]
                pkginfo[d['name']] = d['path']
            except Exception, e:
                packages[d['type']] = { d['name'] : d['path'] }

        import site
        # Loop through all directories in sys.path and check for modules
        # Dont iterate through <prefix>/lib directory
        libdir = os.path.join(sys.prefix, 'lib')
        
        walked = []
        for top_level in self.paths:
            if not os.path.isdir(top_level):
                continue

            # Dont iterate through libdir
            if os.path.abspath(top_level) == os.path.abspath(libdir):
                continue
            
            walked.append(top_level)
            for item in os.listdir(top_level):

                fullpath = os.path.join(top_level, item)
                if fullpath in walked: continue

                walked.append(fullpath)
                # Remove the extension
                idx = item.find('.')
                if idx != -1: item = item[:idx]
                d = self.find_package(item)
                if not d: continue
                try:
                    pkginfo = packages[d['type']]
                    pkginfo[d['name']] = d['path']
                except Exception, e:
                    packages[d['type']] = { d['name'] : d['path'] }                
                    
        for key,item in packages.items():
            print
            print self.pkgTypeInfo(key)
            print
            
            # Print sorted
            listofitems = item.keys()
            listofitems.sort()

            for key2 in listofitems:
                print key2,':',item[key2]
 An ambitious function which attempts to list all Python packages
        in your system, according to the configuration 
recipes/Python/440501_List_informatiabout_installed_Pythpackages/recipe-440501.py