Closed jangop closed 3 years ago
I'm right there with you @jangop ... I don't quite understand the encoding stuff. I see that the original author had many commits regarding encoding stuff and it seems to be a constant problem. (I commented on a fork that does localized encoding, and that dev said they had problems with UTF-8 on a French localization).
Is there a test case I can test this against so I can do a before and after comparison (and probably write it into a real test case) to make sure it doesn't ever break in the future?
I guess that once you no longer support Python 2.7, we should be able to figure out the entire encoding business more easily.
I actually wrote a test for copy_tags
first and then figured out what was wrong. Unfortunately, the test still fails, due to other issues. I'll prepare a simplified version.
Ok, I see how copy_tags
didn't work before. Yeah the .encode('UTF-8')
is to turn it into bytes from a string. I forgot when I merged that PR from the old repo, but obviously that code hasn't worked since I merged it.
I'll merge this PR, thanks for adding in a test. I think the v0.5.x will deal with lots of this through parameter checking
The test you wrote passes for me
@jangop do you need a PyPI release for this PR?
@jangop do you need a PyPI release for this PR?
I was about to say “no” because it is easily monkey patched. However, I could see a number of users installing this module because they want to copy/transplant tags, so maybe go for it. 👍
Thank you for merging.
released to PyPI. Thanks for the bugfix and tests!
Currently,
copy_tags
fails because the parameters are not encoded properly.Now, I don't necessarily understand all this encoding of parameters, and I don't know why
execute
cannot take care of it, although this was apparently tried:https://github.com/sylikc/pyexiftool/blob/1e9b4b34abac6d4294a5958494c7b1b4c1391589/exiftool/exiftool.py#L442
Anyways,
set_tags_batch
andset_keywords_batch
encode their parameters before passing them along, and doing to forcopy_tags
works in my local monkeypatched version of pyexiftool.