You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running mtc_listener.py call of mtc_decode rises error:
File "***\timecode_tools\mtc_listener.py", line 46, in <module>
main()
File "***\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "***\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "***\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "***\AppData\Local\Programs\Python\Python39\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "***\timecode_tools\mtc_listener.py", line 43, in main
listen(port)
File "***\timecode_tools\mtc_listener.py", line 33, in listen
handle_message(msg)
File "***\timecode_tools\mtc_listener.py", line 15, in handle_message
tc = tools.mtc_decode_quarter_frames(quarter_frames)
File "***\timecode_tools\tools.py", line 208, in mtc_decode_quarter_frames
return mtc_decode(mtc_bytes)
File ***\timecode_tools\tools.py", line 158, in mtc_decode
return Timecode(fps, frames=total_frames)
File "***\Local\Programs\Python\Python39\lib\site-packages\timecode\__init__.py", line 80, in __init__
self.frames = frames
File "***\AppData\Local\Programs\Python\Python39\lib\site-packages\timecode\__init__.py", line 105, in frames
raise TypeError(
TypeError: Timecode.frames should be a positive integer bigger than zero, not a float
Indeed total_frames is a float value, and frames value is forced to be int:
@frames.setter
def frames(self, frames):
"""setter for the _frames attribute
:param int frames: A positive int bigger than zero showing the number
of frames that this TimeCode represents.
:return:
"""
# validate the frames value
if not isinstance(frames, int):
raise TypeError(
"%s.frames should be a positive integer bigger "
"than zero, not a %s" % (self.__class__.__name__, frames.__class__.__name__)
)
Changing return Timecode(fps, frames=total_frames) to return Timecode(fps, frames=int(total_frames)) fixes this issue.
Cheers!
The text was updated successfully, but these errors were encountered:
Environment:
Input: 24 fps quarter frame
While running
mtc_listener.py
call ofmtc_decode
rises error:Indeed
total_frames
is a float value, andframes
value is forced to be int:Changing
return Timecode(fps, frames=total_frames)
toreturn Timecode(fps, frames=int(total_frames))
fixes this issue.Cheers!
The text was updated successfully, but these errors were encountered: