Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cursedprocesses/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
__author__ = "Raido Pahtma"
__license__ = "MIT"

__version__ = "0.6.0.dev0"
__version__ = "0.7.0.dev0"
18 changes: 9 additions & 9 deletions cursedprocesses/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import curses
import shlex
import time
import Queue
import queue
from threading import Thread

from .stinner import read_stdin
Expand All @@ -31,7 +31,7 @@ def __init__(self, name, cmd):
self.text = ""
self.p = None
self.t = None
self.q = Queue.Queue()
self.q = queue.Queue()
self.error = False

def start(self):
Expand Down Expand Up @@ -61,7 +61,7 @@ def update(self):
if len(line) > 0:
self.text = line
return True
except Queue.Empty:
except queue.Empty:
return False

def status(self):
Expand All @@ -80,7 +80,7 @@ def reset(self):
self.text = ""
self.p = None
self.t = None
self.q = Queue.Queue()
self.q = queue.Queue()
self.error = False


Expand All @@ -100,7 +100,7 @@ def mainloop(processgroups, parallel, total, autostart):
for group in processgroups.values():
processcount += len(group)

inqueue = Queue.Queue()
inqueue = queue.Queue()
inthread = Thread(target=read_stdin, args=(sys.stdin, inqueue))
inthread.daemon = True
inthread.start()
Expand Down Expand Up @@ -240,7 +240,7 @@ def mainloop(processgroups, parallel, total, autostart):
elif key == "q":
interrupted = True
x = key
except Queue.Empty:
except queue.Empty:
pass

loop += 1
Expand All @@ -267,7 +267,7 @@ def mainloop(processgroups, parallel, total, autostart):
def read_commands(commandfile):
import csv
groups = {}
with open(commandfile, 'rb') as f:
with open(commandfile, 'r') as f:
reader = csv.DictReader(f, fieldnames=("group", "name", "cmd"), delimiter=',')
i = 0
try:
Expand All @@ -280,7 +280,7 @@ def read_commands(commandfile):

groups[group].append(Process(row["name"].lstrip().rstrip(), row["cmd"].lstrip().rstrip()))
except AttributeError:
raise AttributeError("Can't make sense of command row {:u}!".format(i))
raise AttributeError("Can't make sense of command row {:d}: '{}'!".format(i, row))

return groups

Expand All @@ -299,7 +299,7 @@ def main():
processes = read_commands(args.input)
mainloop(processes, args.parallel, args.total, not args.manual)
except AttributeError as e:
print("ERROR: {}".format(e.message))
print("ERROR: {}".format(e))


if __name__ == '__main__':
Expand Down
8 changes: 4 additions & 4 deletions cursedprocesses/stinner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""stinner.py: Read from stdin with curses and figure out what keys were pressed."""
import Queue
import queue
import curses
import string
from threading import Thread
Expand Down Expand Up @@ -84,7 +84,7 @@ def read_stdin(stdin_input, queue):
# curses.noecho()
screen.keypad(1) # Get arrow keys to return ^[[A ^[[B ^[[C ^[[D

inqueue = Queue.Queue()
inqueue = queue.Queue()
inthread = Thread(target=read_stdin, args=(sys.stdin, inqueue))
inthread.daemon = True
inthread.start()
Expand All @@ -93,12 +93,12 @@ def read_stdin(stdin_input, queue):
try:
k = inqueue.get(False)
print(k)
except Queue.Empty:
except queue.Empty:
pass
except KeyboardInterrupt:
break

screen.keypad(0)
curses.nocbreak()
curses.echo()
curses.endwin()
curses.endwin()