# [Tutor] Writing to a remote file

Kent Johnson kent37 at tds.net
Fri Jun 16 16:54:34 CEST 2006

kieran flanagan wrote:
> Hi
>
> I want to run a script on one machine and log output messages to a
> remote file located on another machine. Is there any easy method of
> doing this ?.

Depends on the details, I suppose...

If the remote file is on a network file system accessible to the machine
running the script it should be easy - just open the file and write to
it. For example on Windows you should be able to write
f = open(r'\\server\path\to\logfile.txt', 'w')
print >>f, 'This is a very serious matter'

or configure the file path in your logging properties or whatever...

If the remote file system is *not* accessible from the local machine,
then you need some way to talk to the remote machine.

Kent