Re: Decimal separator from python to C

"M." <[email protected]> Tue, 27 Mar 2012 21:04:29 -0300
Newsgroups gmane.comp.python.ctypes
Message-ID <CACd0G9yZodhzM_+P+HNa6nkxz0q=_V46xE9kC0r0S9dFOc30NQ@mail.gmail.com>
Hey,

2012/3/27 niki <[email protected]>:
> On 26.03.2012 23:32, M. wrote:
>>
>> Hi all,
>>
>> I'm using ctypes as a wrapper from a Pyside program to a C program.
>> Everything goes smoothly till I have to pass values to the C function.
>> The C function receive the values correctly when using
>> ctypes.c_double(), but the separator _inside_ the C code changed from
>> . to , and that is REALLY weird. Printing the data from python it
>> shows that is a float, and inside the C code everything is declared
>> accordingly. printf inside the C code shows a comma , as the
>> separator, while a C code compiled using the same compiler on the same
>> system shows period . as the separator. Any clues? My locale is
>> pt_BR-UTF-8.
>
>
> Python sets locale as requested by user/os e.g. "pt_BR-UTF-8".
> Try to set it back to "C".

I'll try, but a C program with the same locale defined on the system
gives the correct output. And a standard python program represents
floating point variables using a period. How come ctypes would pass
the variables to the C code using a comma?

Thanks!

>
> HTH
> Niki

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure