Csound Csound-dev Csound-tekno Search About

[Csnd] Python MacOS Floss Example

Date2013-07-18 06:23
FromJim Aikin
Subject[Csnd] Python MacOS Floss Example
For obscure reasons, I thought I'd take a look at the Floss Manual's Python
page. It all seems straightforward enough, so I copied example 12B05 into
CsoundQt 0.7.2, running Csound 5.19.02. I get the following error output:

INIT ERROR in instr 2: pyruni: python exception
	pyruni	"
from math import log
cent = log(x,2)*1200
print cent
"	
	  B  0.000 - note deleted.  i2 had 1 init errors

I have Python 2.7 installed (oh, and the computer is running OS 10.8.4). So
I launched IDLE and tried "from math import log" and the formula. It worked
as expected. My tentative conclusion is that there's nothing wrong with
Python, but that CsoundQt is somehow failing to invoke Python correctly. Yet
pyinit seems not to have produced an error, so the problem would not seem to
be that Csound is failing to see Python at all -- the problem lies
elsewhere.

I'm sure I'm doing something wrong that should be obvious, but isn't.
Suggestions would be welcome!



--
View this message in context: http://csound.1045644.n5.nabble.com/Python-MacOS-Floss-Example-tp5725751.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-07-20 03:25
FromAndres Cabrera
SubjectRe: [Csnd] Python MacOS Floss Example
Hi Jim,

I think the problem might be that you are using quotes (") instead of {{ for the multiline string:

pyruni {{
from math import log
cent = log(x,2)*1200
print cent
}}

But I would've expected a different error, though....

Cheers,
Andrés


On Wed, Jul 17, 2013 at 10:23 PM, Jim Aikin <midiguru23@sbcglobal.net> wrote:
>
> For obscure reasons, I thought I'd take a look at the Floss Manual's Python
> page. It all seems straightforward enough, so I copied example 12B05 into
> CsoundQt 0.7.2, running Csound 5.19.02. I get the following error output:
>
> INIT ERROR in instr 2: pyruni: python exception
>         pyruni  "
> from math import log
> cent = log(x,2)*1200
> print cent
> "
>           B  0.000 - note deleted.  i2 had 1 init errors
>
> I have Python 2.7 installed (oh, and the computer is running OS 10.8.4). So
> I launched IDLE and tried "from math import log" and the formula. It worked
> as expected. My tentative conclusion is that there's nothing wrong with
> Python, but that CsoundQt is somehow failing to invoke Python correctly. Yet
> pyinit seems not to have produced an error, so the problem would not seem to
> be that Csound is failing to see Python at all -- the problem lies
> elsewhere.
>
> I'm sure I'm doing something wrong that should be obvious, but isn't.
> Suggestions would be welcome!
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Python-MacOS-Floss-Example-tp5725751.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>

Date2013-07-20 03:34
FromAndres Cabrera
SubjectRe: [Csnd] Python MacOS Floss Example
But maybe you have typed it right and that is just Csound's way of printing the error message...

If so, I'm not sure...

does a line like:

pyruni "print 1"

Not produce an error?

Maybe on windows you need to initialize the python interpreter with:
pyinit
before any python opcode?

Cheers,
Andrés


On Fri, Jul 19, 2013 at 7:25 PM, Andres Cabrera <mantaraya36@gmail.com> wrote:
Hi Jim,

I think the problem might be that you are using quotes (") instead of {{ for the multiline string:


pyruni {{
from math import log
cent = log(x,2)*1200
print cent
}}

But I would've expected a different error, though....

Cheers,
Andrés



On Wed, Jul 17, 2013 at 10:23 PM, Jim Aikin <midiguru23@sbcglobal.net> wrote:
>
> For obscure reasons, I thought I'd take a look at the Floss Manual's Python
> page. It all seems straightforward enough, so I copied example 12B05 into
> CsoundQt 0.7.2, running Csound 5.19.02. I get the following error output:
>
> INIT ERROR in instr 2: pyruni: python exception
>         pyruni  "
> from math import log
> cent = log(x,2)*1200
> print cent
> "
>           B  0.000 - note deleted.  i2 had 1 init errors
>
> I have Python 2.7 installed (oh, and the computer is running OS 10.8.4). So
> I launched IDLE and tried "from math import log" and the formula. It worked
> as expected. My tentative conclusion is that there's nothing wrong with
> Python, but that CsoundQt is somehow failing to invoke Python correctly. Yet
> pyinit seems not to have produced an error, so the problem would not seem to
> be that Csound is failing to see Python at all -- the problem lies
> elsewhere.
>
> I'm sure I'm doing something wrong that should be obvious, but isn't.
> Suggestions would be welcome!
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Python-MacOS-Floss-Example-tp5725751.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
>             https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Date2013-07-20 18:12
FromJim Aikin
Subject[Csnd] Re: Python MacOS Floss Example
I copied the example straight off of the Floss Manual page. It uses {{, but
for some reason Csound prints the error message using quotes instead. The
example does use pyinit, so that's not the source of the problem.

In Windows, Csound doesn't produce an error message, but the Python print
statement doesn't print anything to the console.

These results don't change if I uncheck "use new parser."

I can understand the Python print statement not outputting to the CsoundQt
console, although one would hope that could be fixed in a future release.
But the error message and the fact that the two platforms don't produce
identical results suggest to me that there may be a deeper problem.

Until 6.0 is released with CsoundQt, I'm not in a position to test whether
the problem is still there in 6.0.



--
View this message in context: http://csound.1045644.n5.nabble.com/Python-MacOS-Floss-Example-tp5725751p5725809.html
Sent from the Csound - General mailing list archive at Nabble.com.