test_socket.py failure

x2164 at mailcity.com x2164 at mailcity.com
Mon Jan 31 21:34:11 EST 2005


Nick Coghlan <ncoghlan at iinet.net.au> wrote:
> x2164 at mailcity.com wrote:
> >      hi all,
> > 
> >      Linux 2.4.28
> >      Glibc 2.2.5
> >      gcc   2.95.3
> > 
> > 
> >      I'm new to Python.
> > 
> >      I've compiled Python 2.4 from tar file.
> > 
> >      When running 'make test' i'm getting a failure
> >      in test_socket.
> > 

> Two questions. First, what does the following code give 
> when you run it at the 
> interactive prompt?:

> Py> import socket
> Py> socket.getservbyname('daytime')
> 13

> Second, is there an entry for 'daytime' in /etc/services?

> Cheers,
> Nick.

> -- 
> Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
> ---------------------------------------------------------------
>              http://boredomandlaziness.skystorm.net



     hi Nick,


     At the interactive python prompt i did/got the following:

	bash-2.04$ ./python 
	Python 2.4 (#1, Jan 29 2005, 10:31:35) 
	[GCC 2.95.3 20010315 (release)] on linux2
	Type "help", "copyright", "credits" or "license" for 
	   more information.
	>>> import socket
	>>> socket.getservbyname('daytime', 'tcp')
	13
	
	 # The 13 looks ok but look what happen 
	 # when i asked only for the service, like
	 # the line that fails in test_socket.
	
	>>> socket.getservbyname('daytime')       
	Traceback (most recent call last):
	  File "<stdin>", line 1, in ?
	socket.error: service/proto not found
	>>>

     From my /etc/services file:

	daytime         13/tcp
	daytime         13/udp


    I was trying to use gdb to watch the function 
    socket_getservbyname, from Modules/socketmodule.c, 
    execute but i'm not sure how to set the gdb 'break' for 
    a function in a module that isn't imported at the time 
    i start python in gdb.

    Hints welcome. ;-)


    pete jordan
    x2164 at
    mail.city


-- 
	............




More information about the Python-list mailing list