strnge pb with sockets

Olivier MARCE (alf@lifac6.uucp)
22 Feb 1995 11:16:02 GMT

Hello,

I have a strnage pb with socket module.
I want to make a function 'verify' which check a mail address
connecting itself on the sendmail.

I've tried the following *in interactive mode* :
>>> from socket import *
>>> adresse='user@machine1'
>>> machine='machine5'
>>> import string
>>> adr=string.splitfields(adresse,'@')
>>> canal=socket(AF_INET, SOCK_STREAM)
>>> canal.connect(adr[1], 25)
>>> data='helo '+machine+'\nvrfy '+adr[0]+'\n'
>>> canal.send(data)
21
>>> d=canal.recv(1024)
>>> print (d), len(d)
220 machine1.ens-cachan.fr Sendmail 4.1/88/01/19 3.0 ready at Wed, 22 Feb 95 11:41:41 +0100
250 machine1.ens-cachan.fr Hello lifac5 (lifac6), pleased to meet you
250 Olivier MARCE <user>
185
>>>

All is ok.

But if I put the *same* lines in a file and I execute it :

machine6% python titi
220 machine1.ens-cachan.fr Sendmail 4.1/88/01/19 3.0 ready at Wed, 22 Feb 95 12:14:02 +0100
91

Did I forgot something ?

Thanks for help

-
Olivier MARCE Tel : (33) 1 47 40 24 87
LIFAC 24 04
ENS Cachan Fax : (33) 1 47 40 24 64
61 av du Pt WILSON
94235 Cachan Cedex e-mail : O.Marce@lifac.ens-cachan.fr
FRANCE
(la il faudrait que je rajoute l'URL de ma page, mais d'aucun
aurait tendance a croire que je ne fais que ca....)