Open MikeFindsThings opened 5 years ago
Feel free to make a pull request, I haven't run into this particular issue because I'm not using NTFS and none of my profs are using invalid characters in their classes.
This looks like a good start.
I might try to PR in santize_filename
from pathvalidate when I can find time.
https://github.com/Gigahawk/canvas-file-scraper/blob/ca39011ed5f5c53f3c29f0562a53d6219d5efff0/canvas-scraper.py#L52
Expected Behavior: To create /file/className/moduleName
Current Behavior: Correctly creates /file/className/ but returns the following error when trying to create the module name Traceback (most recent call last): File "D:/Python/projects/canvas-file-scraper/canvas-scraper.py", line 52, in
os.makedirs(module_path, exist_ok=True)
File "D:\Python\lib\os.py", line 221, in makedirs
mkdir(name, mode)
NotADirectoryError: [WinError 267] The directory name is invalid: '.\./files\className\January 14-20: Introduction and Welcome Module'
Possible Solution: Parse class and module names for characters not allowed in directory names.
Context: Win10, Python 3.7
Detailed Description: When running canvas-scraper, python throws an error when it encounters a class or module name containing characters that are not valid for directory names.