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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:24:28+00:00 2026-05-31T14:24:28+00:00

I am trying to run a simple server at start up. The OS I

  • 0

I am trying to run a simple server at start up. The OS I am using is Debian 6.0. I added a line in my .profile to run the python script: python /root/desktopnavserver2.py The computer boots and logs in, however I get the error below. The script runs fine when I don’t have the add line in debians .profile and I just run the script myself in console. Any Help?

Error Trace:

Traceback (most recent call last):
  File "/root/Desktop/navserver2.py", line 39, in <module>
    server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)
  File "/usr/lib/python2.6/SocketServer.py", line 402, in __init__
    self.server_bind()
  File "/usr/lib/python2.6/SocketServer.py", line 413, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
error: [Errno 98] Address already in use

Source:

#!/usr/bin/python

import SocketServer
import serial
com2 = serial.Serial(
    port = 1,
    parity = serial.PARITY_NONE,
    bytesize = serial.EIGHTBITS,
    stopbits = serial.STOPBITS_ONE,
    timeout=3,
    xonxoff = 0,
    rtscts = 0,
    baudrate = 9600
)

class MyTCPHandler(SocketServer.BaseRequestHandler):
    """
    The RequestHandler class for our server.

    It is instantiated once per connection to the server, and must
    override the handle() method to implement communication to the
    client.
    """


    def handle(self):
        # self.request is the TCP socket connected to the client
        self.data = self.request.recv(1024).strip()
        #print "%s wrote:"%self.client_address[0]
        #print self.data
        # just send back the same data, but upper-cased
        self.request.sendall(self.data.upper())
        com2.write(self.data)

if __name__ == "__main__":
    HOST, PORT = "192.168.0.200", 14052 #change to 192.168.0.200

    # Create the server, binding to localhost on port 9999
    server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler)

    # Activate the server; this will keep running until you
    # interrupt the program with Ctrl-C
    server.serve_forever()
  • 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-31T14:24:30+00:00Added an answer on May 31, 2026 at 2:24 pm

    I believe that .profile is executed by every instance of shell that identifies itself as a login shell. Probably you have more than one such shell.

    Putting a single-instance script in your .profile is a bad idea anyway – it means that you can only have one login session, next sessions will cause this error.

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

Sidebar

Related Questions

I am using Python 2.6 and am trying to run a simple random number
I am trying to run a simple multiple processes application in Python. The main
I'm trying to set up an application server to run a simple website and
I am trying to setup a simple UDP client and server using Ruby. The
I'm trying to get a simple python script from the learnpythonthehardway tutorial to show
I'm trying to set up a very simple UDP socket server with python that
I am trying to run a simple SQLITE application on Windows Mobile developed with
I'm trying to run a simple query with $this->db in Kohana, but am running
I am new to Tomcat, and trying to run a simple HelloWorld servlet. I
I am trying to run this dreadfully simple command in Bash java -cp nasa-top-secret.jar

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.