Category Archives: python

Unable to load psycopg2 on Mac OSX El Capitan

I upgraded to El Capitan today and of course had to reinstall homebrew and all my python and development tools. I went to try to run a django app on my machine and kept getting this error: django.core.exceptions.ImproperlyConfigured: Error loading … Continue reading

Posted in Mac OS X, postgres, python | Comments Off on Unable to load psycopg2 on Mac OSX El Capitan

Wake on LAN script in Python

This works. #!/usr/bin/env python # wol.py import socket import struct def wake_on_lan(macaddress): “”” Switches on remote computers using WOL. “”” # Check macaddress format and try to compensate. if len(macaddress) == 12: pass elif len(macaddress) == 12 + 5: sep … Continue reading

Posted in python | Comments Off on Wake on LAN script in Python

ImportError: cannot import name utils

If you get an error like this: File “python/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py”, line 9, in <module> from django.db import utils ImportError: cannot import name utils You need to install psycopg2.  You will also probably need to apt-get install build-essential libpq-dev

Posted in django, python | Comments Off on ImportError: cannot import name utils

Error: pg_config executable not found.

This bogus error can be frustrating to figure out. I have figured it out a few times over the years and always forget how I solved it because it only occurs on a server where you have never deployed a … Continue reading

Posted in Linux, postgres, python | Comments Off on Error: pg_config executable not found.