copy file over LAN

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Mar 27 02:00:11 EDT 2008


En Thu, 27 Mar 2008 00:34:20 -0300, Astan Chee <stanc at al.com.au> escribió:

> I have a file on another machine on the local network (my machine and
> local machines are on windows) and I want to copy it locally. Now the
> machine requires authentication and when I try to do a
> import shutil
> shutil.copy(r'\\remotemachine\c$\temp\filename',r'C:\folder\test.txt')
> and it gives me a IOError: [Errno 13] Permission denied: error, which I
> expect. How do I provide authentication to copy this file?

Probably there are other ways, but the "net use" command looks easy  
enough. Execute "net help use | more" in a console to see the right syntax.
Use the subprocess module to run the command from inside Python.

-- 
Gabriel Genellina




More information about the Python-list mailing list