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
154e7563
Commit
154e7563
authored
Oct 7, 2021
by
Fabio Vitello
Browse files
Options
Downloads
Patches
Plain Diff
#595 raise an exception if arguments are not numeric
parent
163f0a7f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Noto/Servers/NotoPyIfDistributor/src/_ifdist.py
+48
-36
48 additions, 36 deletions
Noto/Servers/NotoPyIfDistributor/src/_ifdist.py
with
48 additions
and
36 deletions
Noto/Servers/NotoPyIfDistributor/src/_ifdist.py
+
48
−
36
View file @
154e7563
...
@@ -77,6 +77,8 @@ def main(argv):
...
@@ -77,6 +77,8 @@ def main(argv):
commandstr
=
[]
commandstr
=
[]
try
:
if
int
(
argv
[
0
])
not
in
range
(
1
,
3
):
if
int
(
argv
[
0
])
not
in
range
(
1
,
3
):
sys
.
stderr
.
write
(
str
(
'
error Enter a valid input channel number
'
))
sys
.
stderr
.
write
(
str
(
'
error Enter a valid input channel number
'
))
userLogger
.
logError
(
"
Enter a valid input channel number
"
)
userLogger
.
logError
(
"
Enter a valid input channel number
"
)
...
@@ -101,6 +103,12 @@ def main(argv):
...
@@ -101,6 +103,12 @@ def main(argv):
selectedAtt
=
argv
[
2
]
selectedAtt
=
argv
[
2
]
except
ValueError
:
sys
.
stderr
.
write
(
str
(
'
error Enter a numeric value
'
))
userLogger
.
logError
(
"
Enter a numeric value
"
)
simpleClient
.
disconnect
()
sys
.
exit
(
1
)
#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
]]
...
@@ -115,11 +123,13 @@ def main(argv):
...
@@ -115,11 +123,13 @@ def main(argv):
commandstr
=
[
selectedInput
+
"
,
"
+
selectedPol
,
"
att
"
+
argv
[
0
]
+
"
,
"
+
selectedAtt
]
commandstr
=
[
selectedInput
+
"
,
"
+
selectedPol
,
"
att
"
+
argv
[
0
]
+
"
,
"
+
selectedAtt
]
answerstr
=
""
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
)
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
"
)
...
@@ -138,7 +148,9 @@ def main(argv):
...
@@ -138,7 +148,9 @@ def main(argv):
else
:
else
:
userLogger
.
logNotice
(
"
Answer: %s
"
%
(
answer
))
userLogger
.
logNotice
(
"
Answer: %s
"
%
(
answer
))
sys
.
stderr
.
write
(
str
(
answerstr
))
print
>>
sys
.
stderr
,
answerstr
.
replace
(
"
,
"
,
"
"
)
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
(
sys
.
argv
[
1
:])
main
(
sys
.
argv
[
1
:])
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