external_script: fix indexerror exception
@@ -57,6 +57,7 @@ class Py3status:
raise Exception(STRING_ERROR)
def external_script(self):
+ output_lines = None
response = {}
response['cached_until'] = self.py3.time_in(self.cache_timeout)
try:
@@ -71,12 +72,15 @@ class Py3status:
output = e.output or e.error
self.py3.error(output)
+ if output_lines:
output_text = output_lines[0]
-
if self.strip_output:
output_text = output_text.strip()
+ else:
+ output_text = ''
- response['full_text'] = self.py3.safe_format(self.format, {'output': output_text})
+ response['full_text'] = self.py3.safe_format(
+ self.format, {'output': output_text})
return response
