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 1098217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:32:50+00:00 2026-05-17T00:32:50+00:00

I have two python scripts that have to run simultaneously because they interact with

  • 0

I have two python scripts that have to run simultaneously because they interact with each other. One script is a ‘server’ script running locally and the other is client script that connects to it via a socket. Normally I just open a couple terminal tabs and run the server script in one and the client in the other. After starting and stopping each script over and over, I wanted to make a bash alias to run both scripts with just one command and came up with this:

gnome-terminal --tab -e "python server.py" --tab -e "python client.py"

However, now the server script is raising an sqlite OperationalError saying that one of my data tables doesn’t exist. But when I run the scripts manually everything works fine. I have no clue what is going on, but I thought that maybe running the scripts together wasn’t giving the server script enough time to initialize and make its connection to the database. So I put a time.sleep(5) in the client script, but as soon as it starts I get the same error.

Anyone have an idea what could be happening? Or does anyone know of any alternatives for starting two python scripts with one command?

  • 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-17T00:32:51+00:00Added an answer on May 17, 2026 at 12:32 am

    Try combining the two commands into one:

    gnome-terminal --tab -x bash -c "python server.py & sleep 5; python client.py"
    

    I think it is better to put the sleep command (if needed) outside client since there may be situations where the server is already started and the client does not have to sleep.


    The -x flag means

    -x, --execute
             Execute the remainder of the command line inside the terminal.
    

    The command calls bash:

    bash -c "python server.py & sleep 5; python client.py"
    

    bash in turn, has a -c flag which means

    -c string If  the  -c option is present, then commands are read from string.  If
             there are arguments after the string, they are assigned to  the  posi‐
             tional parameters, starting with $0.
    

    You might want to experiment with

    gnome-terminal --tab -e "python server.py & sleep 5; python client.py"
    

    That might work too. When you run bash first, then your ~/.bashrc is read. Without calling bash, I think by default, /bin/sh is called instead.

    If you get

    "socket.error: [Errno 98] Address already in use",
    

    it probably means that your server has already been started, and running the server a second time fails.

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

Sidebar

Related Questions

I have a script (python) supposed to build up two paths - one in
I have a python script that I run with 'exec'. When a function is
I have two Python packages where one needs to be imported by the other.
I have a python script that is intended to run on my local machine
I have two separate python scripts. One is for getting user location information (which
I'm writing a python script that uses subprocess.Popen to execute two programs (from compiled
We have 10 Linux boxes that must run 100 different tasks each week. These
We need a script that will compare two directories of files and for each
I have python script that uses pysvn and checks out or updates a local
Greetings. I have written a little python script that calls MySQL in a subprocess.

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.