wasm-demo/demo/ermis-f/python_m/cur/1749

70 lines
2.1 KiB
Plaintext

From: xbouska at bsdi.infima.cz (Richard Bouska)
Date: Fri, 7 May 1999 06:15:21 GMT
Subject: string containing raw data - PyArg_ParseTuple() bug?
In-Reply-To: <3731C590.96D52B64@appliedbiometrics.com>
References: <3731C590.96D52B64@appliedbiometrics.com>
Message-ID: <Pine.BSI.4.05L.9905070809001.29480-100000@bsdi.infima.cz>
Content-Length: 1768
X-UID: 1749
Well the db is the postgresql ver 6.4-2 and the interface I am using is
PyGreSQL-2.3. I made the changes you suggested and I will send them to the
author.
Thank You very much for Your assistance.
I am not the autor of the PyGreSQL and did not expect "feature" like that.
Richard Bouska
Richard at Bouska.cz
On Thu, 6 May 1999, Christian Tismer wrote:
>
>
> Richard Bouska wrote:
> >
> > 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)
>
> Could you please provide us with more info about "db"?
> Did you write the interface yourself?
>
> > if (!PyArg_ParseTuple (args, "s", &buffer))
>
> This has the semantics that the string must be a properly
> zero terminated string. If you call this with a string
> object with zeroes, PyArg_ParseTuple correctly complains.
>
> If your intent is to work with raw strings which can
> contain anything, use
>
> > if (!PyArg_ParseTuple (args, "s#", &buffer, &buflen))
>
> ciao - chris
>
> --
> Christian Tismer :^) <mailto:tismer at appliedbiometrics.com>
> Applied Biometrics GmbH : Have a break! Take a ride on Python's
> Kaiserin-Augusta-Allee 101 : *Starship* http://starship.python.net
> 10553 Berlin : PGP key -> http://wwwkeys.pgp.net
> PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
> we're tired of banana software - shipped green, ripens at home
>