Skip to content

Commit

Permalink
add try/except ModuleNotFoundError
Browse files Browse the repository at this point in the history
  • Loading branch information
patquem committed Sep 3, 2024
1 parent 34c4c21 commit b8ac0b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
8 changes: 6 additions & 2 deletions examples/ex_real_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
from pystack3d import Stack3d
from pystack3d.utils_metadata_fibics import params_from_metadata

from utils import init_dir, postpro, plot_results
from utils import UserTempDirectory # pylint: disable=unused-import
try:
from utils import init_dir, postpro, plot_results
from utils import UserTempDirectory # pylint: disable=unused-import
except ModuleNotFoundError:
from examples.utils import init_dir, postpro, plot_results
from examples.utils import UserTempDirectory

ASSETS = Path(__file__).parents[1] / 'assets'
DATA = ASSETS / 'stacks' / 'stack_1'
Expand Down
8 changes: 6 additions & 2 deletions examples/ex_real_stack_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

from pystack3d import Stack3d

from utils import init_dir
from utils import UserTempDirectory # pylint: disable=unused-import
try:
from utils import init_dir
from utils import UserTempDirectory # pylint: disable=unused-import
except ModuleNotFoundError:
from examples.utils import init_dir
from examples.utils import UserTempDirectory

ASSETS = Path(__file__).parents[1] / 'assets'
DATA = ASSETS / 'stacks' / 'stack_1'
Expand Down
12 changes: 7 additions & 5 deletions examples/ex_synthetic_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
"""
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from tempfile import TemporaryDirectory # pylint: disable=unused-import
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.ndimage import shift
from tifffile import imwrite, imread
from skimage.draw import line
from pyvsnr.utils import curtains_addition

import pystack3d
from pystack3d import Stack3d

from examples.utils import init_dir, postpro, plot_results, plot_cube_faces
from examples.utils import UserTempDirectory
try:
from utils import init_dir, postpro, plot_results, plot_cube_faces
from utils import UserTempDirectory # pylint: disable=unused-import
except ModuleNotFoundError:
from examples.utils import init_dir, postpro, plot_results, plot_cube_faces
from examples.utils import UserTempDirectory

POLICY = "slice_{slice_nb}_z={z_coord}um.tif"

Expand Down

0 comments on commit b8ac0b9

Please sign in to comment.