Giter Club home page Giter Club logo

telegram-upload's Introduction

image

pip-rating badge

Latest PyPI version

Python versions

Code Climate

Test coverage

Github stars

telegram-upload

Telegram-upload uses your personal Telegram account to upload and download files up to 4 GiB (2 GiB for free users). Turn Telegram into your personal ☁ cloud!

To install 🔧 telegram-upload, run this command in your terminal:

$ sudo pip3 install -U telegram-upload

This is the preferred method to install telegram-upload, as it will always install the most recent stable release. 🐍 Python 3.7-3.11 are tested and supported. There are other installation ways available like Docker. More info in the 📕 documentation

image

❓ Usage

To use this program you need an Telegram account and your App api_id & api_hash (get it in my.telegram.org). The first time you use telegram-upload it requests your 📱 telephone, api_id and api_hash. Bot tokens can not be used with this program (bot uploads are limited to 50MB).

To send ⬆️ files (by default it is uploaded to saved messages):

$ telegram-upload file1.mp4 file2.mkv

You can download ⤵️ the files again from your saved messages (by default) or from a channel. All files will be downloaded until the last text message.

$ telegram-download

Read the documentation for more info about the options availables.

Interactive mode

The interactive option (--interactive) allows you to choose the dialog and the files to download or upload with a terminal 🪄 wizard. It even supports mouse!

$ telegram-upload --interactive    # Interactive upload
$ telegram-download --interactive  # Interactive download

More info in the documentation

Set group or chat

By default when using telegram-upload without specifying the recipient or sender, telegram-upload will use your personal chat. However you can define the 👨 destination. For file upload the argument is --to <entity>. For example:

$ telegram-upload --to telegram.me/joinchat/AAAAAEkk2WdoDrB4-Q8-gg video.mkv

You can download files from a specific chat using the --from <entity> parameter. For example:

$ telegram-download --from username

You can see all the possible values for the entity in the documentation.

Split & join files

If you try to upload a file that exceeds the maximum supported by Telegram by default, an error will occur. But you can enable ✂ split mode to upload multiple files:

$ telegram-upload --large-files split large-video.mkv

Files split using split can be rejoined on download using:

$ telegram-download --split-files join

Find more help in the telegram-upload documentation.

Delete on success

The --delete-on-success option allows you to ❌ delete the Telegram message after downloading the file. This is useful to send files to download to your saved messages and avoid downloading them again. You can use this option to download files on your computer away from home.

Configuration

Credentials are saved in ~/.config/telegram-upload.json and ~/.config/telegram-upload.session. You must make sure that these files are secured. You can copy these 📁 files to authenticate telegram-upload on more machines, but it is advisable to create a session file for each machine.

More options

Telegram-upload has more options available, like customizing the files thumbnail, set a caption message (including variables) or configuring a proxy. Read the documentation for more info.

💡 Features

  • Upload and download multiples files (up to 4 GiB per file for premium users).
  • Interactive mode.
  • Add video thumbs.
  • Split and join large files.
  • Delete local or remote file on success.
  • Use variables in the caption message.
  • ... And more.

🐋 Docker

Run telegram-upload without installing it on your system using Docker. Instead of telegram-upload and telegram-download you should use upload and download. Usage:

$ docker run -v <files_dir>:/files/
             -v <config_dir>:/config
             -it nekmo/telegram-upload:master
             <command> <args>
  • <files_dir>: upload or download directory.
  • <config_dir>: Directory that will be created to store the telegram-upload configuration. It is created automatically.
  • <command>: upload and download.
  • <args>: telegram-upload and telegram-download arguments.

For example:

$ docker run -v /media/data/:/files/
             -v $PWD/config:/config
             -it nekmo/telegram-upload:master
             upload file_to_upload.txt

❤️ Thanks

This project developed by Nekmo & collaborators would not be possible without Telethon, the library used as a Telegram client.

Telegram-upload is licensed under the MIT license.

telegram-upload's People

Contributors

cristian64 avatar fatshotty avatar gottsman avatar nekmo avatar shubhamkarala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telegram-upload's Issues

Windows support for videos

  • telegram-upload version: 0.1.10
  • Python version: 3.7.3
  • Operating System:Windows 10 Pro

Description

Error Occured

