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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:47:13+00:00 2026-06-16T16:47:13+00:00

I’m totally unfamiliar with Python but I there is a piece of code that

  • 0

I’m totally unfamiliar with Python but I there is a piece of code that I need to fix. It’s from SublimeXdebug plugin for Sublime Text 2, which is the only plugin out there for PHP debugging with Sublime Text. The plugin is written in Python and, more specifically, in Python 2.6 or older, while the system the plugin runs on (Ubuntu 12.04) only supports Python >= 2.7. However, it seems that the plugin / Sublime Text developers somehow managed to “emulate” Python 2.6 because when I insert print sys.version into the plugin’s code, it reports Python 2.6.6. It could have helped some other plugins but not SublimeXdebug:

Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File "./Xdebug.py", line 321, in thread_callback
    protocol.accept()
  File "./Xdebug.py", line 137, in accept
    raise(ProtocolConnectionException, x)
ProtocolConnectionException

and the problematic piece of code (probably not the only one) goes like this:

def accept(self):
    serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    if serv:
        try:
            serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            serv.settimeout(1)
            serv.bind(('', self.port))
            serv.listen(1)
            self.listening = True
            self.sock = None
        except Exception, x:
            raise(ProtocolConnectionException, x) # line 137 <------------

        while self.listening:
            try:
                self.sock, address = serv.accept()
                self.listening = False
            except socket.timeout:
                pass

        if self.sock:
            self.connected = True
            self.sock.settimeout(None)
        else:
            self.connected = False
            self.listening = False

        try:
            serv.close()
            serv = None
        except:
            pass
        return self.sock
    else:
        raise ProtocolConnectionException('Could not create socket')

(For those who would recommend downloading a 2.6 version of Python in a .deb, unpacking it, and then moving usr/lib/python2.6 into {sublime text folder}/lib, I tried it already, didn’t help.)

So could the root of the problem be in Python version mismatch or something else?

Edit:

If I change the line 137 to just raise it says:

Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File "./Xdebug.py", line 321, in thread_callback
  File "./Xdebug.py", line 132, in accept
  File "<string>", line 1, in bind
error: [Errno 98] Address already in use

The line 132 is serv.bind(('', self.port)).

  • 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-06-16T16:47:14+00:00Added an answer on June 16, 2026 at 4:47 pm

    I suspect this Python version stuff is a red herring. What’s happening is this code is attempting to listen on a TCP port (whatever self.port is), but something else is already listening there. On Linux, you could run sudo netstat -anp | grep LISTEN to figure out what process that is.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I need a function that will clean a strings' special characters. I do NOT
I need to clean up various Word 'smart' characters in user input, including but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

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.