Minor issue in running example
When I did cd doc/source/examples && python basic_data_handling
, it failed to run.
Traceback (most recent call last):
File "basic_data_handling.py", line 16, in <module>
data = read_data(Path(__file__).parent.parent / "_static" / "HBT_vbc.elpa")
File "/home/dilawar/Work/GITHUB/JOSS/DMT-core/DMT/core/data_reader.py", line 93, in read_data
df = read_elpa(filename)
File "/home/dilawar/Work/GITHUB/JOSS/DMT-core/DMT/core/data_reader.py", line 268, in read_elpa
with open(filename, "r") as my_file:
FileNotFoundError: [Errno 2] No such file or directory: '_static/HBT_vbc.elpa'
But cd doc/source && python examples/basic_data_handling.py
worked!
The following changes fixed this issue:
# read data using the given method
-data = read_data(Path(__file__).parent.parent / "_static" / "HBT_vbc.elpa")
+data = read_data(Path(__file__).resolve().parent.parent / "_static" / "HBT_vbc.elpa")
# "clean" the data so we have DMT-specifier in it.
# This ensure that the read-in data is consistent with the DMT specifiers.
@@ -52,7 +52,7 @@ for _index, vbc, data_vbc in data.iter_unique_col(col_vbc, decimals=3):
plot.plot_pyqtgraph()
# save the plot as tikz and build it
plot.save_tikz(
- Path(__file__).parent.parent / "_static",
+ Path(__file__).resolve().parent.parent / "_static",
standalone=True,
build=True,
clean=True,
Surprisingly Path(__file__).parent
and Path(__file__).resolve().parent
are not equivalent. I also tried using resolve()
in read_data
function before passing the filename to the inner function that reads the file. It didn't work! I guess foo.resolve().parent
, foo.parent.resolve()
and foo.parent
are different things.
PS: It is not necessary to resolve this right away for review. I don't think it qualifies as a bug.
Edited by Dilawar Singh