Skip to content
Snippets Groups Projects
Commit 54c8bb72 authored by Fabio Vitello's avatar Fabio Vitello
Browse files

#595 fixed stderr print

parent 74f36229
No related branches found
No related tags found
No related merge requests found
...@@ -78,26 +78,30 @@ def main(argv): ...@@ -78,26 +78,30 @@ def main(argv):
commandstr=[] commandstr=[]
if int(argv[0]) not in range (1,3): if int(argv[0]) not in range (1,3):
userLogger.logError("Enter input channel number (allowed 1 or 2), your input %s" %(argv[0])) sys.stderr.write(str('error Enter a valid input channel number'))
userLogger.logError("Enter a valid input channel number")
simpleClient.disconnect() simpleClient.disconnect()
sys.exit(1) sys.exit(1)
selectedInput='input'+argv[0] selectedInput='input'+argv[0]
if int(argv[1]) not in range (-1,7): if int(argv[1]) not in range (-1,7):
userLogger.logError("Enter an allowed value for pol (-1 to not change the pol value or 0-6 to set pol), your input %s" %(argv[0])) sys.stderr.write(str('error Enter an allowed value for pol'))
userLogger.logError("Enter an allowed value for pol")
simpleClient.disconnect() simpleClient.disconnect()
sys.exit(1) sys.exit(1)
selectedPol=argv[1] selectedPol=argv[1]
if float(argv[2]) not in range (-1,64): if float(argv[2]) not in range (-1,64):
userLogger.logError("Enter an allowed value for att (-1 to get att value or 0-63 to set att), your input %s" %(argv[0])) sys.stderr.write(str('error Enter an allowed value for att'))
userLogger.logError("Enter an allowed value for att")
simpleClient.disconnect() simpleClient.disconnect()
sys.exit(1) sys.exit(1)
selectedAtt=argv[2] selectedAtt=argv[2]
answer = []
#if selectedPol and selectedAtt are -1 print information on current pol and att #if selectedPol and selectedAtt are -1 print information on current pol and att
if int(selectedPol) == -1 and float(selectedAtt)==-1: if int(selectedPol) == -1 and float(selectedAtt)==-1:
commandstr=[selectedInput,"att"+argv[0]] commandstr=[selectedInput,"att"+argv[0]]
...@@ -111,14 +115,16 @@ def main(argv): ...@@ -111,14 +115,16 @@ def main(argv):
elif int(selectedPol) != -1 and float(selectedAtt) !=-1: elif int(selectedPol) != -1 and float(selectedAtt) !=-1:
commandstr=[selectedInput+","+selectedPol, "att"+argv[0]+","+selectedAtt] commandstr=[selectedInput+","+selectedPol, "att"+argv[0]+","+selectedAtt]
answerstr = ""
for i in range(0,len(commandstr)): for i in range(0,len(commandstr)):
userLogger.logNotice("IFDist setup according to %s command"%(commandstr[i])) userLogger.logNotice("IFDist setup according to %s command"%(commandstr[i]))
answer=send_command(ip,port, commandstr[i]) answer=send_command(ip,port, commandstr[i])
answerstr+=str(answer)
if answer=="Fail": if answer=="Fail":
newEx = ComponentErrorsImpl.SocketErrorExImpl() newEx = ComponentErrorsImpl.SocketErrorExImpl()
add_user_message(newEx,"Unable to communicate to IFDist") add_user_message(newEx,"Unable to communicate to IFDist")
sys.stderr.write('error Unable to communicate to IFDist') sys.stderr.write(str('error Unable to communicate to IFDist'))
userLogger.logError(newEx) userLogger.logError(newEx)
simpleClient.disconnect() simpleClient.disconnect()
sys.exit(1) sys.exit(1)
...@@ -126,13 +132,14 @@ def main(argv): ...@@ -126,13 +132,14 @@ def main(argv):
elif answer[0]=="NAK": elif answer[0]=="NAK":
newEx = ComponentErrorsImpl.NakExImpl() newEx = ComponentErrorsImpl.NakExImpl()
add_user_message(newEx,"IFDist command error") add_user_message(newEx,"IFDist command error")
sys.stderr.write('error IFDist command error') sys.stderr.write(str('error IFDist command error'))
userLogger.logError(newEx) userLogger.logError(newEx)
simpleClient.disconnect() simpleClient.disconnect()
sys.exit(1) sys.exit(1)
else: else:
sys.stderr.write(answer)
userLogger.logNotice( "Answer: %s"%(answer)) userLogger.logNotice( "Answer: %s"%(answer))
sys.stderr.write(str(answerstr))
if __name__=="__main__": if __name__=="__main__":
main(sys.argv[1:]) main(sys.argv[1:])
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment