[Mailman-Users] socket.gethostname()

Richard Barrett r.barrett at ftel.co.uk
Thu Nov 6 17:57:12 CET 2003


On Thursday, November 6, 2003, at 05:43  pm, John Poltorak wrote:

>
>
> I'm getting an error in LockFile.py at this point (line 180) :-
>
>         self.__tmpfname = '%s.%s.%d' % (
>             lockfile, socket.gethostname(), os.getpid())
>
> It looks as though the function socket.gethostname() is causing this
> error.
>
> How can I display the value returned by this funtion and where should  
> it
> be retrieved from? ie should it be using $HOSTNAME ?
>

socket is a standard Python module. Its gethostname() function should  
return the same as the hostname shell command. From the command line  
you should be able to run python and get something like this:

mailman at mailman2:~> hostname
mailman2
mailman at mailman2:~> python
Python 2.2.2 (#3, Feb 11 2003, 16:57:53)
[GCC 2.95.3 20010315 (SuSE)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import socket
 >>> socket.gethostname()
'mailman2'
 >>> import os
 >>> os.getpid()
17830
 >>> import sys
 >>> sys.exit()
mailman at mailman2:~>

>
> --  
> John
>
> This message was sent to: r.barrett at openinfo.co.uk
> Unsubscribe or change your options at
> http://mail.python.org/mailman/options/mailman-users/ 
> r.barrett%40openinfo.co.uk
>





More information about the Mailman-Users mailing list