Traceback (most recent call last):
File "", line 1, in
import pg
File "C:\Python26\Lib\site-packages\pg.py", line 21, in -toplevel-
from _pg import *
ImportError: DLL load failed: The specified module could not be found.
Solution:
Make sure the PostgreSQL C interface (libpq.dll) is installed or
its directory (\Postgresql\bin) is on PATH.
{Notes to self, programming, technology, linux, windows, git} U {Papers, reviews, games, coffee, tabletennis, ramblings} = {things worth saving}
Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Saturday, May 02, 2009
Python: Postgres module import failure
Monday, October 13, 2008
Python trick - getattr
getattr is teh awesome. Using string concatenation, we can obtain a real method reference (which is an object in python), and call it!
import printhelper #defines various print methods named "print_"
def print(to_print, format=):
to_call = getattr(printhelper, "print_%s" % type, printhelper.print_text)
return to_call(to_print)
import printhelper #defines various print methods named "print_
def print(to_print, format=
to_call = getattr(printhelper, "print_%s" % type, printhelper.print_text)
return to_call(to_print)
Subscribe to:
Posts (Atom)