Skip to content
Snippets Groups Projects
Commit 863c7368 authored by Fernando Herrero's avatar Fernando Herrero
Browse files

Updates for python3

parent 3c4a6c2d
No related branches found
No related tags found
No related merge requests found
__*
......@@ -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"
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment