Skip to content

new version of redefine_temp_location throws an error #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sophiamaedler opened this issue Mar 20, 2025 · 0 comments · Fixed by #309
Closed

new version of redefine_temp_location throws an error #308

sophiamaedler opened this issue Mar 20, 2025 · 0 comments · Fixed by #309

Comments

@sophiamaedler
Copy link
Collaborator

starting with version 1.5.0

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 stitcher.stitch()

File ~/Documents/GitHub/scPortrait/src/scportrait/tools/stitch/_stitch.py:434, in Stitcher.stitch(self)
    432 """Generate the stitched mosaic."""
    433 self._perform_alignment()
--> 434 self._generate_mosaic()

File ~/Documents/GitHub/scPortrait/src/scportrait/tools/stitch/_stitch.py:429, in Stitcher._generate_mosaic(self)
    427 # ensure dtype is set correctly
    428 self.mosaic.dtype = np.uint16
--> 429 self._assemble_mosaic()

File ~/Documents/GitHub/scPortrait/src/scportrait/tools/stitch/_stitch.py:397, in Stitcher._assemble_mosaic(self)
    392 print(f"assembling mosaic with shape {shape}")
    394 # initialize tempmmap array to save assemled mosaic to
    395 # if no cache is specified the tempmmap will be created in the outdir
--> 397 self._create_cache()
    399 # create empty mmap array to store assembled mosaic
    400 hdf5_path = create_empty_mmap(shape, dtype=np.uint16, tmp_dir_abs_path=self.TEMP_DIR_NAME)

File ~/Documents/GitHub/scPortrait/src/scportrait/tools/stitch/_stitch.py:167, in Stitcher._create_cache(self)
    165 """Create a temporary cache directory for storing intermediate files during stitching."""
    166 if self.cache is None:
--> 167     TEMP_DIR_NAME = redefine_temp_location(self.outdir)
    168 else:
    169     TEMP_DIR_NAME = redefine_temp_location(self.cache)

File ~/mambaforge/envs/scportrait_test/lib/python3.12/site-packages/alphabase/io/tempmmap.py:117, in redefine_temp_location(path)
    114 _clear()
    116 # cleanup old temporary directory
--> 117 shutil.rmtree(TEMP_DIR_NAME, ignore_errors=True)
    119 # create new tempfile at desired location
    120 temp_dir_name = _init_temp_dir(prefix=os.path.join(path, "temp_mmap_"))

File ~/mambaforge/envs/scportrait_test/lib/python3.12/shutil.py:759, in rmtree(path, ignore_errors, onerror, onexc, dir_fd)
    757 try:
    758     while stack:
--> 759         _rmtree_safe_fd(stack, onexc)
    760 finally:
    761     # Close any file descriptors still on the stack.
    762     while stack:

File ~/mambaforge/envs/scportrait_test/lib/python3.12/shutil.py:669, in _rmtree_safe_fd(stack, onexc)
    667 assert func is os.lstat
    668 if orig_entry is None:
--> 669     orig_st = os.lstat(name, dir_fd=dirfd)
    670 else:
    671     orig_st = orig_entry.stat(follow_symlinks=False)

TypeError: lstat: path should be string, bytes or os.PathLike, not type
sophiamaedler added a commit that referenced this issue Mar 20, 2025
mschwoer added a commit that referenced this issue Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant