perslev / CanvasSync

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

TypeError: Unicode-objects must be encoded before hashing #27

Closed peskin55 closed 3 years ago

peskin55 commented 3 years ago

CanvasSync - Current settings
-----------------------------

Standard settings
[*] Sync path:              $HOME/Documents/canvas
[*] Canvas domain:          https://csufullerton.instructure.com
[*] Authentication token:   $TOKEN
[*] Courses to be synced:   $CLASSES

Advanced settings
[*] Sync module items:          Files & HTML pages & External URLs
[*] Sync assignments:           True
[*] Download linked files:      True
[*] Avoid item duplicates:      True

These settings will be saved

Please enter a password to encrypt the settings file:
Password: 
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.9/canvas", line 33, in <module>
    sys.exit(load_entry_point('CanvasSync==0.2.4', 'console_scripts', 'canvas')())
  File "/usr/lib/python3.9/site-packages/bin/canvas.py", line 187, in entry
    run_canvas_sync()
  File "/usr/lib/python3.9/site-packages/bin/canvas.py", line 132, in run_canvas_sync
    main_menu(settings)
  File "/usr/lib/python3.9/site-packages/bin/canvas.py", line 149, in main_menu
    settings.show(quit=False)
  File "/usr/lib/python3.9/site-packages/CanvasSync/settings/settings.py", line 280, in show
    valid_token = self.load_settings("")
  File "/usr/lib/python3.9/site-packages/CanvasSync/settings/settings.py", line 111, in load_settings
    self.set_settings()
  File "/usr/lib/python3.9/site-packages/CanvasSync/settings/settings.py", line 157, in set_settings
    self.write_settings()
  File "/usr/lib/python3.9/site-packages/CanvasSync/settings/settings.py", line 214, in write_settings
    out_file.write(encrypt(settings))
  File "/usr/lib/python3.9/site-packages/CanvasSync/settings/cryptography.py", line 45, in encrypt
    hashed_password = bcrypt.hashpw(getpass.getpass(), bcrypt.gensalt())
  File "/usr/lib/python3.9/site-packages/bcrypt/__init__.py", line 80, in hashpw
    raise TypeError("Unicode-objects must be encoded before hashing")
TypeError: Unicode-objects must be encoded before hashing

Please fix this settings encrypting password issue 
peskin55 commented 3 years ago

Ok I figured it out I installed bcrypt not py-bcrypt, which by the way last updated in 2013. And also I'd like to request a --output to directory, since the names on canvas are too long.