#NEWLINE# def send_zephyr( zwrite_args , content ) : #NEWLINE# #INDENT# p = subprocess . Popen ( zwrite_args , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) #NEWLINE# ( stdout , stderr ) = p . communicate ( input = content . encode ( 'utf-8' ) ) #NEWLINE# if p . returncode : #NEWLINE# #INDENT# logger . error ( ( "zwrite command '%s' failed with return code %d:" % ( ' ' . join ( zwrite_args ) , p . returncode ) ) ) #NEWLINE# if stdout : #NEWLINE# #INDENT# logger . info ( ( 'stdout: ' + stdout ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if stderr : #NEWLINE# #INDENT# logger . warning ( ( "zwrite command '%s' printed the following warning:" % ( ' ' . join ( zwrite_args ) , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if stderr : #NEWLINE# #INDENT# logger . warning ( ( 'stderr: ' + stderr ) ) #NEWLINE# #UNINDENT# return ( p . returncode , stderr )