Re: Problem in installing PyGreSQL

2009-08-03 Thread Philip Semanchuk


On Aug 3, 2009, at 11:45 PM, Thangappan.M wrote:


Dear all,

I want to access the database related stuffs in python.So I found the
PyGreSQL module in net.
Then I tried to download the module.But I am not able to download it.

I am not a super user.
I am using Linux debian machine
Python version is 2.4.4


Hi Thangappan,
If you want us to be able to help you, you'll need to give more  
information. For instance, why are you not able to download PyGreSQL?


You might want to try psycopg2 which also gives you access to  
PostgreSQL from Python. You can download it from this site:

http://initd.org/


Hope this helps
Philip
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-03 Thread David Lyon
On Tue, 4 Aug 2009 09:15:47 +0530, "Thangappan.M" 
wrote:
> I want to access the database related stuffs in python.So I found the
> PyGreSQL module in net.
> Then I tried to download the module.But I am not able to download it.

Did none of the links here work?

http://www.pygresql.org/readme.html#where-to-get

> I am not a super user.
> I am using Linux debian machine
> Python version is 2.4.4

Try building it from source.

Otherwise try getting it from pypi

http://pypi.python.org/pypi/PyGreSQL/

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread D'Arcy J.M. Cain
On Tue, 04 Aug 2009 00:42:25 -0400
David Lyon  wrote:
> > Then I tried to download the module.But I am not able to download it.
> 
> Did none of the links here work?
> 
> http://www.pygresql.org/readme.html#where-to-get

The RPM seems to be missing.  I am currently trying to find one.  I
don't run Linux myself and sometimes forget to check that we have a
working RPM.

> > I am not a super user.
> > I am using Linux debian machine
> > Python version is 2.4.4
> 
> Try building it from source.

That will work of course and it is a small enough package that it
should build painlessly.  There is a working setup.py.

> Otherwise try getting it from pypi

It is also missing the RPM.

-- 
D'Arcy J.M. Cain  |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread Benjamin Kaplan
On Tue, Aug 4, 2009 at 8:48 AM, D'Arcy J.M. Cain wrote:
> On Tue, 04 Aug 2009 00:42:25 -0400
> David Lyon  wrote:
>> > Then I tried to download the module.But I am not able to download it.
>>
>> Did none of the links here work?
>>
>> http://www.pygresql.org/readme.html#where-to-get
>
> The RPM seems to be missing.  I am currently trying to find one.  I
> don't run Linux myself and sometimes forget to check that we have a
> working RPM.
>
>> > I am not a super user.
>> > I am using Linux debian machine
>> > Python version is 2.4.4
>>
>> Try building it from source.
>
> That will work of course and it is a small enough package that it
> should build painlessly.  There is a working setup.py.
>
>> Otherwise try getting it from pypi
>
> It is also missing the RPM.

Doesn't matter here. Debians use DEBs (DEBian packages), not RPMs (for
the Red Hat Package Manager). Either way, the OP can't install system
level packages. That's what the comment about not being a super user
meant.

>
> --
> D'Arcy J.M. Cain          |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in Installing PyGreSQL

2009-08-04 Thread Philip Semanchuk


On Aug 4, 2009, at 8:25 AM, Thangappan.M wrote:


Dear all,

While installing PyGreSQl module in my machine I got the error as  
pg_config

command not found.
I am not a super user.
how can I install this pg_config tool.



Thangappan,
pg_config is part of PostgreSQL. It reports various pieces of  
information about the Postgres installation, like the BINDIR,  
INCLUDEDIR, compile flags, version etc. If PostgreSQL is installed on  
your machine, then I'll bet that pg_config is also installed, but it  
isn't on your path so the PyGreSQl installer can't find it.


When you're having trouble installing a specific package like  
PyGreSQl, you'll probably get better answers by posting your questions  
to a specific mailing list:

http://mailman.vex.net/mailman/listinfo/pygresql

By searching the archives you might even find that your question has  
been answered already.


Good luck
Philip
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread D'Arcy J.M. Cain
On Tue, 4 Aug 2009 09:03:55 -0400
Benjamin Kaplan  wrote:
> Doesn't matter here. Debians use DEBs (DEBian packages), not RPMs (for
> the Red Hat Package Manager). Either way, the OP can't install system
> level packages. That's what the comment about not being a super user
> meant.

Urk!  I thought that all the Linux distros used RPMs.  Maybe I should
just remove that link and let each distro provide their own package.
As long as it was just one I could take some steps to make sure that I
wasn't distributing malware but the more packages I supply that I can't
personally test, the more uncomfortable I get.

-- 
D'Arcy J.M. Cain  |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread D'Arcy J.M. Cain
On Tue, 4 Aug 2009 09:03:55 -0400
Benjamin Kaplan  wrote:
> Doesn't matter here. Debians use DEBs (DEBian packages), not RPMs (for
> the Red Hat Package Manager). Either way, the OP can't install system
> level packages. That's what the comment about not being a super user
> meant.

