By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,657 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,657 IT Pros & Developers. It's quick & easy.

syntax errors while building pypgsql

P: n/a
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
Share this Question
Share on Google+
9 Replies


P: n/a
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

P: n/a
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

P: n/a

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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.