[PyGreSQL] suggested PyGreSQL setup.py change

Lance E Sloan lsloan-000002 at umich.edu
Fri Feb 3 11:40:46 EST 2006


I sent the following message to D'Arcy, who asked that I submit it to the 
mailing list for discussion:

I was helping a friend who had trouble installing PyGreSQL immediately 
after installing PostgreSQL.  The problem turned out to be that he hadn't 
added the PostgreSQL "bin" directory to his path after installing it, so 
PyGreSQL's setup.py program couldn't find "pg_config".  The way the program 
went past that problem and invoked the compiler left him with many error 
messages from the compiler that didn't indicate what the root of the 
problem really was.

I suggest making a small change to "setup.py" to help remove some 
confusion.  What you have now:

  def getconfig(s):
          f = os.popen("pg_config --%s"% (s))
          x = f.readline().strip()
          f.close()
          return x


My suggested change:

  def getconfig(s):
          f = os.popen("pg_config --%s"% (s))
          x = f.readline().strip()
          status = f.close()
          if ( status != None ):
                  raise "\n\n** There was a problem running pg_config.
                  Check that it is in your PATH. **\n"
          else:
                  return x

Or something along those lines.  Maybe you don't want to use "raise" since 
it generates a stack backtrace, which could be distracting or confusing.

That should help some folks.

--
Lance E Sloan, Systems Research Programmer III
U-M WATS: Web Applications, Technologies, and Solutions
Full-service web and database design, development, and hosting.
http://www.itcs.umich.edu/wats/ - "Putting U on the Web"




More information about the PyGreSQL mailing list