#NEWLINE# def determine_socket( path = default_path ) : #NEWLINE# #INDENT# 'Determine the socket with which to connect.' #NEWLINE# sockets = list_sockets ( path ) #NEWLINE# if ( not len ( sockets ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# if ( len ( sockets ) == 1 ) : #NEWLINE# #INDENT# return os . path . join ( path , sockets [ 0 ] ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# import dialog #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# sock = sockets [ 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sock = dialog . menu ( sockets ) #NEWLINE# #UNINDENT# return os . path . join ( path , sock )