Traceback (most recent call last):
  File "telegram-upload", line 6, in <module>
    catch(manage)()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telegram_upload\exceptions.py", line 25, in wrap
    fn(*args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telegram_upload\management.py", line 18, in manage
    client.send_files(to, files, delete_on_success)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\site-packages\telegram_upload\client.py", line 44, in send_files
    length=os.path.getsize(file))
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\genericpath.py", line 50, in getsize
    return os.stat(filename).st_size
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'H:\\Music\\Den\\The_Den_-_Trojans\\01

What I Did

Tried to upload a file or from folders with space character

the command i ran 
`python telegram-upload H:\Music\Den\The_Den_-_Trojans\01 Tr+jans.mp3`

Problem with sending file using $ characters in filename

  • telegram-upload version: 0.2.0
  • Python version: 3.7.3
  • Operating System: debian 10
  • all of other python libs are uptodate

Description

when i download the video from youtube using by youtube-dl and sending it to telegram:
if the name was like "video name $9 test.mp4" there was a error like file not found and file name became like this in the python "video name 9 test.mp4"

What I Did

i think there is a problem with click that remove the $ character

How to upload files? (update to Telethon > 1.0)

  • telegram-upload version: 0.1.5
  • Python version: 3.5
  • Operating System: Elementary OS

Description

Describe what you were trying to get done.
I was trying to upload file using telegram-upload
Tell us what happened, what went wrong, and what you expected to happen.
File wasn't uploaded and I got a warning.

What I Did

I ran the command
telegram-upload /home/cyberboy/python/TelegramBot/test100k.db

Paste the command(s) you ran and the output.

/usr/local/lib/python3.5/dist-packages/telegram_upload/client.py:31: RuntimeWarning: coroutine 'UploadMethods.send_file' was never awaited
progress_callback=progress, attributes=get_file_attributes(file))


If there was a crash, please include the traceback here.

I'm not able to understand how to make it upload a certain file. I also had a query whether it can send the uploaded file to a member having a certain chat_id ?

A documentation of how to use this will be very useful.

Getting file_id of the uploaded file

  • telegram-upload version: 0.1.6
  • Python version: 3.6
  • Operating System: Pop_os

Description

Printing the file_id of the uploaded will be handy... so that users can forward files via a bot to a specific user easily.

Caption problem

in latest version the caption has problem.
i have 10 videos in a folder all mp4.i run this command:
telegram-upload *.mp4
the captions should be the file name, but all of them are the name of the first file.

thanks.

'The sqlite3 module is not available under this'

  • telegram-upload version: 0.2.1
  • Python version: 3.6.6
  • Operating System: Ubuntu 16.04

Description

When invoking the telegram-upload command, I get this following error:

/home/bpo5r5/.pyenv/versions/3.6.6/lib/python3.6/site-packages/telethon/client/telegrambaseclient.py:219: UserWarning: The sqlite3 module is not available under this Python installation and no custom session instance was given; using MemorySession.
You will need to re-login every time unless you use another session storage
  'The sqlite3 module is not available under this '
Please enter your phone:

What I Did

telegram-upload

I'd like to save my log-in instance so I do not have to every time I upload a file.

Forwarding uploaded files to a user using a bot.

  • telegram-upload version: 0.1.5
  • Python version: 3.5
  • Operating System: Elementary OS

Description

I was wondering how do I forward the uploaded file to a user using a bot. I have the unique chat ID of the user.

Using --to @username or --to chat_id will send the uploaded file to @username from my personal Telegram ID.

My Question

How to send the files to a user from a Bot to a subscriber?

not getting a login code from telegram

  • telegram-upload version: 0.3.1
  • Python version: 3.8.2
  • Operating System: linux ubuntu ec2 c5.xlarge vm

Description

When I try using the telegram-upload command after I entered my api_id and api_hash when I enter my phone number along with the country code with or without space I don't get any login code from telegram and no errors in the terminal either.

What I Did

telegram-upload file.mp4

It is working locally on my windows 10 PC. But not working from an AWS Instance, weird.

Installation Error - hachoir3

  • telegram-upload version:
  • Python version:
  • Operating System:

error showing

ERROR: Could not find a version that satisfies the requirement hachoir3 (from telegram-upload) (from versions: none)
ERROR: No matching distribution found for hachoir3 (from telegram-upload)

No preview video.

  • telegram-upload version: 0.2.1
  • Python version: Python 3.5.3
  • Operating System: Debian 9

Description

When I download a .mp4 video, I don't get a preview of it.
I just see the background of this video being washed up. It's like the screenshot below.
IMG_20200210_205740

I wish the video had some kind of preview.

Installation Error

  • telegram-upload version: 0.1.3
  • Python version: 3.5
  • Operating System: Elementary OS Linux

Description

I tried to install telegram-upload using command
sudo -H pip3 install telegram-upload
I got this error

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-z3lzlhr5/telegram-upload/

Describe what you were trying to get done.
telegram-upload installed successfully.

Tell us what happened, what went wrong, and what you expected to happen.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-z3lzlhr5/telegram-upload/

What I Did

Tried sudo -H pip install telegram-upload

database is locked

  • telegram-upload version:0.2.1
  • Python version:3.7
  • Operating System:macos

Traceback (most recent call last):
File "/usr/local/bin/Telegram-upload", line 6, in
catch(upload)()
File "/usr/local/lib/python3.7/site-packages/telegram_upload/exceptions.py", line 25, in wrap
fn(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/telegram_upload/management.py", line 17, in upload
client = Client(config or default_config())
File "/usr/local/lib/python3.7/site-packages/telegram_upload/client.py", line 43, in init
super().init(config.get('session', 'telegram-upload'), config['api_id'], config['api_hash'], **kwargs)
File "/usr/local/lib/python3.7/site-packages/telethon/client/telegrambaseclient.py", line 250, in init
session = SQLiteSession(session)
File "/usr/local/lib/python3.7/site-packages/telethon/sessions/sqlite.py", line 47, in init
c.execute("select name from sqlite_master "
sqlite3.OperationalError: database is locked

Describe what you were trying to get done.
Tell us what happened, what went wrong, and what you expected to happen.
url=XXXX
for f in "$url"*.mp4 ; do
Telegram-upload --to webcamcol "$f"
done

Upload Video stream

thanks for the great app.
i have a suggestion and request if possible.
when i upload videos from local or other bots, it is possible to stream videos without downloading completely.
but with telegram-upload i can't stream.should i add an option or flag to enable this ?

thanks.

not using system HTTP Proxy

  • telegram-upload version: 0.3.1
  • Python version:3
  • Operating System: Ubuntu 18.04

Description

I can not find any way on how to set up an HTTP proxy for telegram-upload.
Also it is not following the system HTTP proxy.

uploading video files with delay

  • telegram-upload version:latest 0.1.9
  • Python version:3.6
  • Operating System:linux centos 6

Description

First of all thanks for the great tool!
You already fixed uploading video files in the previous issue thank you again for that!
What I encountered is that when I try to upload a video file it starts with delay! and the bigger the video file the bigger the delay becomes! for example, if I wanna upload a 600MB video file there's like 10 minutes delay before uploading that video file! like its uploading twice or something like that! there's no error or something just the delay before uploading video files.
Uploading other file types like archives don't have this issue.

[FEATURE] Support 2GB uploads.

  • telegram-upload version: v0.3.1
  • Python version: Python 3.6.9
  • Operating System: Ubuntu 18.04.4 LTS

Description

I tried to upload a file between 1.5GB - 2GB but failed. Telegram will start to support uploading up to 2 GB files. I would like this to be implemented in telegram-upload.

Source and Proof: https://t.me/tginfoen/884

Send video as document

  • telegram-upload version: 0.1.6
  • Python version: using Python with OS (python 2.7.10 or python3 3.6.3)
  • Operating System: macOS Mojave 10.14.3 (18D42)

I'm trying to upload simple video as document but the paramet is ignored.
Just added a simple parameter when called "send_file" telethon's method:
self.send_file(entity, file, caption=(name[:CAPTION_MAX_LENGTH] + '..') if len(name) > CAPTION_MAX_LENGTH else name, progress_callback=progress, force_document=True)

video is sent as video everything I do, also tried to change the MIME but same result video is sent as video and not as document even if force_document=True is present.

caption style syntax

  • telegram-upload version:0.3
  • Python version:3.7
  • Operating System:macos/win

Description

The caption have styles? or documentation about it?

Issue when uploading file (photo)

  • telegram-upload version: 0.32
  • Python version: 3.8
  • Operating System: win10

Description

i tried to upload an image from my computer to a telegram grp chat

What I Did


code input:
telegram-upload --to t.me/nric2003 C:\Users\*\Desktop\*\*\*\T0362678J.png
code output:
https://user-images.githubusercontent.com/66017805/87990821-59d46700-cb17-11ea-99d5-4d5f40396d8f.png

error uploading video files

  • telegram-upload version: recent stable 0.1.6
  • Python version: 3.6 using scl repo
  • Operating System: linux Centos 6

Description

I get this error when trying to upload video files (i can upload other file types ):
http://prnt.sc/mv498h

I installed the ffmpeg 4.1.1 .

Alternate installation way

  • telegram-upload version: 0.1.6
  • Python version: 3.6
  • Operating System: Pop-OS

Description

I was trying to use this in one of my Flask Projects. I deployed the website on Heroku so I can't enter API ID and HASH in the terminal. I was interested to know whether I can pass the ID and Hash along with the telegram-upload command? Or is there a way to set up the config in another way?

A manual installation way will be helpful.

What I Did

Tried Heroku console but no luck.

How to install and use in windows?

  • telegram-upload version: 0.1.10
  • Python version: 3.7.2
  • Operating System: Windows 10 64bit

Description

Hello, i try to install via "pip install telegram-upload". If I run python telegram-upload it says "python: can't open file 'telegram-upload': [Errno 2] No such file or directory". And if I only run telegram-upload cmd doesn't recognize it (it's because it's not in the environment variables I don't know where the installation was done.)

My Question

Does telegram-upload only work on linux? Is there any way to install it and use it in windows?

Thanks for the help.

edit file name

  • telegram-upload version:1.2.1
  • Python version:3.7
  • Operating System:win/mac

Description

how a i can change or add more text to label, like add url or bold font

What I Did

Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.

Selective downloading option

The option of allowing the user to select the choice of files to download would be better.
Suppose, consider if a user has many files uploaded and doesn't want to download all of them immediately, and instead wants only one/few specific files to be downloaded.

Providing a selective file download option would solve this requirement.

FileNotFoundError: [Errno 2] No such file or directory: '/app/.config/telegram-upload.json'

  • telegram-upload version: 0.1.6
  • Python version: 3.6.6
  • Operating System: Linux

Description

When I triggered the command telegram-upload runtime.txt on my heroku server and entered my app_id and app_hash.

Instead of asking about my phone number it gave this error.

What I Did

~ $ telegram-upload runtime.txt
Go to https://my.telegram.org and create a App in API development tools
Please Enter api_id: XXXXX
Now enter api_hash: XXXXXXXXXXXXXXXXXXXX
Traceback (most recent call last):
File "/app/.heroku/python/bin/telegram-upload", line 6, in
catch(manage)()
File "/app/.heroku/python/lib/python3.6/site-packages/telegram_upload/exceptions.py", line 25, in wrap
fn(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/app/.heroku/python/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/app/.heroku/python/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/telegram_upload/management.py", line 16, in manage
client = Client(config or default_config())
File "/app/.heroku/python/lib/python3.6/site-packages/telegram_upload/config.py", line 15, in default_config
json.dump({'api_id': api_id, 'api_hash': api_hash}, open(CONFIG_FILE, 'w'))
FileNotFoundError: [Errno 2] No such file or directory: '/app/.config/telegram-upload.json'

Please enlighten me.

Document send files to a chat_id

  • telegram-upload version: 0.3.0
  • Python version: Python 3.6.9
  • Operating System: Linux ubuntu 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 18.04)

Description

I'm trying to upload a file and send it to a specific chat_id (a channel).
Application crashed apparently while trying to find entity from the provided chat_id.

I also tried sending the same file to an user_id but it failed anyway. Using --to Username works but since the channel I wanna use is private, it doesn't have an username.
To find out chat ids I used t.me/userinfobot

What I Did

$ telegram-upload --to -1001147180984 mongodump_2020-05-08_14\:40\:21_CEST.gz 
Traceback (most recent call last):
  File "/usr/local/bin/telegram-upload", line 11, in <module>
    sys.exit(upload_cli())
  File "/usr/local/lib/python3.6/dist-packages/telegram_upload/exceptions.py", line 42, in wrap
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/telegram_upload/management.py", line 41, in upload
    client.send_files(to, files, delete_on_success, print_file_id, force_file, forward, caption)
  File "/usr/local/lib/python3.6/dist-packages/telegram_upload/client.py", line 77, in send_files
    progress_callback=progress, attributes=attributes)
  File "/usr/local/lib/python3.6/dist-packages/telethon/sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/dist-packages/telethon/client/uploads.py", line 331, in send_file
    entity = await self.get_input_entity(entity)
  File "/usr/local/lib/python3.6/dist-packages/telethon/client/users.py", line 404, in get_input_entity
    await self._get_entity_from_string(peer))
  File "/usr/local/lib/python3.6/dist-packages/telethon/client/users.py", line 538, in _get_entity_from_string
    'Cannot find any entity corresponding to "{}"'.format(string)
