Skip to content

Commit

Permalink
Fix issue #73 "Importing termios prevents operation on Windows"
Browse files Browse the repository at this point in the history
  • Loading branch information
nehpetsde committed Jul 12, 2017
1 parent bac95e9 commit 95694de
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/nfc/clf/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import os
import re
import errno
import termios
from binascii import hexlify

try:
Expand All @@ -39,6 +38,11 @@
except ImportError: # pragma: no cover
raise ImportError("missing serial module, try 'pip install pyserial'")

try:
import termios
except ImportError: # pragma: no cover
assert os.name is not 'posix'

import logging
log = logging.getLogger(__name__)

Expand Down Expand Up @@ -108,7 +112,7 @@ def find(cls, path):
return ["COM" + match.group(2)], match.group(3), False
if re.match(r'^$', match.group(2)):
ports = [p[0] for p in serial.tools.list_ports.comports()]
log.debug('serial ports: %s', ' '.join([p for p in ports]))
log.debug('serial ports: %s', ' '.join(ports))
return ports, match.group(3), True
log.error("invalid port in 'com' path: %r", match.group(2))

Expand Down

0 comments on commit 95694de

Please sign in to comment.