Turns out that the Twisted framework provides better introspective support than standard python, so problem solved!<br><br><a href="http://twistedmatrix.com/documents/8.2.0/api/twisted.python.modules.html#walkModules">http://twistedmatrix.com/documents/8.2.0/api/twisted.python.modules.html#walkModules</a><br>
<br><div class="gmail_quote">On Tue, Mar 31, 2009 at 8:12 AM, Brian <span dir="ltr"><<a href="mailto:Brian.Mingus@colorado.edu">Brian.Mingus@colorado.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I've used the C api to write a method that can call any python module function. I would like to extend the interface to allow dynamically listing all python modules, and for a given module all functions, and for a given function all argument types and the return types if possible.<div>



<br></div><div>Starting with the modules, I came up with this bit of code:</div><div><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">


from pkgutil import walk_packages;</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">

modules=[]</blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">

modules = [modules.append(item[1]) for item in walk_packages()]</blockquote><div><br></div><div>I then took this to my various systems for testing. It works fine on OSX and one of my Ubuntu boxes, but two of the Ubuntu boxes fail, each with a different error message.  The failure is due to python importing every single module and some of the modules failing. One example is the UniConverter package - towards the end of __init__.py it calls sys.exit(0) which kills the interpreter completely. <br>

</div><div><br></div><div>I've spent a ton of time trying to rewrite walk_packages to be robust to failure, but so far without luck. Any advice is appreciated.</div><div><br></div><font color="#888888"><div>/Brian</div>

</font></blockquote></div><br>