ValueError: Cannot find any entity corresponding to "-1001147180984"

Can't upload video as Document.

  • telegram-upload version:0.1.9
  • Python version:3.6
  • Operating System:ubuntu 16.4 Server LTS

Description

How can I upload video files as document file. Now it's in video format.

Option to forward uploaded file

Description

It would be great to have the option to automatically forward the file to other chat_ids after the upload is complete.

Telethon directly supports forwarding messages:

client.forward_messages(
    entity,  # to which entity you are forwarding the messages
    message_ids,  # the IDs of the messages (or message) to forward
    from_entity  # who sent the messages?
)

(Source: https://telethonn.readthedocs.io/en/latest/extra/examples/working-with-messages.html)

The function could be implemented with another "-F " / "--forward" flag that takes a list of comma separated chat_ids to which the uploaded file/message should be forwarded.

telegram-upload /path/to/file.txt --print-file-id --forward 123456,-987654

Installation error

I got this error while installing telegram-upload
whats problem and how can I fix it
thank you

root@23:~# sudo pip install telegram-upload
Collecting telegram-upload
Requirement already satisfied: hachoir-parser in /usr/local/lib/python2.7/dist-packages (from telegram-upload) (1.3.4)
Requirement already satisfied: hachoir-metadata in /usr/local/lib/python2.7/dist-packages (from telegram-upload) (1.3.3)
Collecting cryptg (from telegram-upload)
  Using cached https://files.pythonhosted.org/packages/4f/21/9d242c1ed5dbf4a26bedf14355db62e2fed1dcc433099e79de5de4fa788c/cryptg-0.1.0.7.tar.gz
Requirement already satisfied: telethon in /usr/local/lib/python2.7/dist-packages (from telegram-upload) (0.18.2.3)
Requirement already satisfied: click>=6.0 in /usr/local/lib/python2.7/dist-packages (from telegram-upload) (7.0)
Requirement already satisfied: pyaes in /usr/local/lib/python2.7/dist-packages (from telethon->telegram-upload) (1.6.1)
Requirement already satisfied: typing in /usr/local/lib/python2.7/dist-packages (from telethon->telegram-upload) (3.6.6)
Requirement already satisfied: rsa in /usr/local/lib/python2.7/dist-packages (from telethon->telegram-upload) (4.0)
Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python2.7/dist-packages (from rsa->telethon->telegram-upload) (0.4.5)
Building wheels for collected packages: cryptg
  Running setup.py bdist_wheel for cryptg ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-nMaTSa/cryptg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-TBxNrA --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  building 'cryptg' extension
  creating build
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/cryptg
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cryptg/cryptgmodule.c -o build/temp.linux-x86_64-2.7/cryptg/cryptgmodule.o
  cryptg/cryptgmodule.c:49:15: error: variable ‘cryptgmodule’ has initializer but incomplete type
   static struct PyModuleDef cryptgmodule = {
                 ^
  cryptg/cryptgmodule.c:50:5: error: ‘PyModuleDef_HEAD_INIT’ undeclared here (not in a function)
       PyModuleDef_HEAD_INIT,
       ^
  cryptg/cryptgmodule.c:50:5: warning: excess elements in struct initializer
  cryptg/cryptgmodule.c:50:5: note: (near initialization for ‘cryptgmodule’)
  cryptg/cryptgmodule.c:51:5: warning: excess elements in struct initializer
       "cryptg",
       ^
  cryptg/cryptgmodule.c:51:5: note: (near initialization for ‘cryptgmodule’)
  cryptg/cryptgmodule.c:52:5: warning: excess elements in struct initializer
       "Cryptographic utilities for Telegram",
       ^
  cryptg/cryptgmodule.c:52:5: note: (near initialization for ‘cryptgmodule’)
  cryptg/cryptgmodule.c:53:5: warning: excess elements in struct initializer
       -1,
       ^
  cryptg/cryptgmodule.c:53:5: note: (near initialization for ‘cryptgmodule’)
  cryptg/cryptgmodule.c:54:5: warning: excess elements in struct initializer
       CryptgMethods
       ^
  cryptg/cryptgmodule.c:54:5: note: (near initialization for ‘cryptgmodule’)
  cryptg/cryptgmodule.c: In function ‘PyInit_cryptg’:
  cryptg/cryptgmodule.c:62:9: warning: implicit declaration of function ‘PyModule_Create’ [-Wimplicit-function-declaration]
       m = PyModule_Create(&cryptgmodule);
           ^
  cryptg/cryptgmodule.c:62:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
       m = PyModule_Create(&cryptgmodule);
         ^
  cryptg/cryptgmodule.c:64:16: warning: ‘return’ with a value, in function returning void
           return NULL;
                  ^
  cryptg/cryptgmodule.c:66:12: warning: ‘return’ with a value, in function returning void
       return m;
              ^
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cryptg
  Running setup.py clean for cryptg
Failed to build cryptg
Installing collected packages: cryptg, telegram-upload
  Running setup.py install for cryptg ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-nMaTSa/cryptg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-KXFVKS/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'cryptg' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/cryptg
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c cryptg/cryptgmodule.c -o build/temp.linux-x86_64-2.7/cryptg/cryptgmodule.o
    cryptg/cryptgmodule.c:49:15: error: variable ‘cryptgmodule’ has initializer but incomplete type
     static struct PyModuleDef cryptgmodule = {
                   ^
    cryptg/cryptgmodule.c:50:5: error: ‘PyModuleDef_HEAD_INIT’ undeclared here (not in a function)
         PyModuleDef_HEAD_INIT,
         ^
    cryptg/cryptgmodule.c:50:5: warning: excess elements in struct initializer
    cryptg/cryptgmodule.c:50:5: note: (near initialization for ‘cryptgmodule’)
    cryptg/cryptgmodule.c:51:5: warning: excess elements in struct initializer
         "cryptg",
         ^
    cryptg/cryptgmodule.c:51:5: note: (near initialization for ‘cryptgmodule’)
    cryptg/cryptgmodule.c:52:5: warning: excess elements in struct initializer
         "Cryptographic utilities for Telegram",
         ^
    cryptg/cryptgmodule.c:52:5: note: (near initialization for ‘cryptgmodule’)
    cryptg/cryptgmodule.c:53:5: warning: excess elements in struct initializer
         -1,
         ^
    cryptg/cryptgmodule.c:53:5: note: (near initialization for ‘cryptgmodule’)
    cryptg/cryptgmodule.c:54:5: warning: excess elements in struct initializer
         CryptgMethods
         ^
    cryptg/cryptgmodule.c:54:5: note: (near initialization for ‘cryptgmodule’)
    cryptg/cryptgmodule.c: In function ‘PyInit_cryptg’:
    cryptg/cryptgmodule.c:62:9: warning: implicit declaration of function ‘PyModule_Create’ [-Wimplicit-function-declaration]
         m = PyModule_Create(&cryptgmodule);
             ^
    cryptg/cryptgmodule.c:62:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
         m = PyModule_Create(&cryptgmodule);
           ^
    cryptg/cryptgmodule.c:64:16: warning: ‘return’ with a value, in function returning void
             return NULL;
                    ^
    cryptg/cryptgmodule.c:66:12: warning: ‘return’ with a value, in function returning void
         return m;
                ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-nMaTSa/cryptg/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-KXFVKS/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-nMaTSa/cryptg/

Recursive upload nested directories does not work

telegram-upload version: 0.3.2
Python version: 3.6.9
Operating System: ubuntu mate 18.04.4 64 bit
The recursive upload of nested directories does not work.

telegram-upload --directories recursive dir1
dir1->{dir2,file}
dir2->{file}

Traceback (most recent call last):
  File "/usr/local/bin/telegram-upload", line 11, in <module>
    sys.exit(upload_cli())
  File "/usr/local/lib/python3.6/dist-packages/telegram_upload/exceptions.py", line 42, in wrap
    fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/telegram_upload/management.py", line 42, in upload
    client.send_files(to, files, delete_on_success, print_file_id, force_file, forward, caption)
  File "/usr/local/lib/python3.6/dist-packages/telegram_upload/client.py", line 80, in send_files
    progress_callback=progress, attributes=attributes)
  File "/usr/local/lib/python3.6/dist-packages/telethon/sync.py", line 39, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/dist-packages/telethon/client/uploads.py", line 377, in send_file
    return self._get_response_message(request, await self(request), entity)
  File "/usr/local/lib/python3.6/dist-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/usr/local/lib/python3.6/dist-packages/telethon/client/users.py", line 77, in _call
    result = await future
telethon.errors.rpcerrorlist.FilePartsInvalidError: The number of file parts is invalid (caused by SendMediaRequest)

It works well with files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.