[Distutils] Clearing WorkingSet in pkg_resources... ?

David Lyon david.lyon at preisshare.net
Sun May 17 04:24:46 CEST 2009


I'm using working set and I have come into an issue.

In my package manager I can now install packages and deinstall fine.

The problem that I now face is want to refresh WorkingSet after
a package has been deinstalled.

Or, I need to do the refresh when swapping to a different version
of python that is installed on the system.

Code looks something like this:

    def installed_packages(self):

        result = []
        if not self.interpreted:

        import pkg_resources

        ws = pkg_resources.WorkingSet()

        for i in ws:
            s = str(i)
            result.append(s.split(' '))

        return result

More information about the Distutils-SIG mailing list