Skip to content
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

[BUG] File path cannot be properly resolved on Windows #334

Open
Mr-Milk opened this issue Nov 15, 2023 · 1 comment
Open

[BUG] File path cannot be properly resolved on Windows #334

Mr-Milk opened this issue Nov 15, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@Mr-Milk
Copy link

Mr-Milk commented Nov 15, 2023

Description

When I create a Dataset on Windows platform, it cannot retrieved existed tfrecords.

To Reproduce

Create a dataset like the following, with tfrecords in the folder, the slideflow will return a empty list.

import pandas as pd
import slideflow as sf

annos = pd.read_csv(r"D:\projects\slideflow_project\annos.csv")
dataset = sf.Dataset(
    tfrecords=r"D:\projects\slideflow_project\tfrecords",
    slides=r"D:\data\svs",
    annotations=annos,
    tile_px=512,
    tile_um=256,
)

print(dataset.tfrecords())

Expected behavior

Slideflow should recognize and pick up all tfrecords

Environment:

  • Slideflow Version (e.g., 1.0): 2.2
  • OS (e.g., Ubuntu): Windows 10
  • How you installed Slideflow (pip, source): pip
  • Python version: 3.10
  • CUDA/cuDNN version: No
  • GPU models and configuration: No
  • Any other relevant information: No

Potential cause

I think this is related to how path is handled in slideflow

The following code will produce D:\\data\\data instead of data

from slideflow.util import path_to_name

path_to_name(r"D:\data\data.csv")

But if I create a Windows path using a Linux-style path, it will work.

I have a question, why not use the standard library pathlib to handle path instead of using the os

@Mr-Milk Mr-Milk added the bug Something isn't working label Nov 15, 2023
@jamesdolezal
Copy link
Owner

jamesdolezal commented Nov 15, 2023

Thanks for this bug report. Slideflow is not officially supported or tested on Windows (see docs), but I think it would be fairly straightforward to resolve this issue. We try to be OS-agnostic where possible, but we don't have a Windows testing pipeline set up.

Switching to pathlib in the backend could be one solution for resolving Windows path issues. We'll do some digging and see what would be the best long-term solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants