Pkg iter_module for different versions of python

J A jayrod84 at gmail.com
Sun Feb 9 10:46:01 EST 2020


as a sysadmin I've written several small tools as python command line apps
that get installed with python setup.py install. I would now like to create
another tool that would quickly list out all of my custom tools that may be
installed on the system. so that others can get a quick menu of what
commands are available. I believe I have a working app that uses the
iter_modules function to list out all of the names and then I just filter
based on names that I know to be mine.

My problem.. This works if everyone of my tools is only written in python 3
or 2, but not both. Are there any tricks to getting iter_modules to return
both python 3 and 2 installed modules?

J


More information about the Python-list mailing list