Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
li213
DryVRtool
Commits
0f94a2c1
Commit
0f94a2c1
authored
Apr 30, 2020
by
chsieh16
Browse files
Add absolute path to sys.path to fake relative import dynamic models
parent
509cbce8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/common/utils.py
View file @
0f94a2c1
...
...
@@ -36,13 +36,20 @@ def importSimFunction(path):
simulation function
"""
path
=
path
.
replace
(
'/'
,
'.'
)
try
:
module
=
importlib
.
import_module
(
path
)
except
ImportError
:
# FIXME TC_Simulate should just be a simple call back function
import
os
import
sys
sys
.
path
.
append
(
os
.
path
.
abspath
(
path
))
mod_name
=
path
.
replace
(
'/'
,
'.'
)
module
=
importlib
.
import_module
(
mod_name
)
sys
.
path
.
pop
()
return
module
.
TC_Simulate
except
ImportError
as
e
:
print
(
"Import simulation function failed!"
)
return
module
.
TC_Simulate
print
(
e
)
exit
()
# TODO Proper return
def
randomPoint
(
lower
,
upper
):
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment