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

glob on Windows #10

Open
mindtd opened this issue Jul 29, 2018 · 1 comment
Open

glob on Windows #10

mindtd opened this issue Jul 29, 2018 · 1 comment

Comments

@mindtd
Copy link

mindtd commented Jul 29, 2018

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.

@yuanxilee
Copy link

it's differnce bewteen windows and linux in path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants