473,734 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1722
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.co m 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.
Installatio n of PostgreSQL ran without any problems.


Nov 23 '05 #3

Tin Gherdanarra wrote:
bo****@gmail.co m 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.co m 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
2775
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") >>> PgSQL.NoPostgresCursor = 1 >>> cur = db.cursor() >>> cur.execute("SELECT * FROM customer") >>> data = cur.fetchall() Traceback (most recent call last):
0
1449
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 have access to /usr). When I try to import it I get the following error: >>> from pyPgSql import libpq Traceback (most recent call last): File "<stdin>", line 1, in ?
699
34043
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
2
3602
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. When I have Unicode strings in Python and store it in a PostgreSQL Unicode database, will the data automatically be correctly encoded? Or do I need to specify the UTF-8 client encoding on the database connection somehow? I'm using the...
2
1386
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 hope this is the correct place to report such bugs. If not, please advise the correct forum. I have left the original message intact as it provides important information. At the bottom, I have recorded the new information that I
3
2765
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 Type "help", "copyright", "credits" or "license" for more information. >>> from pyPgSQL import PgSQL Traceback (most recent call last): File "<stdin>", line 1, in ? File "pyPgSQL/PgSQL.py", line 391, in ?
1
2225
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 sys.excepthook=myexcepthook rest of script.... (now protected by catchall exception hook)
0
1170
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 directory > Creating and Initializing Project Failed to create environment.
3
3441
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 example this line: typedef ssize_t (*gnutls_pull_func) (gnutls_transport_ptr_t, void *, size_t);
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.