Csound Csound-dev Csound-tekno Search About

Re: funny behaviour gtk+python

Date2007-10-04 14:36
FromVictor Lazzarini
SubjectRe: funny behaviour gtk+python
Just to add a  little to say that this particular csound error is
issued when there is an incorrect numeric format, say
11.B or 11.1A. In here, if I only use integers, there is
no error, but all decimals are raising the error. Here's the
Csound code fragment that issues the error:


static int constndx(CSOUND *csound, const char *s)
{
     MYFLT   newval;
     int     h, n, prv;

     {
       volatile MYFLT  tmpVal;   /* make sure it really gets rounded to 
MYFLT */
       char            *tmp = (char*) s;
       tmpVal = (MYFLT) strtod(s, &tmp);
       newval = tmpVal;
       if (tmp == s || *tmp != (char) 0) {
         synterr(csound, Str("numeric syntax '%s'"), s);
         return 0;
       }
     }

(...)

}

Somehow the 'strtod'  conversion is getting it wrong.

But why only after 'import gtk', I cannot understand.

Victor

At 13:12 04/10/2007, 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?
>
>thanks
>
>Victor

Victor Lazzarini
Music Technology Laboratory
Music Department