Skip to content

WFDB path ignored #545

Done
Done

Description

@cve2022

The wfdb C package uses the WFDB environment variable to look for records locations.

wfdb-python apparently ignores this environment variable and I could not find a way to use or set it in the documentation.

I have worked around it using a wrapper, but I would like to know if there is any plan to support this feature.

Activity

  1. tompollard commented on Nov 29, 2026

    @tompollard
    Member

    Thanks for raising this, and sorry for the slow reply. wfdb-python deliberately reads the path it's given rather than searching for records, so that it's always clear which file was read. We'd like to keep that, but we could add an explicit search step, along these lines:

    path = wfdb.find_record("mitdb/100", search_path=["/data/physionet", "."])
    record = wfdb.rdrecord(path)  # path is the full location that was found

    find_record would return the path to the first folder in search_path that contains the record, and raise an error listing the folders it searched if none does. A helper could also read the folders listed in your WFDB environment variable, for example search_path=wfdb.wfdb_search_path(), but only when you ask for it.

    Is this still something you need, and would this approach meet your needs? It would also help to know a little about your setup. For example, do you keep a record's files (such as signals and annotations) in different folders, or use entries in WFDB other than local folders?

  2. tompollard commented on Dec 1, 2026

    @tompollard
    Member

    This is now available in wfdb 5.12.0 via #824. The search is explicit: wfdb.find_record("mitdb/100", search_path=wfdb.wfdb_search_path()) returns the first matching local record path, which you can pass to wfdb.read_record(...). You can also pass your own ordered list of directories as search_path. Readers still use exactly the path they receive; they do not silently consult WFDB. The helper supports local directories separated by the OS path separator, but not every form accepted by the C library (such as URL entries or indirect path files). If your setup relies on one of those forms, please let us know and we can track that separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions