Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Problem with sending text file as an attachment using this Gmail OAuth script
Post: RE: Problem with sending text file as an attachmen...

You will need to do something like this, to read line by line: if main_type == 'text': print("text") output_file = "" with open(attached_file, 'r') as fp: # 'rb' will send this ...
lghauth General Coding Help 6 6,987 Feb-07-2018, 07:00 PM
    Thread: Problem with sending text file as an attachment using this Gmail OAuth script
Post: RE: Problem with sending text file as an attachmen...

By default when you open a file in text mode, Python 3 will convert all "newlines" to "\n" and Windows uses "\r\n". Thats why you are having this issue. From Python documentation https://docs.python...
lghauth General Coding Help 6 6,987 Feb-07-2018, 01:51 PM
    Thread: Problem with sending text file as an attachment using this Gmail OAuth script
Post: RE: Problem with sending text file as an attachmen...

It might be because your are encoding (base64) the attachment in the line 203. encoders.encode_base64(attachement) #https://docs.python.org/3/library/email-examples.htmlThe MIMEImage, MIMEAudio, MIM...
lghauth General Coding Help 6 6,987 Feb-06-2018, 10:59 AM
    Thread: Need to find a mistake in my code
Post: RE: Need to find a mistake in my code

I've never used sage before, but take a look at this link: https://ask.sagemath.org/question/8131/a...ibute-mod/ seems sage doesn't work properly (sometimes) with range, due the Sage Integer type. ...
lghauth General Coding Help 3 3,154 Jan-11-2018, 12:53 PM
    Thread: How to make a for loop asynchronous?
Post: RE: How to make a for loop asynchronous?

You maybe looking for multithreading programming. In this book you can find some guidelines to start with Multithreading in Python - http://books.goalkicker.com/PythonBook/ - Chapter 35: Multithreadi...
lghauth Web Scraping & Web Development 2 2,599 Jan-10-2018, 10:01 PM
    Thread: Error string indice must integers Json
Post: RE: Error string indice must integers Json

Are you sure the code below is the one which is causing the error? response = requests.get("http://www.testecliente.com.br/ApiTeste/GetDadosCartaoCliente?CL_COD=1" ) retorno = response.content retorn...
lghauth General Coding Help 8 9,051 Jan-10-2018, 07:25 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020