Code Monkey home page Code Monkey logo

Comments (10)

leandrotoledo avatar leandrotoledo commented on May 22, 2024

Thank you for your bug report, I'll be looking into this.

from python-telegram-bot.

leandrotoledo avatar leandrotoledo commented on May 22, 2024

Hey there, would you mind to send me the PDF file? I couldn't reproduce the issue here.

from python-telegram-bot.

leandrotoledo avatar leandrotoledo commented on May 22, 2024

Hi Ronald, could you please update to the latest version and try it again?

pip install python-telegram-bot --upgrade

I've tried here with the PDF you've sent me and it seems to be working:

$ md5sum uitrusting.pdf
010b622fe01c589f5f49bb8b86777396 uitrusting.pdf
$ md5sum uitrusting_downloaded.pdf
010b622fe01c589f5f49bb8b86777396 uitrusting_downloaded.pdf

from python-telegram-bot.

leandrotoledo avatar leandrotoledo commented on May 22, 2024

Windows-related issue, looking further...

from python-telegram-bot.

ramiro avatar ramiro commented on May 22, 2024

Aren't you supposed to use the 'b' (binary) mode open() flag to to open non-text files on Windows?

from python-telegram-bot.

franciscod avatar franciscod commented on May 22, 2024

Can someone upload the PDF for reproducing this?

from python-telegram-bot.

leandrotoledo avatar leandrotoledo commented on May 22, 2024

Hi @rjdevries, would you please test it again? I've tried on Windows 7 Professional 64 bits using Python 2.7, latest release 2.4 and everything seems to be working.

from python-telegram-bot.

leandrotoledo avatar leandrotoledo commented on May 22, 2024

Sample code:

import telegram

bot = telegram.Bot('TOKEN')

update = bot.getUpdates()[-1]
chat_id = update.message.chat_id
document = open('PDF.pdf', 'rb')

bot.sendDocument(chat_id=chat_id, document=document)

from python-telegram-bot.

leandrotoledo avatar leandrotoledo commented on May 22, 2024

@rjdevries, as stated by @ramiro, you have to open() using 'b' (binary). Only 'r' will cause 1Kb file, like the issue you mentioned. I'll mark this as WAI. Thank you @ramiro, good catch.

from python-telegram-bot.

rjdevries avatar rjdevries commented on May 22, 2024

I've tested it with the b (binary) and that works great. Thanks!

from python-telegram-bot.

Related Issues (20)

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.