Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using functions from class "Region" #101

Closed
oggethealmighty opened this issue Nov 9, 2020 · 5 comments
Closed

Error when using functions from class "Region" #101

oggethealmighty opened this issue Nov 9, 2020 · 5 comments

Comments

@oggethealmighty
Copy link

oggethealmighty commented Nov 9, 2020

Hi! I have a very small and simple code that should extract the region start time of the indexed region. It looks like this:

import reapy
import reapy.reascript_api as rpr

project = reapy.Project()
Project = reapy.core.Project(None, -1)
Region = reapy.core.Region(project)

test_region = Project.regions[0]
print(test_region.start)

However, when I run this code I get this error:

Exception has occurred: DistError

An error occurred while running a function inside REAPER. Traceback was :

Traceback (most recent call last):
File "C:\Users\oskar.hansson\AppData\Local\Programs\Python\Python38\lib\site-packages\reapy\tools\network\server.py", line 67, in _process_request
result["value"] = request["function"](*args, **kwargs)
File "C:\Users\oskar.hansson\AppData\Local\Programs\Python\Python38\lib\site-packages\reapy\core\project\region.py", line 167, in start
args = self.project_id, self._get_enum_index(), 0, 0, 0, 0, 0
File "C:\Users\oskar.hansson\AppData\Local\Programs\Python\Python38\lib\site-packages\reapy\core\project\region.py", line 28, in _get_enum_index
return next(
File "C:\Users\oskar.hansson\AppData\Local\Programs\Python\Python38\lib\site-packages\reapy\core\project\region.py", line 30, in
if r.index == region.index
NameError: name 'region' is not defined
File "C:\Users\oskar.hansson\AppData\Roaming\REAPER\Scripts\CustomScripts\RegionExpander.py", line 12, in
print(test_region.start)

I tried changing region.index in the reapy\core\project\region.py file to self.index and I even tried going around the whole _get_enum_index() function but I always get the same error. Is there something I'm doing wrong or is there something weird going on with the API?

Note: Other functions like delete and add_rendered_tracks works just fine. It seems there's something off with the _get_enum_index function.

@RomeoDespres
Copy link
Owner

Hi, looks like a typo in the reapy code... Sorry about that and thank you for spotting it. I'll fix it soon and let you know when an update has been pushed.

@Levitanus
Copy link
Contributor

I've made huge fix of markers and regions. It should be in the #92
Please, take a look on my PRs
Only #85 is not ready to push

@Levitanus
Copy link
Contributor

I really, really want to finish my job on the #85, but absolutely have no time. It's my dream to have a spare month for the reapy...

@RomeoDespres
Copy link
Owner

Thanks @Levitanus, I'll check this out then!

@RomeoDespres
Copy link
Owner

Hi, this bug should be fixed in version 0.9.0. Please upgrade reapy and let me know if anything goes wrong.Thanks again @teetow and @Levitanus for your help in solving this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants