elodie: Import from "Dropbox/Camera Uploads" causes program crash
when Elodie is launched to import photos from ~/Dropbox/Camera Uploads folder, an exception is raised.
The command used is :
./elodie.py import "~/Dropbox/Camera Uploads" --destination ~/OrganizedLibrary
The output log is :
Traceback (most recent call last):
File "./elodie.py", line 302, in <module>
main()
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "./elodie.py", line 103, in _import
trash, allow_duplicates)
File "./elodie.py", line 59, in import_file
media, allowDuplicate=allow_duplicates, move=False)
File "/Users/pascalfosse/elodie/elodie/filesystem.py", line 208, in process_file
checksum_file
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 33: ordinal not in range(128)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 23 (20 by maintainers)
Commits related to this issue
- proposal to fix issue #162 fix issue encountered when importing from a UTF-8 encoded filesystem with non-breaking spaces. — committed to misterpipine/elodie by misterpipine 8 years ago
- proposal fix for issue #162 adding a test to check unicode path are managed correctly for import — committed to misterpipine/elodie by misterpipine 8 years ago
- Unit test update for fix issue #162 Addition of a unit test to check unicode filenames — committed to misterpipine/elodie by misterpipine 8 years ago
- Fix encoding issue with unicode characters in file and path #162 fix issue encountered when importing from a UTF-8 encoded filesystem with non-breaking spaces. * skip test because failure case canno... — committed to jmathai/elodie by misterpipine 8 years ago
- Fix encoding issue with unicode characters in file and path #162 fix issue encountered when importing from a UTF-8 encoded filesystem with non-breaking spaces. * skip test because failure case cannot... — committed to jmathai/elodie by misterpipine 8 years ago
- Modification of patch for #162 Regarding unit tests scope (import_file function), I move the fix to import_file function instead of leaving it In _import file. — committed to misterpipine/elodie by misterpipine 8 years ago
- Fix test which checks for unicode characters in file path strings #162 (#166) fix issue encountered when importing from a UTF-8 encoded filesystem with non-breaking spaces. — committed to jmathai/elodie by misterpipine 8 years ago
Hi @ldexterldesign
I’m using a UTF-8 filesystem and I discovered that the space character in the names of the folders or the files can be encoded differently (different space characters). In fact, if try to use quotation or backslash, I often get a “file does not exist” error, depending on the kind of space character. To avoid such issue, I use now the autocompletion functionnality and I get this command:
./elodie.py import --source=~/Dropbox/Camera Uploads --destination=~/Google\ Drive/Google Photos
As you can see, two of these spaces looks like ascii spaces but they are not because if I type myself these spaces on the keyboard, I get a “file not found” exception (even with backslash or quotation). The command line above contains UTF-8 characters and causes an error in execution of Elodie:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 38: ordinal not in range(128)
That’s why I suggested to use
.decode(sys.getfilesystemencoding())
on the strings “source” and “destination” to avoid such error. However, we cannot reproduce the error with a TestCase and we need some help for that.@jmathai I’ve pulled the latest from the master, and the problem is solved for me. Thanks.