Skip to content

Error reading NWB file while session cache is instantiated in workspace #2693

Open
@slcalgin

Description

@slcalgin

Hi there,
I'm working on a script that downloads data from Neuropixels dataset using the EcephysProjectCache. Below is how I download the data from sessions - no problem here, just for reference:

self.cache = EcephysProjectCache.from_warehouse(manifest=manifest_path)
self.session = self.cache.get_session_data(self.session_id)

In this script I want to be able to use the API to access data, but also want to be able to read and write to the NWB file. However, when I go to open the NWB file:

with NWBHDF5IO(nwbfilepath, mode="r+", load_namespaces=True) as io:
     io.read(path_to_nwb)

I get the following error: OSError: Unable to open file (file is already open for read-only).

I have confirmed that the file is not open elsewhere in my code or device. I'm assuming that the session cache has the file open in the backend somewhere in order to access the data. But I'm not sure why this is necessary if the NWBFile object is already stored within the session object (session.api.nwbfile). Would this be correct? Do you know of a way to workaround this?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions