Skip to content

Commit

Permalink
subprocess.call() —> call() to avoid NameError
Browse files Browse the repository at this point in the history
```
>>> from subprocess import call
>>> call('ls')  # this works
>>> subprocess.call('ls')  # but this raises a NameError because subprocess was not installed
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'subprocess' is not defined
```
  • Loading branch information
cclauss committed Dec 11, 2017
1 parent 2e038c8 commit c650601
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmus-osx/media-keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ def sendEvent_(self, event):
if key_repeat and key_state is not NSKeyUp:
if key_code == 20:
self.repeated = True
subprocess.call(['cmus-remote', '-k', '-10'])
call(['cmus-remote', '-k', '-10'])
elif key_code == 19:
self.repeated = True
subprocess.call(['cmus-remote', '-k', '+10'])
call(['cmus-remote', '-k', '+10'])

if key_state is NSKeyUp:
if self.repeated:
self.repeated = False
elif key_code == 20 or key_code == 18:
elif key_code in (20, 18):
call(['cmus-remote', '-r'])
elif key_code == 16:
call(['cmus-remote', '-u'])
elif key_code == 19 or key_code == 17:
elif key_code in (19, 17):
call(['cmus-remote', '-n'])


Expand Down Expand Up @@ -81,4 +81,4 @@ def get_cmus_instances():
single_instance_checker.start()
AppHelper.runEventLoop()
else:
exit(1)
exit(1)

0 comments on commit c650601

Please sign in to comment.