Skip to content

Commit

Permalink
Merge pull request #39 from ppannuto/linux-open
Browse files Browse the repository at this point in the history
spawn Logic in the background for Linux
  • Loading branch information
ppannuto authored Feb 9, 2018
2 parents 3662cf9 + dc13975 commit ff649f1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions saleae/saleae.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import os
import platform
import psutil
import shutil
import socket
import sys
import time
Expand All @@ -32,6 +33,9 @@
except NameError:
ConnectionRefusedError = socket.error

PY2K = sys.version_info[0] == 2
PY3K = sys.version_info[0] == 3

@enum.unique
class Trigger(enum.IntEnum):
# Python convention is to start enums at 1 for truth checks, but it
Expand Down Expand Up @@ -86,9 +90,14 @@ def launch_logic(timeout=5):
if ret != 0:
raise OSError("Failed to open Logic software")
elif platform.system() == 'Linux':
ret = os.system('Logic')
if ret != 0:
raise OSError("Failed to open Logic software. Is 'Logic' in your PATH?")
if PY2K:
log.warn("PY2K support limited. If `Logic` is not on your PATH it will not open.")
os.system("Logic &")
else:
path = shutil.which('Logic')
if path is None:
raise OSError("Cannot find Logic software. Is 'Logic' in your PATH?")
os.system(path + '&')
elif platform.system() == 'Windows':
p = os.path.join("C:", "Program Files", "Saleae Inc", "Logic.exe")
if not os.path.exists(p):
Expand Down

0 comments on commit ff649f1

Please sign in to comment.