From: xbouska at infima.cz (Richard Bouska)
Date: Thu, 06 May 1999 15:24:56 +0200
Subject: string containing raw data - PyArg_ParseTuple() bug?
Message-ID: <37319827.A0CA404@infima.cz>
X-UID: 1734                                                

I have a problem with when I want to copy a file to databaze:
	lo=db.locreate(pg.INV_READ|pg.INV_WRITE)
        lo.open(pg.INV_WRITE)
        buf=f.read(8192)
        while buf:
            lo.write(buf)
            buf=f.read(8192)
        lo.close()

but I got the folowing error:

lo.write(buf)
TypeError: write(buffer), with buffer (sized string)

The proble arises only if the source file are raw data for ASCII texts
is the script working well.

The part of the c underlying c code:
	  /* gets arguments */
        if (!PyArg_ParseTuple (args, "s", &buffer))
        {
                PyErr_SetString(PyExc_TypeError,
                                "write(buffer), with buffer (sized
string).");
                return NULL;
        }

If I understat it corectly thr problem is in the PyArg_ParseTuple
function. 

Richard Bouska
Richard at Bouska.cz




