Change import statements with try except to enable explicit import of submodules from import to avoid conflicts with parent project.

This commit is contained in:
2025-02-22 17:10:53 +01:00
parent c28286a626
commit 821d314cb6
10 changed files with 56 additions and 19 deletions

View File

@ -22,9 +22,15 @@ from datetime import datetime
from itertools import chain
# Import DIMA modules
import src.hdf5_writer as hdf5_lib
import utils.g5505_utils as utils
from instruments.readers import filereader_registry
try:
from dima.src import hdf5_writer as hdf5_lib
from dima.utils import g5505_utils as utils
from dima.instruments.readers import filereader_registry
except ModuleNotFoundError:
print(':)')
import src.hdf5_writer as hdf5_lib
import utils.g5505_utils as utils
from instruments.readers import filereader_registry
allowed_file_extensions = filereader_registry.file_extensions

View File

@ -15,7 +15,12 @@ if dimaPath not in sys.path: # Avoid duplicate entries
import h5py
import yaml
import src.hdf5_ops as hdf5_ops
try:
from dima.src import hdf5_ops as hdf5_ops
except ModuleNotFoundError:
import src.hdf5_ops as hdf5_ops
def load_yaml(review_yaml_file):