Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
ab9de209
Unverified
Commit
ab9de209
authored
Apr 24, 2019
by
SparkSnail
Committed by
GitHub
Apr 24, 2019
Browse files
Show error message when load yaml file failed (#1012)
parent
8531d809
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
tools/nni_cmd/common_utils.py
tools/nni_cmd/common_utils.py
+7
-4
No files found.
tools/nni_cmd/common_utils.py
View file @
ab9de209
...
...
@@ -32,9 +32,12 @@ def get_yml_content(file_path):
try
:
with
open
(
file_path
,
'r'
)
as
file
:
return
yaml
.
load
(
file
,
Loader
=
yaml
.
Loader
)
except
TypeError
as
err
:
print
(
'Error: '
,
err
)
return
None
except
yaml
.
scanner
.
ScannerError
as
err
:
print_error
(
'yaml file format error!'
)
exit
(
1
)
except
Exception
as
exception
:
print_error
(
exception
)
exit
(
1
)
def
get_json_content
(
file_path
):
'''Load json file content'''
...
...
@@ -42,7 +45,7 @@ def get_json_content(file_path):
with
open
(
file_path
,
'r'
)
as
file
:
return
json
.
load
(
file
)
except
TypeError
as
err
:
print
(
'E
rror
: '
,
err
)
print
_e
rror
(
'json file format error!'
)
return
None
def
print_error
(
content
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment