Skip to content

Commit

Permalink
Fix serial port lock on win
Browse files Browse the repository at this point in the history
  • Loading branch information
blavka committed Jan 29, 2019
1 parent af0cff8 commit 2fefb89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpctl/at.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _connect(self):
dsrdtr=False)
except serial.serialutil.SerialException as e:
if e.errno == 2:
raise ATException('Could not open device %s' % device)
raise ATException('Could not open device %s' % self._device)
raise ATException(str(e))

self._lock()
Expand Down Expand Up @@ -98,7 +98,7 @@ def command(self, command):
return self._read_response()

def _lock(self):
if fcntl or not self._ser:
if not fcntl or not self._ser:
return
try:
fcntl.flock(self._ser.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
Expand Down

0 comments on commit 2fefb89

Please sign in to comment.