Skip to main content

Posts

Showing posts with the label Python

Gmail: Download blocked file

                                          Hi, today we are going to learn, how to download blocked file in gmail. Sometimes you see following message in gmail: and you can't download attached file Follow steps to download file: 1. Open original message as shown in image 2. Download Original let's name it download_original.txt 3.  Save following python script in same directory. Let's name it import_file.py import email import sys if __name__=='__main__':     if len(sys.argv)<2:         print "Please enter a file to extract attachments from"         sys.exit(1)     msg = email.message_from_file(open(sys.argv[1]))     for pl in msg.get_payload():         if pl.get_filename(): # if it is an attachment             o...

Django, Eclipse and virtualenv setup

1. Create Virtual Environment ~ pip install virtualenv ~ virtualenv venv 2. Download & install Eclipse 3. Install PyDev Go to Help -> Eclipse Marketplace -> Search PyDev and install it. 3. Each django virtual environment will be having new workspace and have to use virtual environment interpreter.  Setup Python interpreter: Eclipse -> Preferences -> PyDev -> Python Interpreter Add new interpreter New -> Set Interpreter Name -> Interpreter Executable(venv/bin/python) Let's say new interpreter name is: customenv Note: You can skip this step at this moment and add the interpreter at the time of creating a project. 4.   Create New Project -> PyDev -> PyDev Django Project If Interpreter is not set till now, please set it now from step 3 Enter Project Name and Select Interpreter(customenv) -> Finish 5. Right Click on  Project Name-> Properties -> PyDev - Django -> Django settings module (set...