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

findSequenceOnDisk is case sensitive on windows #74

Closed
p0las opened this issue Jun 27, 2019 · 5 comments
Closed

findSequenceOnDisk is case sensitive on windows #74

p0las opened this issue Jun 27, 2019 · 5 comments
Labels

Comments

@p0las
Copy link

p0las commented Jun 27, 2019

os.path on windows is case insensitive.
os.path.exists(some_file) returns True regardless of case
findSequenceOnDisk uses glob which is case sensitive and returns no files if the case is incorrect. This leads to a weird code where you check if the file exists and when it does you try to get the sequence which raises an exception that there are no files.

@justinfx
Copy link
Owner

Thanks for the report. Do you want to submit a merge request with a fix and test for windows?

@p0las
Copy link
Author

p0las commented Jun 27, 2019

I'm not sure what the best solution is. Forking the code inside with "if windows" can lead to some unexpected differences in the future. On our end, we use a wrapper on top of this class so I fixed it there (we are 100% windows at the moment).
if you are happy with an if statement and regex instead of glob (fnmatch.translate) I can attempt to fix it.

@justinfx
Copy link
Owner

I see. I figured you might have had some local fixes since you have already investigated the issue, so a merge request would have saved time. But since you have a fix at an abstraction layer, we will just leave this as a bug to be fixed when someone has the time.
I haven't looked into the code to see what would be the best solution.

@justinfx justinfx added the bug label Jun 27, 2019
@p0las
Copy link
Author

p0las commented Jun 27, 2019

as far as I know the only way to make glob case insensitive it by converting it to regex with something like this:

rule = re.compile(fnmatch.translate(os.path.basename(p)), re.IGNORECASE)
folder = os.path.dirname(p)
globbed_file_names = [f for f in os.listdir(folder) if rule.match(f)]

however this means replacing most of the logic in findSequenceOnDisk just for windows.

@justinfx
Copy link
Owner

justinfx commented Jun 4, 2022

Closing via #107

@justinfx justinfx closed this as completed Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants