Newbie Windows NT socket error

Steve Williams sandj.williams at gte.net
Tue Oct 3 22:46:49 EDT 2000


The following code works fine on Windows 98, but fails with a socket
error 10050 on Windows NT on the connect statement.

    from ftplib import FTP
    import sys, time
    ftp = FTP()
    ftp.connect(sys.argv[1],21)                    <=== fails on Windows
NT
    ftp.login(sys.argv[2],sys.argv[3],'')
    print ftp.sendcmd('cwd ' + sys.argv[4])
    ftp.retrlines('LIST ' + sys.argv[5])
    . . .

The Windows 98 command line doesn't have any quotes:

    python zzz.py 10.1.1.1 username userpass /xxx/yyy *.foo

If I put quotes around the host address in the command line on Windows
NT, I get 'host not found'.

If I change the failing statement to

    ftp.connect(str(sys.argv[1]),21)

then I get some kind of string error deep in the library.

If I change the failing statement to

    ftp.connect(10.1.1.1,21)

then I get a compile error.

I can't remember what happened with

   ftp.connect('10.1.1.1',21)

probably 'host not found'.

If I change the failing statement to

   ftp.connect(str(sys.argv[1]),str(21))

Python really gets mad at me.

What to do?

If 'host not found' is the correct answer, then why can it find the host
on Windows 98, but not on Windows NT.





More information about the Python-list mailing list