On Nov 7, 4:47 pm, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Has anyone ever tried mucking with pydoc to the point where you can > > get it to give you output from a string input? For example I'd like > > to give it a whole module to generate documentation for but all within > > a string: > > > #little sample > > > module_code=''' > > """Module docstring""" > > > def func1(): > > """ some docstring""" > > pass > > > ... > > > ''' > > > pydoc.html(module_code) -> HTML output as a string > > > Any ideas? > > The problem with this is that your module can do relative imports, and > it DOES matter where your module is located in the filesystem. > > In the very unlikely case when you store your modules in an external > system (e.g in a database), and you use __import__ hacks to run your > code, I would recommend to write a program that exports your stored > modules into a real filesystem and run pydoc there. > > Regards, > > Laszlo
That's a good point. I was mainly thinking about the case of simple modules with no other imports. But looking at pydoc's code, it looks like it would be quite a bit of work to make it work at all. -Greg -- http://mail.python.org/mailman/listinfo/python-list