| Hi Chuck,
You could generate the c code through python....
see
http://docs.cython.org/
there's also a package called Pytrex. see
http://docs.cython.org/docs/pyrex_differences.html#pyrex-differences
D.
On 10/04/2009, at 8:26 PM, Chuckk Hubbard wrote:
> Thanks for the suggestions, Victor and David.
> For now it looks like the first step will be creating C code that will
> compile at all. I'll get there though.
>
> -Chuckk
>
> On Fri, Apr 10, 2009 at 1:20 AM, DavidW wrote:
>> or use (now a standard library module) ctypes:
>> assistance?:
>> http://www.python.org/doc/2.5.2/lib/ctypes-ctypes-tutorial.html
>> http://eli.thegreenplace.net/2008/08/31/ctypes-calling-cc-code-from-python/
>>
>> D.
>>
>> On 10/04/2009, at 3:00 AM, victor wrote:
>>
>>> If you doing that, I'd suggest writing functions in C and then using
>>> SWIG to wrap them.
>>>
>>> Victor
>>> ----- Original Message ----- From: "Chuckk Hubbard"
>>>
>>> To: "Csound List"
>>> Sent: Thursday, April 09, 2009 5:14 PM
>>> Subject: [Csnd] Re: OSX csnd.CppSound.compile() error
>>>
>>>
>>> Hi again.
>>> There are two parts of my program that require parsing Csound
>>> output,
>>> which I've been doing with separate Python scripts, but now I see
>>> the
>>> Python message callback wrapper has some OSX issues; and it occurred
>>> to me that maybe I could code them in C (both have extremely simple
>>> Csound code which just needs to be run, not manipulated too
>>> much). I
>>> see now there are multiple ways to do this: I can run functions
>>> from a
>>> .dll straight from Python, or compile standalone C/C++ programs to
>>> be
>>> called as subprocesses, and I think a couple other ways I haven't
>>> worked out yet. If the message readout can be parsed by a C program
>>> and the result given as its output, I can read that from Python.
>>> Any suggestions as to the best way? The python versions of these
>>> two
>>> scripts are really simple, around 75 lines.
>>>
>>> -Chuckk
>>>
>>> On Sat, Apr 4, 2009 at 10:51 PM, Chuckk Hubbard
>>> wrote:
>>>>
>>>> I get this:
>>>> Fatal Python error: PyThreadState_Get: no current thread
>>>> Csound tidy up: Abort trap
>>>>
>>>> on OSX if I follow CppSound.setPythonMessageCallback() with
>>>> CppSound.compile(). Python exits. I do not get this error if I
>>>> don't
>>>> setPythonMessageCallback(), but this is the script with which I
>>>> test
>>>> which DACs are available for a given module, and I need to parse
>>>> the
>>>> Csound error message to find the list. I also don't get this
>>>> error if
>>>> I run the Compile() method, but, of course, I get another error,
>>>> as it
>>>> is a different method. On Windows and Linux, I don't have to
>>>> actually
>>>> use a performance thread nor perform the csd, I get the error
>>>> message
>>>> (the good one, I mean, with the list of DACs) right after
>>>> CppSound.compile().
>>>>
>>>> The attached script should exit with pleasant, small-town realtime
>>>> errors on Windows and Linux, and with a downright uncivilized Abort
>>>> trap error on OSX.
>>>>
>>>> I've seen two references to this exact error (the bad one, the
>>>> "Abort
>>>> trap" one) in the mailing list archive, but it looks unresolved,
>>>> no?
>>>> Could I possibly get the desired results using the Compile()
>>>> method,
>>>> calling it some other way? I haven't had much luck with it.
>>>>
>>>> Thanks yet again,
>>>> Chuckk
>>>>
>>>> --
>>>> http://www.badmuthahubbard.com
>>>>
>>>
>>>
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> "unsubscribe
>>> csound"=
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>>> "unsubscribe
>>> csound"
>>>
>>
>> ________________________________________________
>> David Worrall.
>> - Experimental Polymedia: www.avatar.com.au
>> - Education for Financial Independence: www.mindthemarkets.com.au
>> Australian research affiliations:
>> - Capital Markets Cooperative Research Centre: www.cmcrc.com
>> - Sonic Communications Research Group: creative.canberra.edu.au/scrg
>> - MARCS Auditory Laboratories: marcs.uws.edu.au
>>
>>
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> "unsubscribe
>> csound"
>>
>
>
>
> --
> http://www.badmuthahubbard.com
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
________________________________________________
David Worrall.
- Experimental Polymedia: www.avatar.com.au
- Education for Financial Independence: www.mindthemarkets.com.au
Australian research affiliations:
- Capital Markets Cooperative Research Centre: www.cmcrc.com
- Sonic Communications Research Group: creative.canberra.edu.au/scrg
- MARCS Auditory Laboratories: marcs.uws.edu.au
|