Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 07-03-2021, 10:05 PM   #161
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

I am Testing reapy really nice to execute code from a python file to do things in reaper!! Thanks for building it.

Quesiton if I want to import a third party module to reaper like numpy to be used in a Reascript inside reaper. Should I use beyound reaper or can I use reapy?
daniellumertz is offline   Reply With Quote
Old 07-19-2021, 06:50 AM   #162
rejarder
Human being with feelings
 
Join Date: Jul 2021
Posts: 4
Default

daniellumertz - quoting romeo_despres below to answer your question. It sounds like you may need to run outside reaper to use numpy.

"Regarding your question about inside VS outside reaper, the rule of thumb is: if you need a GUI event loop or if you need any third party library, run outside reaper; otherwise do as you like".
rejarder is offline   Reply With Quote
Old 07-19-2021, 09:24 AM   #163
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

thanks rejader, is about what I am doing hehe Also welcome to the forum!
daniellumertz is offline   Reply With Quote
Old 07-22-2021, 02:44 PM   #164
rejarder
Human being with feelings
 
Join Date: Jul 2021
Posts: 4
Default

Quote:
Originally Posted by romeo_despres View Post
Hi nir.arad,

Sorry for the delay, I've been quite busy recently. I understand your issue, and it would definitely make sense to have a function to retry connecting to REAPER after importing reapy. I guess it would be slightly more complicated than just wrapping the code inside a function, but I'll try to work on it as soon as possible.

Thanks for your feedback!
This is a great tool and I appreciate all of the work that was put into this.

I have also noticed that reaper must be open when starting the script. This topic was touched on a few years ago (quote attached), but I haven't seen anything on it lately. Is there any way to retry connecting to reaper after importing reapy?

I have found a couple workarounds that get me close (a lazy import once reaper is open or detaching/re-running the same script via subprocess a second time after reaper is open), but both lead to other issues that I cannot figure out how to resolve.
rejarder is offline   Reply With Quote
Old 07-22-2021, 03:49 PM   #165
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

IDK what is the usecase you are dealing but maybe checking if reaper is open and if not saying to user open it first and don't try to import (?)
daniellumertz is offline   Reply With Quote
Old 07-23-2021, 09:01 AM   #166
rejarder
Human being with feelings
 
Join Date: Jul 2021
Posts: 4
Default

Thanks for the suggestion! Unfortunately this solution will not work with my project. In a nutshell, it is a UI that interacts with Reaper, OBS, and guitar modeling software to streamline my recording/editing workflow.

When changing songs, the script moves a saved project directory into a "working copy" directory, which can't be done while the reaper instance is still open. Therefore I have to close Reaper, move the project, re-open Reaper, and somehow figure out how to re-import reapy.
rejarder is offline   Reply With Quote
Old 07-23-2021, 10:07 AM   #167
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

hm maybe a main python script starting and stoping a small one that import reapy?

IDK if this is going to work at all....
daniellumertz is offline   Reply With Quote
Old 07-24-2021, 06:00 AM   #168
rejarder
Human being with feelings
 
Join Date: Jul 2021
Posts: 4
Default

Thanks again, that is essentially my current workaround. It is slightly inconvenient, since I can't really run a debugger on those "sub-scripts" if the main procedure calls/runs them via cmd (but it does work). Hope you have a nice weekend.
rejarder is offline   Reply With Quote
Old 08-08-2021, 04:33 AM   #169
lukj
Human being with feelings
 
Join Date: Aug 2021
Posts: 1
Default installation not working in windows

Hello everyone,

I've been trying to install reapy on windows and I don't get it running.
Probably, the problem lies in having python and reapy installed with anaconda. At least I've found people (e.g. on page 2 of this thread) having problems there. I've tried to follow theses solutions, but still don't get it running.

I have a python environment "python" and reapy is installed:
Code:
(reaper) C:\Users\Lukas>pip install python-reapy
Requirement already satisfied: python-reapy in c:\users\lukas\anaconda3\envs\reaper\lib\site-packages (0.10.0)
Requirement already satisfied: psutil in c:\users\lukas\anaconda3\envs\reaper\lib\site-packages (from python-reapy) (5.8.0)
Requirement already satisfied: typing-extensions in c:\users\lukas\anaconda3\envs\reaper\lib\site-packages (from python-reapy) (3.10.0.0)
Now, after following the documention, I open REAPER and I run following.

Code:
(reaper) C:\Users\Lukas>python -c "import reapy; reapy.configure_reaper()"
Traceback (most recent call last):
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\web_interface.py", line 25, in get_reapy_server_port
    port = self.ext_state["server_port"]
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\web_interface.py", line 48, in __getitem__
    raise UndefinedExtStateError(key)
reapy.errors.UndefinedExtStateError: ('Undefined extended state for key server_port.', 'server_port')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\__init__.py", line 25, in <module>
    from .tools import (
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\__init__.py", line 4, in <module>
    from ._inside_reaper import inside_reaper, dist_api_is_enabled
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\_inside_reaper.py", line 8, in <module>
    from .network import machines
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\machines.py", line 139, in <module>
    connect("localhost")
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\machines.py", line 92, in __init__
    register_machine(host)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\machines.py", line 135, in register_machine
    CLIENTS[host] = client.Client(interface.get_reapy_server_port(), host)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\web_interface.py", line 29, in get_reapy_server_port
    self.activate_reapy_server()
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\web_interface.py", line 19, in activate_reapy_server
    self.perform_action(action_name)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\site-packages\reapy\tools\network\web_interface.py", line 35, in perform_action
    request.urlopen(url)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\urllib\request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\urllib\request.py", line 526, in open
    response = self._open(req, data)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\urllib\request.py", line 544, in _open
    '_open', req)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\urllib\request.py", line 504, in _call_chain
    result = func(*args)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\urllib\request.py", line 1377, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\urllib\request.py", line 1352, in do_open
    r = h.getresponse()
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\http\client.py", line 1379, in getresponse
    response.begin()
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\http\client.py", line 311, in begin
    version, status, reason = self._read_status()
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\http\client.py", line 272, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\Lukas\anaconda3\envs\reaper\lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
As you can see, this gives an error and at the same time REAPER crashes.

In REAPER preferences/ReaScript, I have:
Python: python36.dll is installed.
Custom path to Python dll directory: C:\Users\Lukas\anaconda3\envs\reaper
Force ReaScript to use specific Python dll: python36.dll

which should be set correct.

Following the problem on page 2 e.g., I have
Code:
>>> import sys
>>> sys.path
['', 'C:\\Users\\Lukas\\anaconda3\\envs\\reaper\\python36.zip', 'C:\\Users\\Lukas\\anaconda3\\envs\\reaper\\DLLs', 'C:\\Users\\Lukas\\anaconda3\\envs\\reaper\\lib', 'C:\\Users\\Lukas\\anaconda3\\envs\\reaper', 'C:\\Users\\Lukas\\anaconda3\\envs\\reaper\\lib\\site-packages']
and the path should be set correct.

I appreciate any help !

EDIT:

I found the thread "Getting started with Python and Reaper" where a vanilla installation (without anaconda) was proposed (by Justin himselft).
Afterwards, I had problems with reapy, untill I realized that I should not use the anaconda command prompt for the installation of reapy since python was now in a different place (obviously ...). I used the windows command prompt, executed "python -c "import reapy; reapy.configure_reaper()" and after some restarts of REAPER, the simple
Code:
import reapy
reapy.print('hello world')
does work.

Last edited by lukj; 08-09-2021 at 05:25 AM. Reason: found solution
lukj is offline   Reply With Quote
Old 09-15-2021, 01:41 PM   #170
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 63
Default

Quote:
Originally Posted by rejarder View Post
This is a great tool and I appreciate all of the work that was put into this.

I have also noticed that reaper must be open when starting the script. This topic was touched on a few years ago (quote attached), but I haven't seen anything on it lately. Is there any way to retry connecting to reaper after importing reapy?

I have found a couple workarounds that get me close (a lazy import once reaper is open or detaching/re-running the same script via subprocess a second time after reaper is open), but both lead to other issues that I cannot figure out how to resolve.
Hi rejarder, you can use reapy.reconnect() for this use case
romeo_despres is offline   Reply With Quote
Old 12-04-2021, 04:55 PM   #171
daniellumertz
Human being with feelings
 
daniellumertz's Avatar
 
Join Date: Dec 2017
Location: Brazil
Posts: 2,011
Default

hey romeo! I was testing defer with reapy. reapy.defer dont seems to be working...

I tested the exemple in the docs
Code:
import reapy

def stupid_loop(i):
    reapy.print(i)
    # hey REAPER could you do that again please?...
    reapy.defer(stupid_loop, i + 1)

stupid_loop(0)  # Start the loop

the result is
Code:
Exception has occurred: AssertionError
reapy.defer can only be called inside REAPER.
Also thanks for building all this, each time I use is a mindblowing have this available !!!
daniellumertz is offline   Reply With Quote
Old 03-28-2023, 02:29 AM   #172
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default reapy-boost

reapy doesnt seems to be maintained by its creator anymore :/ no commit in 2 years unfortunately.



Meanwhile, I just discovered a maintained fork/extension called reapy-boost on github




Consider this if you are using reapy, and let us know how it goes
X-Raym is offline   Reply With Quote
Old 04-06-2023, 05:48 AM   #173
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

Promoted on ReaLinks.net:






🐍
X-Raym is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.