question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File path not found sorting in container

See original GitHub issue

The filepats of my recording is not found when running sorting algorithm using a docker file.

sorting_TDC = ss.run_tridesclous(
    recording,
    output_folder="tridesclous_output",
    docker_image="spikeinterface/tridesclous-base:1.6.4",
)

The way it tries to find it is by using this method (see #L170-L207)

def find_recording_folder(d):
    if "kwargs" in d.keys():
        # handle nested
        kwargs = d["kwargs"]
        nested_extractor_dict = None
        for k, v in kwargs.items():
            if isinstance(v, dict) and is_dict_extractor(v):
                nested_extractor_dict = v
        if nested_extractor_dict is None:
            folder_to_mount = find_recording_folder(kwargs)
        else:
            folder_to_mount = find_recording_folder(nested_extractor_dict)
        return folder_to_mount
    else:
        for k, v in d.items():
            if "path" in k:
                # paths can be str or list of str
                if isinstance(v, str):
                    # one path
                    abs_path = Path(v)
                    if abs_path.is_file():
                        folder_to_mount = abs_path.parent
                    elif abs_path.is_dir():
                        folder_to_mount = abs_path
                elif isinstance(v, list):
                    # list of path
                    relative_paths = []
                    folder_to_mount = None
                    for abs_path in v:
                        abs_path = Path(abs_path)
                        if folder_to_mount is None:
                            folder_to_mount = abs_path.parent
                        else:
                            assert folder_to_mount == abs_path.parent
                else:
                    raise ValueError(
                        f'{k} key for path  must be str or list[str]')
            return folder_to_mount

But that gives me the following error: UnboundLocalError: local variable 'folder_to_mount' referenced before assignment

d in my case (neuropixel 2.0 dual recording) looks like this:

{'class': 'spikeinterface.extractors.neoextractors.openephys.OpenEphysBinaryRecordingExtractor',
 'module': 'spikeinterface',
 'kwargs': {'all_annotations': False,
  'stream_id': '0',
  'folder_path': '/Volumes/FK_Fileserver1/Project_NP_optogenetics/data/raw/NP6/2022-06-29_17-15-43'},
 'dumpable': True,
 'version': '0.94.1.dev0',

So I think the line return folder_to_mount should be one tab up or outside the for loop 😃

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
LiesDeccommented, Jul 4, 2022

@alejoe91 as far as I can tell now this works for me! thank you for the quick fix 👌

1reaction
samuelgarciacommented, Jul 1, 2022

@yger a the same problem. I will have a look

Read more comments on GitHub >

github_iconTop Results From Across the Web

Confused by Docker directory structure (file not found error)
I tried this program in my docker container and it worked fine. ... IO.File.ReadAllText(path); Console.WriteLine(text);.
Read more >
Visual Studio Test Explorer FAQ - Microsoft Learn
There is no longer a "File Path" filter in the Test Explorer search box. ... The following TestContainer was not found {} at...
Read more >
Editing Python in Visual Studio Code
The Python: Run Selection/Line in Python Terminal command (Shift+Enter) is a simple way to take whatever code is selected, or the code on...
Read more >
Fix list for Rational ClearCase - IBM
This document contains a complete listing of releases, refreshes, fix packs and interim fixes sorted by version for IBM® Rational ClearCase.
Read more >
FileMaker error codes | Claris Pro and FileMaker Pro Help
Files are damaged or missing and must be reinstalled ... No access to field(s) in sort order ... File path specified is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found