Notes and anecdotes

Techstuff rambling

Boto3 – copying and creating files + cloudfront invalidations

A 1-2-3 on Python3 boto3 package with my most common operations

Dads python3-to-exe guide

Dad is a good guy. But he ain’t like virtualenv -p $(pyenv which python3) .venv, then pip install -r requirements.txt? NP, SON! He’s more like When I double click the python file, cmd flashes and I bluescreen. So he needs an exe file. Here’s a general snippet for converting python3 to exe

Adding a python API handler with serverless

Create an AWS Lambda function with Python3 and integrate with S3? Simple if you know how (though getting there is a bitch, I bet Amazon does this on purpose as a way to trick developers in on their certification-ride). I found how, copy-paste below.

Django autocomplete in (virtualenv) shell

Create a file .pythonrc in ~/.pythonrc # enable syntax completion try: import readline except ImportError: print(“Module readline not available.”) else: import rlcompleter readline.parse_and_bind(“tab: complete”) Export it by adding this export to your profile file (if you use zsh, append to ~/.zprofile instead) echo “export PYTHONSTARTUP=~/.pythonrc” >> ~/.bash_profile Virtualenv Want it in virutalenv? Append it to your activate…

Continue Reading

Get python, pip, virtualenv without sudo

Case: You don’t have sudo and life is awful on a cheap VPS or similar. Step 1: Get your desired python version Python 2.7 cd mkdir python cd python mkdir src cd src wget tar xvfz Python-2.7.3.tgz cd Python-2.7.3 mkdir ~/python/python27 ./configure -prefix=/home/username/python/python27 make make install cd echo “export PATH=$HOME/python/python27/bin” >> .bashrc source .bashrc…

Continue Reading

No module named ‘_sqlite3’

TLDR: Try sudo apt-get install python-dev sudo apt-get install libsqlite3-dev And recompile python (see own post) Long version So, I was starting a django app (1.7.1 with Python 3.4), python migrate when i encountered django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named ‘_sqlite3’ Did not expect this. I have…

Continue Reading

pip on python3: Can’t decompress data; zlib not available

Getting pip3.4 to work Want Python3.4 on your debian with virtualenv and pip? That’s what I wanted. However, I didn’t get pip automatically, and when I tried to install it, python gave me “Can’t decompress data; zlib not available” Spent a whole lot of time on this. Seems like installing 3.4 properly (with –with-zlib parameter when configuring) makes…

Continue Reading