Csound Csound-dev Csound-tekno Search About

funny behaviour gtk+python

Date2007-10-04 13:12
FromVictor Lazzarini
Subjectfunny behaviour gtk+python
(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

Date2007-10-04 13:15
From"Marco Pesenti Gritti"
SubjectRe: funny behaviour gtk+python
AttachmentsNone  

Date2007-10-04 14:23
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

Date2007-10-04 14:30
FromVictor Lazzarini
Subject[Cs-dev] reason? (was Re: funny behaviour gtk+python)
would this be the reason?

https://bugs.launchpad.net/pygtk/+bug/27112

import gtk Changing the default encoding? Funny
I am not getting it on my other fedora systems (perhaps
because they are one version behind?).

Victor

At 14:23 04/10/2007, Victor Lazzarini wrote:
>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
National University of Ireland, Maynooth


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-10-04 22:04
From"Mike Coleman"
SubjectRe: [Cs-dev] reason? (was Re: funny behaviour gtk+python)
AttachmentsNone