[Tutor] Writing to a file on another server

Beaudette, Sheree SBeaudette@banknorth.com
Wed, 5 Dec 2001 12:31:39 -0500


I'm attempting to write to a file but the following code doesn't seem to
work.  I'm not sure where the file is going if anywhere.  I'm working from
my machine and developing on a remote server which is where I'm running the
application that would create this file (the .py file is also located on
this remote server).  I'd like the file to write to another server ideally.
Is this possible?

The following is my code...  I tried using os.chdir but it didn't seem to
work.  I can't get it to write anywhere it seems

By default without specifying a path where should the file go?

def
write_data(itot,jtot,banknos,bankcontrol1,officersbank,officersno,officersdi
v, officersdept):
    import os
    #os.chdir('/temp)'
    i=0
    j=0
    while i <= itot:
        fh=open(bk.txt,"w")
        fh.write('1 3         COL 1 = FORM,  COL 3 = SPOOL CODE\n')
        while j <= jtot:
            fh.write(officersbank[j] + ' ' + officersno[j] + ' ' +
officersdiv[j] + ' ' + officersdept[j] + '\n')
            j=j+1
        i=i+1
    fh.close()
    return 1

Any help would be much appreciated.  I've been working on it for days and am
getting frustrated!!