Metadata has no value ‘duration’

Issue

This Content is from Stack Overflow. Question asked by MarinaF

I have a problem with a python script, inexplicably it doesn’t work anymore. I honestly don’t understand the problem, also because if I search for ‘duration’ within the script, it is not present.

How can I find the problem?

Traceback (most recent call last):
  File "/docker/pycharm/bin/telegram-upload", line 8, in <module>
    sys.exit(upload_cli())
  File "/docker/pycharm/lib/python3.10/site-packages/telegram_upload/exceptions.py", line 64, in wrap
    return fn(*args, **kwargs)
  File "/docker/pycharm/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/docker/pycharm/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/docker/pycharm/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/docker/pycharm/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/docker/pycharm/lib/python3.10/site-packages/telegram_upload/management.py", line 172, in upload
    client.send_files(to, files, delete_on_success, print_file_id, forward)
  File "/docker/pycharm/lib/python3.10/site-packages/telegram_upload/client.py", line 183, in send_files
    message = self._send_file_message(entity, file, thumb, progress)
  File "/docker/pycharm/lib/python3.10/site-packages/telegram_upload/client.py", line 136, in _send_file_message
    progress_callback=progress, attributes=file.file_attributes)
  File "/docker/pycharm/lib/python3.10/site-packages/telegram_upload/files.py", line 181, in file_attributes
    return get_file_attributes(self.path)
  File "/docker/pycharm/lib/python3.10/site-packages/telegram_upload/files.py", line 54, in get_file_attributes
    (0, metadata.get('duration').seconds)[metadata.has('duration')],
  File "/docker/pycharm/lib/python3.10/site-packages/hachoir/metadata/metadata.py", line 81, in get
    raise ValueError(
ValueError: Metadata has no value 'duration' (index 0)

These are the installed packages

certifi==2022.9.14
charset-normalizer==2.1.1
click==8.1.3
cryptg==0.3.1
DateTime==4.7
decorator==4.4.2
dnspython==2.2.1
ffmpeg-python==0.2.0
future==0.18.2
hachoir==3.1.3
idna==3.4
imageio==2.21.3
imageio-ffmpeg==0.4.7
mongo==0.2.0
moviepy==1.0.3
numpy==1.23.3
opencv-python==4.6.0.66
Pillow==9.2.0
proglog==0.1.10
prompt-toolkit==3.0.31
pyaes==1.6.1
pyasn1==0.4.8
pymongo==4.2.0
python-magic==0.4.27
pytz==2022.2.1
requests==2.28.1
rsa==4.9
telegram-upload==0.5.1
Telethon==1.25.0
tqdm==4.64.1
urllib3==1.26.12
ushlex==0.99.1
wcwidth==0.2.5
zope.interface==5.4.0



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?