[Tutor] Writing to a file on another server

Sheree Beaudette sheree@psouth.net
Thu, 6 Dec 2001 06:11:25 -0500


> Subject:	Writing to a file on another server
> 
> 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,office
rs
> div, 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!!
> 
I am working on a Windows NT machine.  The remote server is also Windows
NT.  The server I want to write to is a Novell server.