Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DISCOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INAF
DISCOS
Commits
54c8bb72
Commit
54c8bb72
authored
3 years ago
by
Fabio Vitello
Browse files
Options
Downloads
Patches
Plain Diff
#595 fixed stderr print
parent
74f36229
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Noto/Servers/NotoPyIfDistributor/src/_ifdist.py
+13
-6
13 additions, 6 deletions
Noto/Servers/NotoPyIfDistributor/src/_ifdist.py
with
13 additions
and
6 deletions
Noto/Servers/NotoPyIfDistributor/src/_ifdist.py
+
13
−
6
View file @
54c8bb72
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment