-
Notifications
You must be signed in to change notification settings - Fork 114
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: a bytes-like object is required, not 'str' #29
Comments
Looks like the problem is that 'modData.encode()' RETURNS an encoded string - it doesn't modify modDate - so you are still passing in a str. |
Thank you for pointing this out. |
modDataBytes = modData.encode() should work fine
…On Mon, Nov 18, 2019 at 9:05 AM trevormiller6 ***@***.***> wrote:
Looks like the problem is that 'modData.encode()' RETURNS an encoded
string - it doesn't modify modDate - so you are still passing in a str.
Thank you for pointing this out.
Seems that no matter what i do to it it stays a string... Do you have any
suggestions?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#29?email_source=notifications&email_token=AAHU2T66ONSVUXEHMUOZPW3QULDPDA5CNFSM4JOOK3AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEELFMAA#issuecomment-555111936>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHU2T2JSFE5QH4VKKRD2X3QULDPDANCNFSM4JOOK3AA>
.
--
Chris Wagner
The land embracing Point Lobos was bought for inclusion in the State Park
System (a) because the very peculiar physical characteristics of the
locality have enabled many people to obtain here personal satisfactions of
peculiar kinds which they have valued very highly, and of which the most
highly valued are unobtainable elsewhere in like degree if at all, ...
Point Lobos Reserve Master Plan Report - Olmsted Brothers,
November, 1935
|
Same issue.
|
Goodpoint - looking closer - it is failing at the call to 'start' (which is run as part of the 'with' context manager) - so not even looking at your parameters yet. Looking at the error in subprocess - (which is windows specific alas) - it appears that it (error message not withstanding) it wants a string - not bytes. And as I said before - this is on the start - not your 'execute' command - so that means it must be an issue with your executable. So I would try creating your path WITHOUT .encode() e.g. :
lets see what that brings. |
I get the same traceback I can confirm all three variables passed to exiftool are bytes objects
Thanks for the help! |
That is my point. Your path to exiftool executable should NOT BE BYTES. When you use the 'with' stmt - it ends up calling:
Where self.executable is what you called exifTool's constructor with. Popen takes strings. However - when you call 'execute(...)' - it is writing to a pipe - and that required bytes - so your date and filename need to be bytes. |
lol you're right i was being an idiot. I was thinking that was being passed to exiftool so I was doing :
AND for some reason:
So i changed both of those and ended up getting "OSError: [WinError 10038] An operation was attempted on something that is not a socket" I changed the exiftool.py to be from the commit recommended in that issue and all works now! Thank you for the help! Much appreciated. |
working code:
|
Old thread but this helped me understand how to pass arguments to execute. Can be confusing. Thanks. |
I am trying to do something super simple. Well that I thought was simple. I spent like 20 min writing the code and about 2 hours trying to figure out why it doesn't work...
I keep getting a typeError from subprocess called from the exiftool start(). I am sure I am doing something wrong but I cant figure it out. I thought i would post here on the very slim chance this is a bug and not my fault.
The text was updated successfully, but these errors were encountered: