Is There A Problem With makefile() On Win32?

John Abel john.abel at pa.press.net
Mon Sep 29 14:12:29 EDT 2003


Hi,

I've a small script, which listens to a port on a remote machine.  I'm
trying to implement makefile.  However, the code on Win32 Py 2.2.2

    def _Connect( self ):
        sockConn = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
        try:
            sockConn.connect( ( self.remoteMachine, self.remotePort ) )
        except socket.error, ErrorMsg:
            print "Got Me An Error"

        print "Going To Run MakeFile"
        sockFile = sockConn.makefile( 'r' )
        for tcpData in sockFile:
            print tcpData

produces this:

    for tcpData in sockFile:
TypeError: iteration over non-sequence

On linux, it just sits there, ignoring the incoming data.  Py 2.3.1 on
linux/OSX works OK (I haven't got round to testing 2.3.1 on Win32).  I've
checked the docs for 2.2.3/2.3.1, and can't find anything to say it
shouldn't work.  My question then, is it fixed on 2.2.3, and will it work on
Win32 (I have to develop scripts to run on Win32/linux/OSX)?

Regards

John






More information about the Python-list mailing list