[csw-devel] SF.net SVN: opencsw:[583] twitter/sweets/sweets.py

skayser at users.sourceforge.net skayser at users.sourceforge.net
Thu Oct 27 23:01:16 CEST 2011


Revision: 583
          http://opencsw.svn.sourceforge.net/opencsw/?rev=583&view=rev
Author:   skayser
Date:     2011-10-27 21:01:16 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
twitter/sweets: only encode stdout output when running interactively

Modified Paths:
--------------
    twitter/sweets/sweets.py

Modified: twitter/sweets/sweets.py
===================================================================
--- twitter/sweets/sweets.py	2011-10-27 20:59:35 UTC (rev 582)
+++ twitter/sweets/sweets.py	2011-10-27 21:01:16 UTC (rev 583)
@@ -108,7 +108,8 @@
                 tweet['from_user'],
                 tweet['id_str']
             )
-            print msg.encode(sys.stdout.encoding, 'replace')
+            if os.isatty(1): msg = msg.encode(sys.stdout.encoding, 'replace')
+            print msg
 
 
 def twitter_search_mock(query="", state=""):

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list