Describe the bug
Using MontePy 0.4.1 when running the example script (demo/demo.ipynb) fails in the final cell when attempting to open a file that does not exist: parametric/pin_cell_0.35r_1.0p.imcnp. The sub-directory parametric does not exist, if that sub-directory is manually generated by the user then things proceed without a hitch.
My guess is this is a Mac only bug
To Reproduce
Run the final cell in in /demo/demo.ipynb
Error Message (if any)
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[10], line 17
15 for plane in box_walls:
16 plane.location = (pitch / 2) * (-1 if plane.location < 0 else 1)
---> 17 problem.write_to_file(f\"parametric/pin_cell_{pin_radius}r_{pitch}p.imcnp\")
File /opt/homebrew/Caskroom/mambaforge/base/envs/mcdc-env/lib/python3.11/site-packages/montepy/mcnp_problem.py:529, in MCNP_Problem.write_to_file(self, file_path, overwrite)
514 def write_to_file(self, file_path, overwrite=False):
515 \"\"\"
516 Writes the problem to a file.
517
(...)
527 :raises IsADirectoryError: if the path given is actually a directory.
528 \"\"\"
--> 529 return self.write_problem(file_path, overwrite)
File /opt/homebrew/Caskroom/mambaforge/base/envs/mcdc-env/lib/python3.11/site-packages/montepy/mcnp_problem.py:507, in MCNP_Problem.write_problem(self, destination, overwrite)
505 elif isinstance(destination, (str, os.PathLike)):
506 new_file = MCNP_InputFile(destination, overwrite=overwrite)
--> 507 with new_file.open(\"w\") as fh:
508 self._write_to_stream(fh)
509 else:
File /opt/homebrew/Caskroom/mambaforge/base/envs/mcdc-env/lib/python3.11/site-packages/montepy/input_parser/input_file.py:133, in MCNP_InputFile.open(self, mode, encoding, replace)
129 if os.path.isdir(self.path):
130 raise IsADirectoryError(
131 f\"{self.path} is a directory, and cannot be overwritten.\"
132 )
--> 133 self._fh = open(self.path, mode, encoding=encoding)
134 return self
FileNotFoundError: [Errno 2] No such file or directory: 'parametric/pin_cell_0.35r_1.0p.imcnp'"
Describe the bug Using MontePy 0.4.1 when running the example script (
demo/demo.ipynb
) fails in the final cell when attempting to open a file that does not exist:parametric/pin_cell_0.35r_1.0p.imcnp
. The sub-directoryparametric
does not exist, if that sub-directory is manually generated by the user then things proceed without a hitch.My guess is this is a Mac only bug
To Reproduce
Run the final cell in in
/demo/demo.ipynb
Error Message (if any)
Version
Additional context
This is part of the PyOpenSci review!