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

out of range error #379

Closed
THMonster opened this issue Mar 1, 2020 · 2 comments
Closed

out of range error #379

THMonster opened this issue Mar 1, 2020 · 2 comments
Labels
enhancement scripting Issues related to Scripts or the scripting API

Comments

@THMonster
Copy link

https://github.com/autokey/autokey/blob/master/lib/autokey/scripting.py#L497

image

The output can be empty in some situation, and it will raise an out of range error.

@luziferius
Copy link
Collaborator

luziferius commented Mar 3, 2020

It can. But this is executed only if you are interested in the output (i.e. argument getOutput == True). If the command does not output anything, this is at least an unusual situation, as it is expected to output something.
So either catch the error and raise a different one with a descriptive name like EmptyProcessOutputError or similar or simply return an empty string.

Changing line 497 to if output and output[-1] == "\n": should prevent the call from raising an exception. It’ll then return an empty string.

@luziferius luziferius added enhancement scripting Issues related to Scripts or the scripting API labels Mar 3, 2020
luziferius added a commit to luziferius/autokey that referenced this issue Mar 22, 2020
luziferius added a commit to luziferius/autokey that referenced this issue Mar 22, 2020
@luziferius
Copy link
Collaborator

Fixed. The fix will be part of the next bugfix release (0.95.11)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement scripting Issues related to Scripts or the scripting API
Projects
None yet
Development

No branches or pull requests

2 participants