By the way, you don't have to be super user to install PyGreSQL.  You
just need SU if you want to install it system wide.  PyGreSQL doesn't
require any special privileges to run.

-- 
D'Arcy J.M. Cain  |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread Benjamin Kaplan
On Tue, Aug 4, 2009 at 9:55 AM, D'Arcy J.M. Cain wrote:
> On Tue, 4 Aug 2009 09:03:55 -0400
> Benjamin Kaplan  wrote:
>> Doesn't matter here. Debians use DEBs (DEBian packages), not RPMs (for
>> the Red Hat Package Manager). Either way, the OP can't install system
>> level packages. That's what the comment about not being a super user
>> meant.
>
> By the way, you don't have to be super user to install PyGreSQL.  You
> just need SU if you want to install it system wide.  PyGreSQL doesn't
> require any special privileges to run.

Right, but the packages install system-wide. That's why he could
compile it himself but not use the package.
>
> --
> D'Arcy J.M. Cain          |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread D'Arcy J.M. Cain
On Tue, 4 Aug 2009 10:02:23 -0400
Benjamin Kaplan  wrote:
> > By the way, you don't have to be super user to install PyGreSQL.  You
> > just need SU if you want to install it system wide.  PyGreSQL doesn't
> > require any special privileges to run.
> 
> Right, but the packages install system-wide. That's why he could
> compile it himself but not use the package.

Exactly so don't install the package.  Do "python setup.py build" and
put the three files that are built (_pg.so, pg.py and pgdb.py) into any
directory and point PYTHONPATH to it.

-- 
D'Arcy J.M. Cain  |  Democracy is three wolves
http://www.druid.net/darcy/|  and a sheep voting on
+1 416 425 1212 (DoD#0082)(eNTP)   |  what's for dinner.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-04 Thread Дамјан Георгиевски
>> > By the way, you don't have to be super user to install PyGreSQL. 
>> > You just need SU if you want to install it system wide.  PyGreSQL
>> > doesn't require any special privileges to run.
>> 
>> Right, but the packages install system-wide. That's why he could
>> compile it himself but not use the package.
> 
> Exactly so don't install the package.  Do "python setup.py build" and
> put the three files that are built (_pg.so, pg.py and pgdb.py) into
> any directory and point PYTHONPATH to it.

Or.. with Python 2.6 and up, you can do:
   python setup.py install --user
and it will install the package in users own 
~/.local/lib/python2.6/site-packages/

BTW that path is configurable with the PYTHONUSERBASE environment 
variable.

see: http://www.python.org/dev/peps/pep-0370/

-- 
дамјан ( http://softver.org.mk/damjan/ )

Spammers scratch here with a diamond to find my address:
|||
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-06 Thread Thangappan.M
I have downloaded the  psycopg2 tar file from the following link.
http://initd.org/tracker/psycopg

I have done the following things.
 * Extracting the files from the tar file
 * tried to execute python ./setup.py build

It gives the following error.

#python ./setup.py build

running build
running build_py
running build_ext
Traceback (most recent call last):
  File "./setup.py", line 410, in ?
ext_modules=ext)
  File "distutils/core.py", line 149, in setup
  File "distutils/dist.py", line 946, in run_commands
  File "distutils/dist.py", line 966, in run_command
  File "distutils/command/build.py", line 112, in run
  File "/usr/lib/python2.4/cmd.py", line 333, in run_command
del help[cmd]
  File "distutils/dist.py", line 965, in run_command
  File "/usr/lib/python2.4/cmd.py", line 117, in ensure_finalized
pass
  File "./setup.py", line 219, in finalize_options
except (Warning, w):
NameError: global name 'w' is not defined

What would be the solution?
Otherwise can you tell how to install DB-API in debian machine.

On Wed, Aug 5, 2009 at 10:43 AM, Dennis Lee Bieber wrote:

> On Tue, 4 Aug 2009 09:55:47 -0400, "D'Arcy J.M. Cain" 
> declaimed the following in gmane.comp.python.general:
>
> >
> > By the way, you don't have to be super user to install PyGreSQL.  You
> > just need SU if you want to install it system wide.  PyGreSQL doesn't
> > require any special privileges to run.
> >
> Potentially silly question:
>
>While the DB-API module may be installable in a user mode... Do we
> know if the original querant even has PostgreSQL running and accessible?
>
> The statement
>
> OP> I want to access the database related stuffs in python.So I found
> the
> OP> PyGreSQL module in net.
>
> doesn't leave me with any confidence that they realize this is just an
> access module for one specific server -- and that they still need a
> server to which they can connect.
>
>If they don't have a PostgreSQL server, it may be better just to
> direct them to SQLite3...
> --
>WulfraedDennis Lee Bieber   KD6MOG
>wlfr...@ix.netcom.com   wulfr...@bestiaria.com
>HTTP://wlfraed.home.netcom.com/
>(Bestiaria Support Staff:   web-a...@bestiaria.com)
>HTTP://www.bestiaria.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards,
Thangappan.M
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-07 Thread Scott David Daniels

Dennis Lee Bieber wrote:

On Thu, 6 Aug 2009 16:00:15 +0530, "Thangappan.M"
 declaimed the following in
gmane.comp.python.general:

  File "./setup.py", line 219, in finalize_options
except (Warning, w):
NameError: global name 'w' is not defined

What would be the solution?
Otherwise can you tell how to install DB-API in debian machine.

Sorry... 1) I run on WinXP; 2) I don't build packages, relying on
pre-built binaries; 3) I run MySQL.

