Tony Cappellini wrote: >> PS To import a file whose name is in a variable (string), see __import__(). > > I've started doing the import instead of exec/eval , but the person > who wrote the module being called, started using the logging module. > Now I can't capture the output of the module I'm calling, and display > it in a GUI. I was using popen() previously and that worked fine, > until he started using logging
Rereading your past postings a little bit, what you really have is bad architecture. If I understand you, you have a python cmdline app that does something useful. You have users who aren't comfortable with the command line, so you are writing a GUI wrapper that calls the cmdline app with popen(). A better approach is to turn the functional part of the cmdline app - the code that does the real work - into an importable module. Then your GUI app can import and use this module directly, instead of doing hacks with popen() and stdout. You don't even need a separate module for the cmdline app if it is written correctly - the command-line-specific part can be in an main() function that is only called if the module is run as main. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor