Csound Csound-dev Csound-tekno Search About

Re: funny behaviour gtk+python

Date2007-10-05 08:32
FromVictor Lazzarini
SubjectRe: funny behaviour gtk+python
yes, it's true, but at the moment, I can't
see a substitute for strtod(), and we can't
put a dependency on gtk or Python in the Csound
engine. I can't find an ascii_strtod(). Would
it work if we added a call to setlocale() just
before the call to strtod()?

Victor

>
> This really needs to be fixed properly in CSound. We can't
> have any csound user to have to work it around playing
> with LOCALE... Simon email explain pretty well what is the
> problem.
>
> Marco
>
> On 10/4/07, Jean Piché  wrote:
> >
> >
> >
> > Victor,
> >
> > This seriously look slike a bug we had about a month ago
> > in TamTam. I cannot recall the number but hopefully
> someone else can remeber. >
> > It has to do with the LOCALE env variable and the
> > int/float separating character. It was fixed in our
> pythin code but specifying: >
> >
> > locale.setlocale(locale.LC_NUMERIC, 'C')
> >
> >
> >
> >
> > _________________________________
> > http://jeanpiche.com
> >
> > On 4-Oct-07, at 9:49 AM, Victor Lazzarini wrote:
> >
> > Yes setting LANG=C at the console solves the problem.
> > Would you care to explain why?
> >
> > Victor
> >
> > At 13:15 04/10/2007, Marco Pesenti Gritti wrote:
> > On 10/4/07, Victor Lazzarini 
> > wrote: (OLPC build 602)
> > I have been trying a few things here and I stumbled
> > across a funny problem (this is quite specialised, so
> > I suppose only a few of you would know):
> >
> > 1. With Python, if I do
> >
> > import gtk
> > import csnd
> >
> > cs = csnd.Csound()
> > cs.Compile("myexample.csd")
> >
> > the csound compilation will fail with very unusual
> > syntax errors (which are not syntax errors at all)
> > (eg: "error: numeric syntax "11.1", line ...")
> >
> > 2. If I don't do
> >
> > import gtk
> >
> > Csound will happily compile my code.
> >
> > Now this seems so weird that I can't understand
> > why it is happening.
> >
> > Any clues why "import gtk" is causing this
> > behaviour?
> >
> > Does running it with LANG=C help?
> >
> > Marco
> >
> > Victor Lazzarini
> > Music Technology Laboratory
> > Music Department
> > National University of Ireland, Maynooth
> >
> > _______________________________________________
> > Devel mailing list
> > Devel@lists.laptop.org
> > http://lists.laptop.org/listinfo/devel

Date2007-10-05 08:43
FromMitch Bradley
SubjectRe: funny behaviour gtk+python
Victor Lazzarini wrote:
> yes, it's true, but at the moment, I can't
> see a substitute for strtod(), and we can't
> put a dependency on gtk or Python in the Csound
> engine. I can't find an ascii_strtod(). Would
> it work if we added a call to setlocale() just
> before the call to strtod()?
>   
Perhaps you could just crib the strtod() routine from diet libc.

http://www.fefe.de/dietlibc/

strtod() is in dietlibc-0.31/lib/strtod.c .  The only external routine 
that it calls is "isspace()", and if that is a problem, you could just 
replace it with something like (*p <= ' ').


> Victor
>
>   
>> This really needs to be fixed properly in CSound. We can't
>> have any csound user to have to work it around playing
>> with LOCALE... Simon email explain pretty well what is the
>> problem.
>>
>> Marco
>>
>> On 10/4/07, Jean Piché  wrote:
>>     
>>>
>>> Victor,
>>>
>>> This seriously look slike a bug we had about a month ago
>>> in TamTam. I cannot recall the number but hopefully
>>>       
>> someone else can remeber. >
>>     
>>> It has to do with the LOCALE env variable and the
>>> int/float separating character. It was fixed in our
>>>       
>> pythin code but specifying: >
>>     
>>> locale.setlocale(locale.LC_NUMERIC, 'C')
>>>
>>>
>>>
>>>
>>> _________________________________
>>> http://jeanpiche.com
>>>
>>> On 4-Oct-07, at 9:49 AM, Victor Lazzarini wrote:
>>>
>>> Yes setting LANG=C at the console solves the problem.
>>> Would you care to explain why?
>>>
>>> Victor
>>>
>>> At 13:15 04/10/2007, Marco Pesenti Gritti wrote:
>>> On 10/4/07, Victor Lazzarini 
>>> wrote: (OLPC build 602)
>>> I have been trying a few things here and I stumbled
>>> across a funny problem (this is quite specialised, so
>>> I suppose only a few of you would know):
>>>
>>> 1. With Python, if I do
>>>
>>> import gtk
>>> import csnd
>>>
>>> cs = csnd.Csound()
>>> cs.Compile("myexample.csd")
>>>
>>> the csound compilation will fail with very unusual
>>> syntax errors (which are not syntax errors at all)
>>> (eg: "error: numeric syntax "11.1", line ...")
>>>
>>> 2. If I don't do
>>>
>>> import gtk
>>>
>>> Csound will happily compile my code.
>>>
>>> Now this seems so weird that I can't understand
>>> why it is happening.
>>>
>>> Any clues why "import gtk" is causing this
>>> behaviour?
>>>
>>> Does running it with LANG=C help?
>>>
>>> Marco
>>>
>>> Victor Lazzarini
>>> Music Technology Laboratory
>>> Music Department
>>> National University of Ireland, Maynooth
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel@lists.laptop.org
>>> http://lists.laptop.org/listinfo/devel
>>>
>>>       
> _______________________________________________
> Devel mailing list
> Devel@lists.laptop.org
> http://lists.laptop.org/listinfo/devel

Date2007-10-05 12:24
FromSimon McVittie
SubjectRe: funny behaviour gtk+python
AttachmentsNone