Old 04-09-2019, 04:02 AM   #41
Centauria
Human being with feelings
 
Join Date: Apr 2019
Posts: 3
Default

Hey bro, when I ran python -m reapy, it can't find python.dll

================================================== =
(py36) C:\Users\Administrator>python -m reapy
D:\PF\Anaconda3\envs\py36\lib\site-packages\reapy\tools\dist_program.py:14: Disa
bledDistAPIWarning: Can't reach distant API. Please start REAPER, or call reapy.
config.enable_dist_api() from inside REAPER to enable distant API.
warnings.warn(DisabledDistAPIWarning())

======================
reapy config infos
======================

Python DLL
----------
Can't find python DLL...

Enable or disable reapy dist API
--------------------------------
Enable dist API
D:\PF\Anaconda3\envs\py36\lib\site-packages\reapy\reascripts\enable_dist_api
.py

Disable dist API
D:\PF\Anaconda3\envs\py36\lib\site-packages\reapy\reascripts\disable_dist_ap
i.py
==================================================





and I ran into an issue when I was trying to run enable_dist_api.py in REAPER


================================================== =
Script execution error

Traceback (most recent call last):
File "enable_dist_api.py", line 12, in <module>
import reapy
ModuleNotFoundError: No module named 'reapy'
================================================== =

why can't find the module reapy?
I am sure about the version of python is the one REAPER uses.
Help...
Centauria is offline   Reply With Quote
Old 04-09-2019, 04:40 AM   #42
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

@nir.arad

To be honest I am puzzled by your bug... I'll let you know if I find out where that comes from.

@Centauria

It seems you have installed reapy through Anaconda? I am not an Anaconda expert but from your traceback I am guessing REAPER might have trouble finding the path to your conda environment... Could you try running the following inside REAPER and show us the result?

Code:
import sys
RPR_ShowConsoleMsg(sys.path)
romeo_despres is offline   Reply With Quote
Old 04-09-2019, 05:09 AM   #43
Centauria
Human being with feelings
 
Join Date: Apr 2019
Posts: 3
Default

The output is


['C:/Users/Administrator/AppData/Roaming/REAPER/Scripts', 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\Lib', 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\DLLs', 'D:\\PF\\REAPER (x64)', 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64', 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\lib\\site-packages', 'D://PF//REAPER (x64)//Plugins']

thx.
Centauria is offline   Reply With Quote
Old 04-09-2019, 05:23 AM   #44
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

Thanks. So you can see that the place where reapy is located (D:\PF\Anaconda3\envs\py36\lib\site-packages) is not in sys.path by default when you run Python outside Anaconda. That explains why REAPER can't find it.

You can extend sys.path permanently by creating a path configuration file.

In your case, go to C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages and create a .pth file (for instance, "anaconda_env.pth") containing the following:

Code:
D:\PF\Anaconda3\envs\py36\lib\site-packages
If I'm not missing anything about Anaconda, you should now be able to import reapy from inside REAPER and thus to enable the distant API.

Last edited by romeo_despres; 04-09-2019 at 05:29 AM.
romeo_despres is offline   Reply With Quote
Old 04-09-2019, 09:27 AM   #45
Centauria
Human being with feelings
 
Join Date: Apr 2019
Posts: 3
Default

It worked!
Thank you
Centauria is offline   Reply With Quote
Old 04-21-2019, 12:29 PM   #46
chabErch
Human being with feelings
 
Join Date: Feb 2017
Posts: 1
Default

Hi @romeo_despres, great work!

Is it possible to run sws scripts with reapy?
chabErch is offline   Reply With Quote
Old 04-21-2019, 03:15 PM   #47
fladd
Human being with feelings
 
fladd's Avatar
 
Join Date: May 2006
Posts: 937
Default

This is great! I already thought I'm the only one who cares about pep8 :-)
__________________
www.fladd.de/sound
fladd is offline   Reply With Quote
Old 05-13-2019, 08:59 AM   #48
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

Quick update: thanks to chabErch's contribution, SWS functions can now be run from outside REAPER with reapy. More precisely, if the SWS extension is installed, then reapy.reascript_api contains all functions in sws_python; otherwise it only contains native ReaScript functions.
romeo_despres is offline   Reply With Quote
Old 05-13-2019, 10:31 AM   #49
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,865
Default

@romeo_despres
Cool !


Does it also contains JS_ReaScript and Reapack API functions ?
X-Raym is offline   Reply With Quote
Old 05-14-2019, 02:48 AM   #50
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

I have only recently discovered these and haven't been able to make them work yet (I posted a related question recently but didn't get any reply...) But it would definitely make sense to include them as well
romeo_despres is offline   Reply With Quote
Old 05-14-2019, 03:53 AM   #51
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,865
Default

Ok so it is not an automatic way to load all extensions API.
Thanks for the infos !
X-Raym is offline   Reply With Quote
Old 05-14-2019, 06:01 AM   #52
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,843
Default

Quote:
Originally Posted by romeo_despres View Post
I have only recently discovered these and haven't been able to make them work yet (I posted a related question recently but didn't get any reply...) But it would definitely make sense to include them as well
Maybe post in the related threads (here and here) for them to not miss it.
nofish is offline   Reply With Quote
Old 05-14-2019, 06:39 AM   #53
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

Quote:
Originally Posted by X-Raym
Ok so it is not an automatic way to load all extensions API.
Thanks for the infos !
That's what I was trying to do in the first place... Someday hopefully

@nofish

Thanks you're right I'll do that!
romeo_despres is offline   Reply With Quote
Old 05-14-2019, 08:01 AM   #54
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,843
Default

@romeo_despres

Not sure if it helps, but SWS uses a Pearl script to generate the Python function wrappers:
https://github.com/reaper-oss/sws/bl...ript_python.pl
nofish is offline   Reply With Quote
Old 05-14-2019, 11:08 AM   #55
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,302
Default

Somebody made one for JS-extension, even if it's a little outdated. Just browse through the JS-extension-thread. Maybe you can use it and update it.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 05-28-2019, 01:22 AM   #56
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,865
Default

Quote:
Great I'm glad it eventually worked! About your "command window" problem, I have found this which seems to answer your question (I wasn't aware of that technique and haven't tried it though).
I confirm that running a reapy script on windows by double cliking on it on WIndows is possible without having CMD window by having extension set to .pyw instead of .py.


--
Here is a minimal tkinter code snippet for reapy:


https://github.com/ReaTeam/ReaScript...er%20reapy.pyw

It is not extra quick to launch (count 1-2 seconds), I don't know if it is reapy limitation or just python. Script run from action list are quicker (but they still keyboard focus).
X-Raym is offline   Reply With Quote
Old 05-28-2019, 02:58 AM   #57
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

Quote:
Originally Posted by X-Raym View Post
It is not extra quick to launch (count 1-2 seconds), I don't know if it is reapy limitation or just python. Script run from action list are quicker (but they still keyboard focus).
On my computer, both are quite slow: starting Python itself, but also importing reapy from outside REAPER. It indeed requires several interactions with the REAPER Web Interface, which is pretty slow.
romeo_despres is offline   Reply With Quote
Old 05-28-2019, 04:07 AM   #58
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,865
Default

Quote:
On my computer, both are quite slow: starting Python itself, but also importing reapy from outside REAPER. It indeed requires several interactions with the REAPER Web Interface, which is pretty slow.

It is not that a problem if the scripts seems complex (like have a nice polish GUI with lots of elements), but it really feels not good if it is just a single user input.


But I don't think anything can be done on this so we'll live with it.
It still have a lot of advantage compare to native way (like allowing all kind of python dependencies and not stealing keyboard focus).
X-Raym is offline   Reply With Quote
Old 05-28-2019, 05:21 AM   #59
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

Indeed one probably has to wonder which option is best depending on the complexity of the program. For a simple user input, I guess it's better to use the ReaScript function "GetUserInputs" from inside REAPER. It makes me realize there is no reapy counterpart to this function, which is once again not very easy to use for a standard Python programmer... I'll try to add one soon!
romeo_despres is offline   Reply With Quote
Old 06-06-2019, 01:38 AM   #60
Kostik Vento
Human being with feelings
 
Join Date: Nov 2013
Location: Yekaterinburg, Russia
Posts: 11
Default

Quote:
Originally Posted by romeo_despres View Post
I think this project can become interesting only if other people in the community provide feedback and improvement, on the code itself as well as the documentation, structure, etc. So please don't hesitate to try it out and report bugs or missing features. And if you feel like coding yourself, feel free to fork the repository! As a Python ReaScripter, I know you dream like me of a well-established community-based REAPER API!
That's about me)) I like both Python and Reaper, I do dream, so I've forked ))
And I do have some suggestions about improvements, would you prefer to discuss them here or on GitHub?

Quote:
Originally Posted by romeo_despres View Post
P.P.S. reapy should be cross-platform but since I have only tested it on Windows I couldn't swear. Yet I do think this is an important feature. We all love REAPER for Linux.
I've tried on MacOSX Sierra, it works fine for me. There are, still, minor bugs, I've opened pull requests for them, hope to see them reviewed soon))
And there's a serious bug I've almost run into — if your reaper.ini contains non-ASCII chars, rewriting config would crash half-way with the rest of your settings gone( My luck was to have the file opened in a text editor which had the full copy of the lost contents.

P.S. I made it work under Python2 (except enable/disable_dist_api), but the resulting code lost its pythonicity a bit, so I'll keep refactoring. And alas, you can't use reapy.print in Python2 because print is reserved there and cannot be used as identifier.

Last edited by Kostik Vento; 06-06-2019 at 01:54 AM.
Kostik Vento is offline   Reply With Quote
Old 06-06-2019, 05:41 AM   #61
romeo_despres
Human being with feelings
 
Join Date: Jan 2019
Posts: 23
Default

Thank you a lot for your help! I think the simplest is to communicate on GitHub as you did. I've seen your requests but been very busy lately so I haven't been able to review them in detail... But they seem to fix a lot of important issues! I'll try to reply to you asap there
romeo_despres 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:08 PM.


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