Skip to content

glob on Windows #10

Description

@mindtd

When running on Windows, the '/' will result in error, int() problem with string.

Workaround is to change '/' to double backslash '\\', specifically:

  1. def get_class(img_path):
    return int(img_path.split('\\')[-2])

  2. root_dir = 'GTSRB_Final_Training_Images\\GTSRB\\Final_Training\\Images\\'

  3. all_img_paths = glob.glob(os.path.join(root_dir, '* \\ *.ppm'))

That fixed the int() error.

Coding solution will be:

  1. def get_class(img_path):
    return int(img_path.split(os.sep)[-2])

  2. as is, non issue.

  3. all_img_paths = glob.glob(os.path.join(root_dir, os.path.join(' * ', ' *.ppm')))

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions