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

TypeError: Can't mix strings and bytes in path components (#92) still persists #138

Open
scotws opened this issue Feb 8, 2021 · 1 comment

Comments

@scotws
Copy link

scotws commented Feb 8, 2021

Error #92 seems to have been prematurely closed, as it persists with my current Ubuntu 20.04 LTS setup (Python 3.8.5):

[1/19913] (TEST - no files are being moved/copied)
Source: Possum iPhoto All/IMG_1115.JPG.jpg
Date/Time: 2009-04-21 17:28:23
Corresponding Tags: EXIF:ModifyDate, EXIF:DateTimeOriginal, EXIF:CreateDate, XMP:CreateDate, XMP:ModifyDate, XMP:DateCreated
Traceback (most recent call last):
  File "/usr/local/bin/sortphotos", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/src/sortphotos.py", line 498, in main
    sortPhotos(args.src_dir, args.dest_dir, args.sort, args.rename, args.unknown_dir, args.recursive, 
  File "/usr/local/lib/python3.8/dist-packages/src/sortphotos.py", line 376, in sortPhotos
    dest_file = os.path.join(dest_file, filename.encode('utf-8'))
  File "/usr/lib/python3.8/posixpath.py", line 90, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib/python3.8/genericpath.py", line 155, in _check_arg_types
    raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: Can't mix strings and bytes in path components
@ShuffleBit
Copy link

ShuffleBit commented Jul 7, 2023

I don't think it will be updated. I doubt a PR will be answered. But you can fix this yourself:
Line 376 of /usr/local/lib/python3.8/dist-packages/src/sortphotos.py
Original:
dest_file = os.path.join(dest_file, filename.encode('utf-8'))
which converts the str to byte for whatever the reason
Fixed:
dest_file = os.path.join(dest_file, filename)

This "fix" works on Ubuntu 20.04. I didn't test it anywhere else, but the genericpath function is guaranteed to throw an exception on that byte array.

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

2 participants