You are here

Can I export command line & result from iPython PyRosetta shell to a text file?

3 posts / 0 new
Last post
Can I export command line & result from iPython PyRosetta shell to a text file?
#1

Dear Sir or Madam,
I know we can use cmd.exe to export command line by using

python name.py > name.txt

However, we cannot see anything in the cmd.exe if we do that.

I am thinking can we export result from iPython to a text file? I was trying

run name.py > name.txt

But I think the file of "name.txt" has not been created.

Can you please help me? Thank you very much.

Category: 
Post Situation: 
Mon, 2014-08-25 04:05
lanselibai

You may have more luck asking on a python or ipython specific forum, as the syntax to do so generally wouldn't be PyRosetta specific.

One complication you may have is that the C++ layer of PyRosetta goes through a different output path than the Python-level output does. By default, PyRosetta is set up to direct the output through the logging module of Python (https://docs.python.org/2/library/logging.html), if applicable, rather than just sys.stdout. See https://docs.python.org/2/howto/logging.html and https://docs.python.org/2/howto/logging-cookbook.html for details on how to use the logging module. You need to set up the logger to redirect the output to the appropriate locations prior to calling rosetta.init()

If you want logging to go to both a file and the terminal, see https://docs.python.org/2/howto/logging-cookbook.html#logging-to-multipl... for an example. This wouldn't capture any python-level output you make, though (unless you also output it through a logger), and wouldn't maintain a copy of the commands you typed.

Mon, 2014-08-25 10:47
rmoretti

Hi rmoretti,
Many thanks for your help indeed. But it seems to be quite technical to me. I will try to understand it slowly.

Yours sincerely
Cheng

Tue, 2014-08-26 01:49
lanselibai