Converting C strings to Python problem

Phil Rittenhouse phil.rittenhouse at dspfactory.com
Tue Feb 26 17:48:07 EST 2002


Hmmm.....

Looks like I missread the doc's.  Only UNKNOWN escape sequences are
represented
by two characters.

My bad.

Phil


"Phil Rittenhouse" <phil.rittenhouse at dspfactory.com> wrote in message
news:BwPe8.21867$X2.226876 at nnrp1.uunet.ca...
> Hi,
>
> I'm trying to pass a path string (eg. "c:\spam\test.exe") from C to
python,
> but python is interpreting the string as "c:\spam<tab>est.exe".
>
> I've run into this problem with converting C strings to Python strings
using
> Py_BuildValue().   When converting a C string with backslashes to a
> python string, the string (including backslashes) is copied exactly.
Sounds
> reasonable, except that, according to the doc's, Python
> uses two character escape sequences to represent things like tabs (\t).
>
> Should the conversion process convert backslashes in C to double
backslashes
> in Python?   What is the recommended method for doing the C string to
python
> string conversion?  Does PyString_FromString() behave differently?
>
> Thanks for your help,
> Phil
> ------------
> Phil Rittenhouse
> phil.rittenhouse at dspfactory.com
> Software Developer
> Dspfactory Inc.
>
>
>
>
>
>
>





More information about the Python-list mailing list