Skip to content

Captions not working for any file. #274

@burntscarr

Description

@burntscarr

When uploading, I can do so normally with no captions and have no issues whatsoever.
Example:
telegram-upload path/to/file

However when I try to do ANY type of caption I get errors.
Examples:
telegram-upload --caption test /path/to/file
telegram-upload --caption 'test' /path/to/file
telegram-upload --caption "test" /path/to/file
telegram-upload /path/to/file --caption test
telegram-upload /path/to/file --caption 'test'
telegram-upload /path/to/file --caption "test"

The word test was also tried with multiple words, special characters, the {inline options} etc.

The error I get for trying any --caption at all is:

Traceback (most recent call last):
  File "/usr/local/bin/telegram-upload", line 8, in <module>
    sys.exit(upload_cli())
             ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/exceptions.py", line 68, in wrap
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/management.py", line 191, in upload
    client.send_files(to, files, delete_on_success, print_file_id, forward)
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/client/telegram_upload_client.py", line 126, in send_files
    message = self.send_one_file(entity, file, send_as_media, thumb=thumb)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/client/telegram_upload_client.py", line 103, in send_one_file
    message = self._send_file_message(entity, file, thumb, progress)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/client/telegram_upload_client.py", line 58, in _send_file_message
    caption=file.file_caption, force_document=file.force_file,
            ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/upload_files.py", line 177, in file_caption
    caption = formatter.format(self._caption, file=FilePath(self.path), now=datetime.datetime.now())
                                                   ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/telegram_upload/caption_formatter.py", line 303, in __new__
    self = cls._from_parts(args)
           ^^^^^^^^^^^^^^^
AttributeError: type object 'PosixFilePath' has no attribute '_from_parts'. Did you mean: '_load_parts'?

Any help is appreciated! So far I'm just editing the caption manually inside Telegram after uploading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions