473,323 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

syntax errors while building pypgsql

Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
PGconn *conn;
PyObject *host;
PyObject *port;
PyObject *db;
PyObject *options;
PyObject *tty;
PyObject *user;
PyObject *pass;
PyObject *bePID;
PyObject *socket;
PyObject *version;
PyObject *notices;
PyObject *cinfo;
int showQuery;
} PgConnection;
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here:

PyObject_HEAD /* Here is the syntax error */
PGconn *conn;

The setup.py-settings look good to me, I use debian sarge stable.
Installation of PostgreSQL ran without any problems.
Nov 23 '05 #1
9 1713
Have you tried apt-get build-dep pypgsql ?

It could be that you lacks the necessary packages to build it.

Tin Gherdanarra wrote:
Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
PGconn *conn;
PyObject *host;
PyObject *port;
PyObject *db;
PyObject *options;
PyObject *tty;
PyObject *user;
PyObject *pass;
PyObject *bePID;
PyObject *socket;
PyObject *version;
PyObject *notices;
PyObject *cinfo;
int showQuery;
} PgConnection;
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here:

PyObject_HEAD /* Here is the syntax error */
PGconn *conn;

The setup.py-settings look good to me, I use debian sarge stable.
Installation of PostgreSQL ran without any problems.


Nov 23 '05 #2
bo****@gmail.com wrote:
Have you tried apt-get build-dep pypgsql ?

It could be that you lacks the necessary packages to build it.
funny you'd mention it, I did. pypgsql does not seem to
be an apt-get package, however. It did not work because
"E: Couldn't find package pypgsql"

The fact that there is a

PyObject_HEAD PGconn *conn;

throws an error can't be relieved by another package,
I guess...

Tin Gherdanarra wrote:
Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
PGconn *conn;
PyObject *host;
PyObject *port;
PyObject *db;
PyObject *options;
PyObject *tty;
PyObject *user;
PyObject *pass;
PyObject *bePID;
PyObject *socket;
PyObject *version;
PyObject *notices;
PyObject *cinfo;
int showQuery;
} PgConnection;
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here:

PyObject_HEAD /* Here is the syntax error */
PGconn *conn;

The setup.py-settings look good to me, I use debian sarge stable.
Installation of PostgreSQL ran without any problems.


Nov 23 '05 #3

Tin Gherdanarra wrote:
bo****@gmail.com wrote:
Have you tried apt-get build-dep pypgsql ?

It could be that you lacks the necessary packages to build it.


funny you'd mention it, I did. pypgsql does not seem to
be an apt-get package, however. It did not work because
"E: Couldn't find package pypgsql"

The fact that there is a

PyObject_HEAD PGconn *conn;

throws an error can't be relieved by another package,
I guess...

If that is the case, you need to read the pypgsql for what it is
needed. As an alternative, you may try apt-get build-dep celementtree
which may pull in the necessary files. But this is really WAG.

Nov 23 '05 #4
bo****@gmail.com wrote:
Tin Gherdanarra wrote:
bo****@gmail.com wrote:
Have you tried apt-get build-dep pypgsql ?

It could be that you lacks the necessary packages to build it.


funny you'd mention it, I did. pypgsql does not seem to
be an apt-get package, however. It did not work because
"E: Couldn't find package pypgsql"

The fact that there is a

PyObject_HEAD PGconn *conn;

throws an error can't be relieved by another package,
I guess...


If that is the case, you need to read the pypgsql for what it is
needed. As an alternative, you may try apt-get build-dep celementtree
which may pull in the necessary files. But this is really WAG.

Thanks, but what is WAG?

This came right in: Confusingly, it's not apt-get pypgsql, it is
python-pgsql. After doing a apt-get python-pgsql. I'm not yet
one happy camper, but getting there. Thanks.

Nov 23 '05 #5
Tin Gherdanarra wrote:
Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
[...]
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here: [...]


I don't think that's the real error. Are there any error messages
*before* that? Like the compiler can't find "Python.h" or something?
That would be an indication that you do not have the python-devel
package installed.

Btw. the Debian package of pyPgSQL is called python-pgsql, so an apt-get
install python-pgsql should do.

-- Gerhard

Nov 23 '05 #6
On Wed, 2005-11-23 at 08:01, Tin Gherdanarra wrote:
Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
PGconn *conn;
PyObject *host;
PyObject *port;
PyObject *db;
PyObject *options;
PyObject *tty;
PyObject *user;
PyObject *pass;
PyObject *bePID;
PyObject *socket;
PyObject *version;
PyObject *notices;
PyObject *cinfo;
int showQuery;
} PgConnection;
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here:


