Csound Csound-dev Csound-tekno Search About

[Csnd] python problem

Date2010-11-01 12:43
Fromfrancesco
Subject[Csnd] python problem
Hi all,
i have a problem using python opcodes in csound.
Only with random python module.
Example pycall1 with output:

INIT ERROR in instr 0: pyruni: python exception
	pyruni	"
import random
...
"	
Traceback (most recent call last):
  File "", line 2, in 
  File "/usr/lib/python2.6/random.py", line 45, in 
    from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as
_ceil
ImportError: No module named math

It is a python problem, then apologies, but do You have some advice?

I'm using Ubuntu10.04, csound5.12 build from src, Python2.6 by repository.

Many thanks,
francesco.

Date2010-11-01 13:00
FromVictor Lazzarini
Subject[Csnd] Re: python problem
You can check if it's a python problem by doing this

$python
...
 > import random


and see what happens.

Victor


On 1 Nov 2010, at 12:43, francesco wrote:

>
> Hi all,
> i have a problem using python opcodes in csound.
> Only with random python module.
> Example pycall1 with output:
>
> INIT ERROR in instr 0: pyruni: python exception
> 	pyruni	"
> import random
> ...
> "	
> Traceback (most recent call last):
>  File "", line 2, in 
>  File "/usr/lib/python2.6/random.py", line 45, in 
>    from math import log as _log, exp as _exp, pi as _pi, e as _e,  
> ceil as
> _ceil
> ImportError: No module named math
>
> It is a python problem, then apologies, but do You have some advice?
>
> I'm using Ubuntu10.04, csound5.12 build from src, Python2.6 by  
> repository.
>
> Many thanks,
> francesco.
>
>
> -- 
> View this message in context: http://csound.1045644.n5.nabble.com/python-problem-tp3244959p3244959.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"
>



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"

Date2010-11-01 13:09
Fromfrancesco
Subject[Csnd] Re: python problem

it's ok, the module random and also math are imported, either in terminal
and in editor.
Maybe could be a problem with permission?


(thanks),
fra.

Date2010-11-01 17:18
Fromfrancesco
Subject[Csnd] Re: python problem
What i mean it is that i can import random and math in python, but not when
python went
call from csound. I have reinstalled python and all the packages, and all
from repository.
Same problem of above. I have also tried drone.py example and here the
output:

Traceback (most recent call last):
  File "drone.py", line 656, in 
    tk = Tix.Tk()
  File "/usr/lib/python2.6/lib-tk/Tix.py", line 210, in __init__
    self.tk.eval('package require Tix')
TclError: can't find package Tix

but if i run python alone i am able to import the package Tix.
Also i can import either csnd and CsoundAC.
Somethings wrong with my setup about python?

Thanks,
francesco.

Date2010-11-01 17:29
FromMichael Gogins
Subject[Csnd] Re: Re: python problem
I think that, in your Python code that you run in your csound Python
opcodes, you need to do something like this first:

import sys
sys.path.append(r'path/to/X')
sys.path.append(r'path/to/Y')

where you substitute the complete path to the relevant Python
packages, e.g. Tix, for 'path/to/X' or whatever.

Also, if you have more than 1 version of Python installed on your
computer, that could be causing this problem; make sure that the
python.exe and python26.dll or .so that you need come FIRST in your
path.

Hope this helps,
Mike

On Mon, Nov 1, 2010 at 1:18 PM, francesco  wrote:
>
> What i mean it is that i can import random and math in python, but not when
> python went
> call from csound. I have reinstalled python and all the packages, and all
> from repository.
> Same problem of above. I have also tried drone.py example and here the
> output:
>
> Traceback (most recent call last):
>  File "drone.py", line 656, in 
>    tk = Tix.Tk()
>  File "/usr/lib/python2.6/lib-tk/Tix.py", line 210, in __init__
>    self.tk.eval('package require Tix')
> TclError: can't find package Tix
>
> but if i run python alone i am able to import the package Tix.
> Also i can import either csnd and CsoundAC.
> Somethings wrong with my setup about python?
>
> Thanks,
> francesco.
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/python-problem-tp3244959p3245376.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"
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot 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"


Date2010-11-01 18:38
Fromfrancesco
Subject[Csnd] Re: Re: python problem
Thank You Mr. Gogins,
but this modules are part of the python system, i.e. the example pycall1.csd
call python and then
import random that import math. Both are from installation base. In fact i
am able to run random.py,
the same file (really the same) that the csd try to import, without problem.
Not when i run the csd.
About different python versions You are right, but in Ubuntu i have python
2.5, 2.6 and 3.1 installed
by default and seems that this is ok in linux.

In case of drone.py (Your really good example) seems that the problem arise
at the end of file,

try:
	tk = Tix.Tk()

because i am able to import all modules but then i get this error

  File "drone.py", line 656, in 
    tk = Tix.Tk()
  File "/usr/lib/python2.6/lib-tk/Tix.py", line 210, in __init__
    self.tk.eval('package require Tix')
TclError: can't find package Tix

Again, if i run the file Tix.py, the same of above, all is ok.
These are my problems ...

thanks,
francesco.

Date2010-11-01 19:01
Fromfrancesco
Subject[Csnd] Re: Re: python problem
... ok, i have take the body of pyruni (of csd) and i have try this alone
like a python script, and it is ok.
Only running from into a csd i have problem.

Somethings wrong with csound python ubuntu ?
No other have this problems?

thank, ciao,
francesco.

Date2010-11-01 19:27
FromMichael Gogins
Subject[Csnd] Re: Re: Re: python problem
I still think there is probably something wrong with your Python path
or the path to the Python shared library, which results in
inconsistent version of Python trying to run.

However, I will try to run some Python opcodes tests on Ubuntu to see
if you are right, that there is a problem with the Python opcodes now.

Regards,
Mike

On Mon, Nov 1, 2010 at 3:01 PM, francesco  wrote:
>
> ... ok, i have take the body of pyruni (of csd) and i have try this alone
> like a python script, and it is ok.
> Only running from into a csd i have problem.
>
> Somethings wrong with csound python ubuntu ?
> No other have this problems?
>
> thank, ciao,
> francesco.
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/python-problem-tp3244959p3245545.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"
>
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot 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"


Date2010-11-01 19:34
Fromfrancesco
Subject[Csnd] Re: python problem
Dear Mr Gogins, thanks.
Like always You were right, problably i had compiled csound with a different
python version that were
installed on my pc! After a new compilation the python opcodes examples
works ok.
With drone.py i have the same error (maybe somethings different with
python2.6 tkinter or tcltk 8.5), but i will try again.

Sorry for the noise.
Thank everyone and ciao,
An happy francesco