Edgewall Software
Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10954 closed defect (fixed)

'socket.error' object has no attribute 'strerror' on Python 2.5

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.1
Component: web frontend/tracd Version: 1.0-stable
Severity: minor Keywords:
Cc: Branch:
Release Notes:

Correctly handle socket.error on Python 2.5

API Changes:
Internal Changes:

Description

If tracd on Python 2.5 starts with a used port number, it crashes with the following error.

Error starting Trac server on 0.0.0.0:3000 view at http://127.0.0.1:3000/
Traceback (most recent call last):
  File "/home/jun66j5/venv/trac/1.0/bin/tracd", line 9, in <module>
    load_entry_point('Trac==1.0', 'console_scripts', 'tracd')()
  File "home/jun66j5/venv/trac/1.0/lib/python2.5/site-packages/trac/web/standalone.py", line 335, in main
  File "home/jun66j5/venv/trac/1.0/lib/python2.5/site-packages/trac/web/standalone.py", line 301, in serve
AttributeError: 'error' object has no attribute 'strerror'

socket.error on Python 2.6+ has an attribute strerror, however, not on Python 2.5 yet. http://docs.python.org/2/library/socket.html#socket.error

  • trac/web/standalone.py

    diff --git a/trac/web/standalone.py b/trac/web/standalone.py
    index 7875b3d..09e380d 100755
    a b def main():  
    298298                                       use_http_11=options.http11)
    299299            except socket.error, e:
    300300                print 'Error starting Trac server on %s' % loc
    301                 print e.strerror
     301                print e.args[1]
    302302                sys.exit(1)
    303303
    304304            print 'Server starting in PID %i.' % os.getpid()

Attachments (0)

Change History (3)

comment:1 by Remy Blank, 11 years ago

Jun, don't hesitate to commit such fixes directly. The ticket is nice for documentation.

comment:2 by Jun Omae, 11 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Fixed in [11471-11472].

comment:3 by Jun Omae, 11 years ago

Owner: set to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.