I have two python modules: buildContent.py which contains code that results in output i want. buildRun.py which i run in order to redirect the output to a file.
I'm trying to save the output from buildContent.py to a file and I did something like this in the buildRun.py:
import buildContent
import sys
with open('out.xhtml', 'w') as f:
sys.stdout = f
print buildContent
I can see my output in the console but the file result is:
<module 'buildContent' from 'here's my path to the file'>
what to do?
buildContent? What you're trying to do at the moment is like doingimport sys; print sys.buildRunand it works! Now the only problem is that i haveNoneprinted in the last line of the output file.printthe function. Just calling it is enough.