or you can replace with a file pointer:

import sys
mayaout = sys.stdout
fout = open('/var/tmp/log', 'w')
sys.stdout = fout
import doctest
doctest.testmod(verbose=True)
sys.stdout = mayaout
fout.close()





On Oct 8, 2008, at 8:36 AM, Olivier Renouard wrote:

>
> Redirecting stdout is done by setting sys.stdout.
>
> So in Maya this will reset stdout to it's default value :
>
> import sys
> mayaout = sys.stdout
> reload(sys)
> import doctest
> doctest.testmod(verbose=True)
> sys.stdout = mayaout
>
> Of course the results of doctest.testmod won't be diplayed in Maya's
> script editor then but in the standard output. On Linux for instance
> they will display in the terminal maya was launched from though.
>
> Olivier
>
>
> barnabas79 wrote:
>> Hey - I was wondering if anyone has gotten doctest to work
>> successfully from inside the script editor of a full-gui running  
>> maya.
>>
>> That is, doctest works fine if maya is started from within python via
>> maya.standalone.initialize(), but if I run a doctest from the script
>> editor, it never sees ANY output (and so all tests always fail).
>>
>> I'm sure this has something to do with maya's redirecting of stdout,
>> but before I start digging into it, I was wondering if anyone here  
>> had
>> already found a solution / workaround...
>>>
>>
>>
>
>
> -- 
> Olivier Renouard
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---

Reply via email to