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

Member Site Forums PyRosetta PyRosetta – General Can I export command line & result from iPython PyRosetta shell to a text file?

Viewing 1 reply thread
  • Author
    Posts
    • #1978
      Anonymous

        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.

      • #10234
        Anonymous

          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-multiple-destinations 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.

        • #10235
          Anonymous

            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

        Viewing 1 reply thread
        • You must be logged in to reply to this topic.