I got the solution. I used a Virtual serial port simulator to create virtual 2 ports and I paired those ports. Then I used pyserial python library for reading from and writing to the ports. Sample code for reading from port
import time import serial # configure the serial connections (the parameters differs on the device you are connecting to) ser = serial.Serial( port='COM2', baudrate=9600, timeout=1, parity=serial.PARITY_ODD, stopbits=serial.STOPBITS_TWO, bytesize=serial.SEVENBITS ) ser.isOpen() # Reading the data from the serial port. This will be running in an infinite loop. while 1 : # get keyboard input bytesToRead = ser.inWaiting() data = ser.read(bytesToRead) time.sleep(1) print(data)
Related Posts:
- Python: Making a beep noise
- How is Anaconda related to Python?
- What is the python keyword “with” used for? [duplicate]
- What is the purpose of meshgrid in Python / NumPy?
- How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
- FileNotFoundError: [WinError 2] The system cannot find the file specified:
- Remove all whitespace in a string
- What is a “method” in Python?
- How to generate all permutations of a list?
- Is there a Python equivalent to Ruby’s string interpolation?
- Python Progress Bar
- Most efficient way to find mode in numpy array
- Python error “ImportError: No module named”
- How to groupby based on two columns in pandas?
- How do I append one string to another in Python?
- Python Progress Bar
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- Python: list of lists
- sklearn error ValueError: Input contains NaN, infinity or a value too large for dtype(‘float64’)
- Limiting floats to two decimal points
- What do the symbol “=” and “==” mean in python?
- what does the __file__ variable mean/do?
- Difference between os.getenv and os.environ.get
- syntaxError: ‘continue’ not properly in loop
- How to check if the string is empty?
- Get the data received in a Flask request
- How do I install Python OpenCV through Conda?
- How to do superscripts and subscripts in Jupyter Notebook?
- How to get a random number between a float range?
- Cannot install Beautiful Soup in Anaconda Python 3.6.4 Windows 10
- ImportError: cannot import name
- How can you profile a Python script?
- How to set the current working directory?
- heroku: no default language could be detected for this app
- ‘DataFrame’ object has no attribute ‘sort’
- “VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path”
- What is __pycache__?
- TypeError: ‘NoneType’ object is not iterable in Python
- Understanding slice notation
- Add list to set?
- Infinite integer in Python
- Determine Whether Integer Is Between Two Other Integers?
- If vs. else if vs. else statements?
- Quoting backslashes in Python string literals
- AttributeError: Can only use .dt accessor with datetimelike values
- Python string class like StringBuilder in C#?
- How do I clear all variables in the middle of a Python script?
- How to tell if tensorflow is using gpu acceleration from inside python shell?
- What is the easiest way to get current GMT time in Unix timestamp format?
- xlrd.biffh.XLRDError: Excel xlsx file; not supported
- Python/Json:Expecting property name enclosed in double quotes
- Normalize columns of pandas data frame
- Normalize columns of pandas data frame
- Python Error: “ValueError: need more than 1 value to unpack”
- Python: can’t assign to literal
- “Initializing” variables in python?
- Difference between except: and except Exception as e:
- Flask raises TemplateNotFound error even though template file exists
- Python: Declare as integer and character
- How to downgrade the installed version of ‘pip’ on windows?
- Where do I get a SECRET_KEY for Flask?
- What does |= (ior) do in Python?
- How can I find the first occurrence of a sub-string in a python string?
- NumPy List Comprehension Syntax
- Python socket.error: [Errno 111] Connection refused
- Windows- Pyinstaller Error “failed to execute script ” When App Clicked
- Python: What is the correct MIME type for attaching html file to email
- Linear regression with matplotlib / numpy
- Solving “500: Internal Server Error, nbconvert failed: xelatex not found in PATH”
- Using Look Up Tables in Python
- Parallel Python: What is a callback?
- Python Django: You’re using the staticfiles app without having set the STATIC_ROOT setting
- sqlite3.OperationalError: unable to open database file
- Object of type ‘map’ has no len() in Python 3
- How to uninstall jupyter
- Python CSV error: line contains NULL byte
- python NameError: name ‘file’ is not defined
- python BeautifulSoup parsing table
- Python Add to dictionary loop
- how to exit a python script in an if statement
- How to add column to numpy array
- OpenCV NoneType object has no attribute shape
- AttributeError: ‘str’ object has no attribute ‘items’
- ImportError: No module named Crypto.Cipher
- How to clear Tkinter Canvas?
- Python official installer missing python27.dll
- TypeError: ‘range’ object does not support item assignment
- Convert string to variable name in python
- Can not click on a Element: ElementClickInterceptedException in Splinter / Selenium
- How to split elements of a list?
- How can I find script’s directory?
- Porting Perl to Python
- Generate a random letter in Python
- NameError from Python input() function
- How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?
- Syntax highlighting in vim for python
- Python IOError: File not open for reading
- Strange Exception in Tkinter callback
- How to resolve “ImportError: DLL load failed:” on Python?
- ‘module’ has no attribute ‘urlencode’