However, based upon the examples in the Tutorial, that line should
not have the (, ). A parenthesised (tuple) is suppose to contain a list
of exceptions, and the parameter to catch the exception specifics has to
be outside the list.

Best I can suggest is editing that particular line and removing the
(, ) -- then try rebuilding.

I'll also re-ask: All you are installing is the Python adapter to
the database. DO YOU HAVE A RUNNING PostgreSQL server that you can
connect to?


Just to be a bit more explict:
Change file setup.py's line 219 from:
>> except (Warning, w):
to either (OK in Python 2.6 and greater):
   except Warning as w:
or (works for Python 2.X):
   except Warning, w:


--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem in installing PyGreSQL

2009-08-10 Thread Thangappan.M
Here I attached the setup.py and setup.cfg file.This is for your reference.
I have changed the exception line.
Even though I got the following error while running the python setup.py
build
running build
running build_py
running build_ext
error: No such file or directory

===

On Fri, Aug 7, 2009 at 7:38 PM, Scott David Daniels
wrote:

> Dennis Lee Bieber wrote:
>
>> On Thu, 6 Aug 2009 16:00:15 +0530, "Thangappan.M"
>>  declaimed the following in
>> gmane.comp.python.general:
>>
>>>  File "./setup.py", line 219, in finalize_options
>>>except (Warning, w):
>>> NameError: global name 'w' is not defined
>>>
>>> What would be the solution?
>>> Otherwise can you tell how to install DB-API in debian machine.
>>>
>>Sorry... 1) I run on WinXP; 2) I don't build packages, relying on
>> pre-built binaries; 3) I run MySQL.
>>
>>However, based upon the examples in the Tutorial, that line should
>> not have the (, ). A parenthesised (tuple) is suppose to contain a list
>> of exceptions, and the parameter to catch the exception specifics has to
>> be outside the list.
>>
>>Best I can suggest is editing that particular line and removing the
>> (, ) -- then try rebuilding.
>>
>>I'll also re-ask: All you are installing is the Python adapter to
>> the database. DO YOU HAVE A RUNNING PostgreSQL server that you can
>> connect to?
>>
>
> Just to be a bit more explict:
> Change file setup.py's line 219 from:
> >> except (Warning, w):
> to either (OK in Python 2.6 and greater):
>   except Warning as w:
> or (works for Python 2.X):
>   except Warning, w:
>
>
> --Scott David Daniels
> scott.dani...@acm.org
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards,
Thangappan.M


setup.cfg
Description: Binary data
# setup.py - distutils packaging
#
# Copyright (C) 2003-2004 Federico Di Gregorio  
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.

"""Python-PostgreSQL Database Adapter

psycopg is a PostgreSQL database adapter for the Python programming
language. This is version 2, a complete rewrite of the original code to
provide new-style classes for connection and cursor objects and other sweet
candies. Like the original, psycopg 2 was written with the aim of being
very small and fast, and stable as a rock.

psycopg is different from the other database adapter because it was
designed for heavily multi-threaded applications that create and destroy
lots of cursors and make a conspicuous number of concurrent INSERTs or
UPDATEs. psycopg 2 also provide full asycronous operations for the really
brave programmer.
"""

classifiers = """\
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License (GPL)
License :: OSI Approved :: Zope Public License
Programming Language :: Python
Programming Language :: C
Programming Language :: SQL
Topic :: Database
Topic :: Database :: Front-Ends
Topic :: Software Development
Topic :: Software Development :: Libraries :: Python Modules
Operating System :: Microsoft :: Windows
Operating System :: Unix
"""

import os
import os.path
import sys
import subprocess
import ConfigParser
from distutils.core import setup, Extension
from distutils.errors import DistutilsFileError
from distutils.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
from distutils.ccompiler import get_default_compiler

PSYCOPG_VERSION = '2.0.10'
version_flags   = ['dt', 'dec']

PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win')

def get_pg_config(kind, pg_config="pg_config"):
p = subprocess.Popen([pg_config, "--" + kind],
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)
p.stdin.close()
r = p.stdout.readline().strip()
if not r:
raise Warning(p.stderr.readline())
return r

class psycopg_build_ext(build_ext):
"""Conditionally complement the setup.cfg options file.

This class configures the include_dirs, libray_dirs, libraries
options as required by the system. Most of the configuration happens
in finalize_options() method.

If you want to set up the build step for a peculiar platform, add a
method finalize_PLAT(), where PLAT matches your sys.platform.
"""
user_options = build_ext.user_options[:]
user_options.extend([
('use-pydatetime', None,
 "Use Python datatime objects for date and time representation."),
('pg-config=', None,