omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    sys.stdout.writelines()

    Pythonista
    2
    2
    2322
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • achorrath233
      achorrath233 last edited by

      I was trying out an example from the Python 2.7 documentation. It used sys.stdout.writelines(). This method failed with the following exception:

      'StdoutCatcher' object has no attribute 'writelines'
      

      What is StdoutCatcher?

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        Thanks for noticing, this is a bug. <code>StdoutCatcher</code> is a class that is used internally to redirect output to the console UI in Pythonista. You normally don't have to worry about it.

        The bug will be fixed in the next update. For now, you could replace the use of writelines in the sample code with something like this:

        <pre>for line in lines:
        sys.stdout.write(line + '\n')</pre>

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors