Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 594855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:59:54+00:00 2026-05-13T15:59:54+00:00

I have a program, using pyserial, and I want to test it without using

  • 0

I have a program, using pyserial, and I want to test it without using a real serial port device.

In windows, I use com0com, and in linux, I know there is a method to create virtual serial port pair without using additional program.

so I look up the manual, and found pts, /dev/ptmx, but I don’t know how to create a pair by following the manual, can anyone give me a example?

I tried(in python):

f = open("/dev/ptmx", "r")

and it works, /dev/pts/4 is created.

and I tried:

f = open("/dev/4", "w")

and the result is:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 5] Input/output error: '/dev/pts/4'

edit:
I found a solution(workround), using socat.

socat PTY,link=COM8 PTY,link=COM9

then COM8 COM9 are created as virtual serial port pair.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:59:55+00:00Added an answer on May 13, 2026 at 3:59 pm

    Per the docs, you need ptsname to get the name of the slave-side of the pseudo-terminal, and also, quoting the docs,

    Before opening the pseudo-terminal
    slave, you must pass the master’s file
    descriptor to grantpt(3) and
    unlockpt(3).

    You should be able to use ctypes to call all of the needed functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program using odac(11.2) and oracle client 11.2. Now I want to
I have a simple program on windows using visual studios 2008. In my code
I have program using gtkmm, gtkglextmm and exiv2. I want to include these libraries
I have simple chat program using WCF service. One service use for server and
I have written a program in .NET that listens to a particular Serial Port
I have a working connection with my serial device via PySerial, but I also
I have a C program and I need to test it using a file
I have a c# program using WPF. I have it that when you press
I have a program in C using Solaris with VERY ancient compatibility it seems.
I have the following MonoTouch program: using System.Drawing; using MonoTouch.Foundation; using MonoTouch.UIKit; using System;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.