perslev / CanvasSync

Synchronise modules, assignments and files located on a Canvas by Instructure web server to your local computer.
MIT License
68 stars 33 forks source link

TypeError: a bytes-like object is required, not 'str' #45

Open Me-Mr opened 7 months ago

Me-Mr commented 7 months ago

Hi, after entering encryption password it runs for a few seconds and I get this error:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/bin/canvas", line 8, in <module> sys.exit(entry()) ^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/bin/canvas.py", line 186, in entry run_canvas_sync() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/bin/canvas.py", line 132, in run_canvas_sync main_menu(settings) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/bin/canvas.py", line 146, in main_menu settings.set_settings() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/CanvasSync/settings/settings.py", line 157, in set_settings self.write_settings() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/CanvasSync/settings/settings.py", line 214, in write_settings out_file.write(encrypt(settings)) ^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/CanvasSync/settings/cryptography.py", line 48, in encrypt pass_file.write(hashed_password) TypeError: a bytes-like object is required, not 'str'

nacierebiej commented 7 months ago

I have the same issue.

kazar4 commented 5 months ago

I figured it out: If you are on Mac go to this directory: /Users/[Username]/Library/Python/3.9/lib/python/site-packages/CanvasSync/settings/cryptography.py On Line 48 you will see pass_file.write(hashed_password) Change that to pass_file.write(str.encode(hashed_password))