syntax errors while building pypgsql

T

Tin Gherdanarra

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.
 
B

bonono

Have you tried apt-get build-dep pypgsql ?

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

Tin Gherdanarra

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...
 
B

bonono

Tin said:
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.
 
T

Tin Gherdanarra

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.
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Tin said:
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
 
C

Carsten Haese

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
 
D

David Wahler

Tin said:
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
 
T

Tin Gherdanarra

Gerhard said:
Tin said:
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
 
T

Tin Gherdanarra

Carsten said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top