Use os.path.expanduser() in load_file

This commit is contained in:
Christophe Bedard 2019-10-13 16:10:49 -07:00
parent 2bf8aedac4
commit 8c77b3bbb4
2 changed files with 2 additions and 3 deletions

View file

@ -44,7 +44,6 @@
"sys.path.insert(0, '../')\n", "sys.path.insert(0, '../')\n",
"sys.path.insert(0, '../../../micro-ROS/ros_tracing/ros2_tracing/tracetools_read/')\n", "sys.path.insert(0, '../../../micro-ROS/ros_tracing/ros2_tracing/tracetools_read/')\n",
"import datetime as dt\n", "import datetime as dt\n",
"import os\n",
"\n", "\n",
"from bokeh.plotting import figure\n", "from bokeh.plotting import figure\n",
"from bokeh.plotting import output_notebook\n", "from bokeh.plotting import output_notebook\n",
@ -68,7 +67,6 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Process\n", "# Process\n",
"converted_file_path = os.path.expanduser(converted_file_path)\n",
"events = load_file(converted_file_path)\n", "events = load_file(converted_file_path)\n",
"handler = Ros2Handler.process(events)\n", "handler = Ros2Handler.process(events)\n",
"#handler.data.print_model()" "#handler.data.print_model()"

View file

@ -14,6 +14,7 @@
"""Module for converted trace file loading.""" """Module for converted trace file loading."""
import os
import pickle import pickle
from typing import Dict from typing import Dict
from typing import List from typing import List
@ -27,7 +28,7 @@ def load_file(file_path: str) -> List[Dict]:
:return: the list of events read from the file :return: the list of events read from the file
""" """
events = [] events = []
with open(file_path, 'rb') as f: with open(os.path.expanduser(file_path), 'rb') as f:
p = pickle.Unpickler(f) p = pickle.Unpickler(f)
while True: while True:
try: try: