openmc-dev/openmc

File path handeling problems when exporting TSL ace files

Opened this issue · 2 comments

Bug Description

When using openmc.data.ThermalScattering.from_njoy(), the ACE file is written to a temporary output_dir, but the function attempts to read it from the current working directory, causing a FileNotFoundError.

I have already developed a fix and will be proposing a pull request later today.

Steps to Reproduce

  1. Call openmc.data.ThermalScattering.from_njoy() with the ace parameter set to a filename (e.g., HinH2O.ace).
  2. Observe that the function writes the ACE file to a temporary output_dir but tries to read it from the current working directory.
  3. A FileNotFoundError is raised because the ACE file doesn't exist at the expected location.

Environment

OS: Ubuntu 24.04.1 LTS \n \l
OpenMC: develop branch, compiled and installed from source. openmc.__version__ reports 0.15.1.dev0

Thanks for reporting @janmalec. I'll keep an eye out for the PR and we should be able to get it merged quickly.

Upon further testing I found out another issue that happens when the ace file is put in a subfolder. The issue also appears with the original OpenMC code. I'll fix that too before pushing.

edit: I think it should be ok. I cannot reproduce any issue right now.