Migrate to Python 3

This commit is contained in:
Gobinath 2017-03-22 20:07:51 -04:00
parent f9ef884306
commit 637eebdde0
3 changed files with 5 additions and 4 deletions

View File

@ -47,13 +47,14 @@ def play_notification():
# Write file data into the sound stream # Write file data into the sound stream
data = sound.readframes(CHUNK) data = sound.readframes(CHUNK)
while data != '': while data != b'':
stream.write(data) stream.write(data)
data = sound.readframes(CHUNK) data = sound.readframes(CHUNK)
# Close steam # Close steam
stream.stop_stream() stream.stop_stream()
stream.close() stream.close()
sound.close()
wrapper.terminate() wrapper.terminate()
except Exception as e: except Exception as e:
@ -100,7 +101,7 @@ def is_active_window_skipped(skip_break_window_classes, take_break_window_classe
cmdlist = ['xprop', '-root', '-notype','-id',active_xid, 'WM_CLASS', '_NET_WM_STATE'] cmdlist = ['xprop', '-root', '-notype','-id',active_xid, 'WM_CLASS', '_NET_WM_STATE']
try: try:
stdout = subprocess.check_output(cmdlist) stdout = subprocess.check_output(cmdlist).decode('utf-8')
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
logging.warning("Error in finding full-screen application") logging.warning("Error in finding full-screen application")
pass pass

Binary file not shown.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# Safe Eyes is a utility to remind you to take break frequently # Safe Eyes is a utility to remind you to take break frequently
# to protect your eyes from eye strain. # to protect your eyes from eye strain.
@ -244,7 +244,7 @@ def running():
''' '''
process_count = 0 process_count = 0
for proc in psutil.process_iter(): for proc in psutil.process_iter():
try: try:
# Check if safeeyes is in process arguments # Check if safeeyes is in process arguments
cmd_line = proc.cmdline() cmd_line = proc.cmdline()
if 'python2' == cmd_line[0] and 'safeeyes' in cmd_line[1]: if 'python2' == cmd_line[0] and 'safeeyes' in cmd_line[1]: