python

Fix fatal error: Python.h: No such file or directory

Do you have this error in your when trying to pip install certain packages? (In my case pycrypto)

fatal error: Python.h: No such file or directory

Fix it by installing Python development libraries.

Ubuntu

sudo apt-get install python2.7-dev

Will probably also work for other versions of python (i.e. python2.X-dev)

Via Alex Sleat

Fix django-crowdsourcing

I was trying to use the django-crowdsourcing for an app that I was trying to put together I kept getting this error:

TypeError: can’t compare offset-naive and offset-aware datetimes

It turns out that there is a new concept for Django 1.4 timezones. To fix the problem you need to install some python libraries and replace use of the standard python datetime object.

terminal% pip install pytz
from django.utils import timezone

Look for

datetime.now()

Replace with

timezone.now()

Python Facebook API open graph client

Since Facebook changed everything over to Open Graph they deprecated the pyfacebook library. This stack exchange thread suggests Facepy. Everybody else suggests using the Javascript API but I really just wanted something easy on the backend to execute a few curl requests per user action on the back end in my Django app. I haven’t used this library yet but we’ll see where it goes.

Facepy – Facebook API wrapper in python

Syndicate content