James Xu created STORM-105:
------------------------------

             Summary: storm.py should turn off sysout to avoid python code 
interfering with data exchange
                 Key: STORM-105
                 URL: https://issues.apache.org/jira/browse/STORM-105
             Project: Apache Storm (Incubating)
          Issue Type: Improvement
            Reporter: James Xu
            Priority: Minor


https://github.com/nathanmarz/storm/issues/351

I ran across this issue because I was trying to wrap an existing python script 
as a bolt and it had prints in it. This will mess up the tuple emits from the 
python bolt. I recommend that you add some code like this to the storm.py 
script to avoid the problem...

    #turn off stdout to avoid messing with JSON payload sent back to JAVA layer
    original_stdout = sys.stdout  # keep a reference to STDOUT
    sys.stdout = NullDevice()

    try:
        //callout to bolt process method
    finally:
        sys.stdout = original_stdout; # turn back on to allow emit to work



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to