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
8 changes: 7 additions & 1 deletion pexpect_serial/serial_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@

"""

from pexpect import spawn
# pexpect.spawn is not supported on some systems (i.e. Windows(TM))
# See https://pexpect.readthedocs.io/en/stable/overview.html#pexpect-on-windows for details.
import os
if os.name in ['nt']:
Comment on lines +26 to +27

@leiflm leiflm May 18, 2021

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT this condition is not even necessary. Using pexpect.fdexpect.fdspawn should be the right choice on any operating system.

To keep it "as is" as much as possible though, I've added this if/else conditional import statement here. Feel free to remove it and go solely with pexpect.fdexpect.fdspawn.

from pexpect.fdpexpect import fdspawn as spawn
else:
from pexpect import spawn
from pexpect.exceptions import ExceptionPexpect

__all__ = ['SerialSpawn']
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pyserial
pexpect
pexpect>=4
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name='pexpect-serial',
version='0.1.0',
version='0.2.0',
author='High Wall',
author_email='hiwall@126.com',
description='pexpect with pyserial',
Expand Down