View Single Post
Old 02-25-2019, 04:15 PM   #18
ChuckkH
Human being with feelings
 
Join Date: Feb 2019
Posts: 41
Default

Thank you!!
I am trying to adapt my Python sequencer program to interface with Reaper on a fairly deep level, and it's discouraging to find they haven't actually implemented Python scripting after all. I'm considering switching to Lua.
Are you saying I could include your library in my standalone Python program and use Reaper API calls on a running Reaper instance, without opening the script in Reaper? That would be phenomenal! I was looking into using __startup.lua to start the first Python script, and then to continually overwrite it from my program, before restarting it through OSC as needed.

But I can't get any Python defer to work at all (in the default Python API, not reapy). This gives invalid syntax:

<python code>
from reaper_python import *
def empty_function():
x = 1
y = 2
z = x
x = y
y = z

def empty_defer_function():
x = 1
y = 2
z = x
x = y
y = z
RPR_defer(empty_defer_function)

empty_function()
empty_defer_function()
</python code>

(The function lines are indented, but it doesn't show up here.)

And the invalid syntax error specifically points at the deferral, meaning the same function without defer runs fine:

<error message>
Deferred script execution error

Traceback (most recent call last):
File "defer", line 1
<function empty_defer_function at 0x00000000395D72E8>
^
SyntaxError: invalid syntax
</error message>

Is this what meta is referring to? Because, yeah, it won't even run, crashes immediately. Python 2.7.15, Reaper 5.965, both 64-bit on Win 7 64-bit.

-Chuckk

Last edited by ChuckkH; 02-25-2019 at 05:34 PM.
ChuckkH is offline   Reply With Quote