Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_python_template
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labrobotica
ros
iri_core
iri_python_template
Commits
863c7368
Commit
863c7368
authored
2 years ago
by
Fernando Herrero
Browse files
Options
Downloads
Patches
Plain Diff
Updates for python3
parent
3c4a6c2d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
launch/test.launch
+1
-1
1 addition, 1 deletion
launch/test.launch
src/venv_utils.py
+19
-5
19 additions, 5 deletions
src/venv_utils.py
with
21 additions
and
6 deletions
.gitignore
0 → 100644
+
1
−
0
View file @
863c7368
__*
This diff is collapsed.
Click to expand it.
launch/test.launch
+
1
−
1
View file @
863c7368
...
...
@@ -13,7 +13,7 @@
<arg
name=
"service_server_name"
value=
"/test_node/service"
/>
<arg
name=
"service_client_name"
value=
"/test_node/service"
/>
<arg
name=
"param_file"
value=
"$(find iri_python_template)/config/params.yaml"
/>
<arg
name=
"virtual_env_path"
value=
"$(
arg
virtual
_
env
_path)
"
/>
<arg
name=
"virtual_env_path"
value=
"$(
env HOME)/
virtualenv
/motion_prediction_venv
"
/>
</include>
<node
pkg=
"rostopic"
...
...
This diff is collapsed.
Click to expand it.
src/venv_utils.py
+
19
−
5
View file @
863c7368
import
sys
def
execfile
(
filepath
,
globals
=
None
,
locals
=
None
):
if
globals
is
None
:
globals
=
{}
globals
.
update
({
"
__file__
"
:
filepath
,
"
__name__
"
:
"
__main__
"
,
})
with
open
(
filepath
,
'
rb
'
)
as
file
:
exec
(
compile
(
file
.
read
(),
filepath
,
'
exec
'
),
globals
,
locals
)
def
activate_virtual_env
(
path
=
None
,
arg
=
'
--venv
'
):
"""
Activate Python Virtual Environment (virtualenv) within other python interpreter /or default interperter
...
...
@@ -17,15 +28,18 @@ def activate_virtual_env(path=None, arg='--venv'):
args
=
sys
.
argv
[
1
:]
path_to_venv
=
path
.
rstrip
(
'
/
'
)
if
path
is
not
None
else
args
[
args
.
index
(
arg
)
+
1
].
rstrip
(
'
/
'
)
activate_this
=
path_to_venv
+
activate_this
print
"
Activate Python Virtual Environment at:
"
+
str
(
path_to_venv
)
execfile
(
activate_this
,
dict
(
__file__
=
activate_this
))
print
(
"
Activate Python Virtual Environment at:
"
+
str
(
path_to_venv
))
#execfile(activate_this, dict(__file__=activate_this))
execfile
(
activate_this
)
return
True
except
ValueError
:
print
"
WARNING: No input path to Virtual ENV, will use default python
"
print
(
"
WARNING: No input path to Virtual ENV, will use default python
"
)
return
False
except
IOError
:
print
"
WARNING: Wrong Input Path to Virtual ENV, will use default python
"
print
(
"
WARNING: Wrong Input Path to Virtual ENV, will use default python
"
)
return
False
else
:
print
"
WARNING: No input path to Virtual ENV, will use default python
"
print
(
"
WARNING: No input path to Virtual ENV, will use default python
"
)
return
False
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