> Hello all, I am writing an application where I need to open a shared
> file on a remote machine using python script. I tried using the
> following function: f =
> urllib.open("\\remote_machine\\folder1\\file1.doc") I also tried using
> class urllib.FancyURLopener(...) but didn't work.
> Can some one help me in this regard. Thank you in advance, Venu
If it's a shared file on a Windows network (which I'm inferring),
provided you have the necessary access permissions, use
open("\\\\remote_machine\\share\\folder\\file", "r")
^^^^
Note that UNC names do require a double backslash to start...
Its often easier to read as
open(r"\\remote_machine\share\folder\file", "r")
If you really must open it via urllib, then try
urllib.open("file://remote_machine/share/folder/file")
-------------------------> "These thoughts are mine alone!" <---------
Andrew MacIntyre National Licensing and Allocations Branch
tel: +61 2 6219 5356 Inputs to Industry Division
fax: +61 2 6253 3277 Australian Communications & Media Authority
email: [email protected]
If you have received this email in error, please notify the sender immediately
and erase all copies of the email and any attachments to it. The information
contained in this email and any attachments may be private, confidential and
legally privileged or the subject of copyright. If you are not the addressee it
may be illegal to review, disclose, use, forward, or distribute this email
and/or its contents.
Unless otherwise specified, the information in the email and any attachments is
intended as a guide only and should not be relied upon as legal or technical
advice or regarded as a substitute for legal or technical advice in individual
cases. Opinions contained in this email or any of its attachments do not
necessarily reflect the opinions of ACMA.
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32