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

Long Filename Error #20

Open
dsalzman opened this issue Jun 9, 2020 · 1 comment
Open

Long Filename Error #20

dsalzman opened this issue Jun 9, 2020 · 1 comment

Comments

@dsalzman
Copy link

dsalzman commented Jun 9, 2020

CanvasSync fails with extra long filenames. Ideally it would truncate the filename or just skip the file without failing.

[SYNCED] | Module: Canvas Notes
Traceback (most recent call last):
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/bin/canvas", line 8, in
sys.exit(entry())
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/bin/canvas.py", line 187, in entry
run_canvas_sync()
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/bin/canvas.py", line 132, in run_canvas_sync
main_menu(settings)
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/bin/canvas.py", line 147, in main_menu
main_menu(settings)
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/bin/canvas.py", line 154, in main_menu
do_sync(settings, "")
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/bin/canvas.py", line 170, in do_sync
synchronizer.sync()
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/synchronizer.py", line 126, in sync
course.sync()
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/course.py", line 163, in sync
child.sync()
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/module.py", line 166, in sync
self.add_items()
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/module.py", line 144, in add_items
self.add_sub_header(folder[0], position + 1, folder[1:])
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/module.py", line 84, in add_sub_header
sub_folder = SubHeader(folder_info, folder_position, parent=self, items=folder_items)
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/sub_header.py", line 52, in init
Module.init(self,
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/module.py", line 52, in init
CanvasEntity.init(self,
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/canvas_entity.py", line 107, in init
self._make_folder()
File "/Users/dsalzman/.local/share/virtualenvs/Kaitlyn_Skoirchet-S2BqCVsg/lib/python3.8/site-packages/CanvasSync/entities/canvas_entity.py", line 204, in _make_folder
os.mkdir(self.sync_path)
OSError: [Errno 63] File name too long: "/Users/dsalzman/git/Kaitlyn_Skoirchet/BUSN 38105 81,02,01 Advanced Negotiations/1 - Canvas Notes/1 - Ordinarily the Canvas site would be complete for the entire ... However, there was a lot of editing, so I'm sure that there will be some mistakes! (Please let me know if you find one!) And, I will adjust the assignments if necessary to reflect the reality of online learning/"

@dsalzman
Copy link
Author

dsalzman commented Jun 9, 2020

This was my quick fix to get it working for me. On the latest Mac OSX

def _make_folder(self): """ Create a folder on the sync path if not already present """ if len(self.sync_path) >= 255: self.sync_path = self.sync_path[0:255] if not os.path.exists(self.sync_path): os.mkdir(self.sync_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

1 participant