PyObject_HEAD is not a type, it is a macro that defines struct members
that all Python objects have in common. The macro definition has a
semicolon at the end, so when the macro is expanded, the result is
syntactically correct, even though the above looks wrong on the surface.

What error messages are you actually getting? If you are getting a long
list of errors, please give us the first few rather than the last few.

-Carsten
Nov 23 '05 #7

Tin Gherdanarra wrote:
typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */ [snip] } PgConnection;
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here:

PyObject_HEAD /* Here is the syntax error */
PGconn *conn;


PyObject_HEAD is a macro defined in the Python headers. It provides the
internal fields common to all Python objects to provide garbage
collection and other services. If that's throwing errors, then your
compiler isn't finding the headers. Check to see if you have the file
/usr/include/python*/Python.h on your system.

-- David

Nov 23 '05 #8
Gerhard Häring wrote:
Tin Gherdanarra wrote:
Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
[...]
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here: [...]

I don't think that's the real error.


Well, I don't know what's going on in that struct def,
but to me it looks a little weird.
Are there any error messages
*before* that?
Nope. First error.
Like the compiler can't find "Python.h" or something?
That would be an indication that you do not have the python-devel
package installed.
This provokes different errors. Your idea is good, though,
because this was the first problem another correspondent
pointed out.

Btw. the Debian package of pyPgSQL is called python-pgsql, so an apt-get
install python-pgsql should do.
Thanks, this I have found out already (see previous post).
It is in the fine print of the documentation.

Thanks
Tin

-- Gerhard

Nov 23 '05 #9
Carsten Haese wrote:
On Wed, 2005-11-23 at 08:01, Tin Gherdanarra wrote:
Hallo,

I'm trying to install pypgsql. However, I get syntax errors
while compiling the C sources. The following excerpt
from pgconnection.h looks a little funny to me:

typedef struct {
PyObject_HEAD /* Here is the syntax error, and rightly so */
PGconn *conn;
PyObject *host;
PyObject *port;
PyObject *db;
PyObject *options;
PyObject *tty;
PyObject *user;
PyObject *pass;
PyObject *bePID;
PyObject *socket;
PyObject *version;
PyObject *notices;
PyObject *cinfo;
int showQuery;
} PgConnection;
I don't know what PyObject_HEAD or PGconn is,
but if they are types, a syntax error is justified here:

PyObject_HEAD is not a type, it is a macro that defines struct members
that all Python objects have in common. The macro definition has a
semicolon at the end, so when the macro is expanded, the result is
syntactically correct, even though the above looks wrong on the surface.


Aha! Weird!

What error messages are you actually getting? If you are getting a long
list of errors, please give us the first few rather than the last few.
The aforementioned error was the first one.
I "fixed" it by delegating the installation/build to
apt-get python-pgsql. That did it for me.

Unfortunately, I can't duplicate the errors now.

This probably means that apt-get automatically failed
to install some stuff I failed to do.

However, I don't think that you miss anything interesting,
i.e. a bug in pysql or so. This was just a newbie problem.
Thanks all the same
Tin


-Carsten

Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paolo Alexis Falcone | last post by:
Whenever I try to access a table with many rows using PgSQL's fetchall(), this happens: >>> from pyPgSQL import PgSQL >>> db = PgSQL.connect("192.168.0.8:5432:whitegold","dondon","dondon") >>>...
0
by: Timo Virkkala | last post by:
Hello. I'm having some trouble with getting the pyPgSQL module to work. I installed it and the mxDateTime module into my local directory (I'm doing this on my university's server and I don't...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
2
by: Rene Pijlman | last post by:
I can't seem to find any way to specify the character encoding with the DB API implementation of PyPgSQL. There is no mention of encoding and Unicode in the DB API v2.0 spec and the PyPgSQL README....
2
by: Frank Millman | last post by:
Hi all Below is the text of a message I was about to send in connection with an obscure problem. I have now almost got to the bottom of it, and am fairly confident that it is a bug in pyPgSQL. I...
3
by: Gurpreet Sachdeva | last post by:
I am using Redhat 9.0/python2.3. I installed pyPgSQL-2.4.tar.gz and it was successfull. Now when I am trying to import that module, I got: Python 2.3.3 (#1, Jan 11 2005, 15:24:09) on linux2...
1
by: Hari Sekhon | last post by:
I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something ...
0
by: Eric | last post by:
Hey guys, Has anyone seen this error when installing trac? The problem seems related to pyPgSQL, which is installed. (Although I had to go in and add some headers to make it work) Templates...
3
by: Maciek | last post by:
All, I'm having a problem building a library (VMime) with Visual .NET 2003. It's including, among others, gnutls.h from the GNU TLS library and I'm getting syntax errors in that file. For...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.