I am using...

import __main__, os
os.environ['PYMOL_PATH'] = "C:\Python27\PyMOL"
 __main__.pymol_argv=["pymol","-qx"]
 import pymol
pymol.finish_launching()

... to launch PyMOL from another Python based program that has it's own GUI.

Is it possible for me to reroute the output from PyMOL to a file or string to avoid a command prompt spawning along with the PyMOL viewer?