Archive for the ‘python’ Category

Python MySqlDb fixed

Posted: April 13, 2013 in python, ubuntu

still getting error

Error 2002: Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

got the answer here:

Changing localhost to 127.0.0.1 solved my problem using MySQLdb

Advertisements

python send email from gmail

Posted: March 22, 2013 in python

found this easy post on how to do it. worked g8 on 1st try.

the only problem was that i didn’t understand where to put the SUBJECT.

so found these links:

http://www.velocityreviews.com/forums/t485760-re-subject-line-with-smtplib-sendmail.html

http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script.htm

the message actually contains everything (from+to+subject+message)

but if you need HTML mail just use this post, it’s much better. also worked fine.