Accessing file from Remote location
subhabrata.banerji at gmail.com
subhabrata.banerji at gmail.com
Wed Apr 29 05:45:13 EDT 2015
Dear Group,
I have a good amount of data in a remote location.
It is in MySql Database. I am trying to access it as,
>>> import pymysql
>>> import pymysql.cursors
...
...
with connection.cursor() as cursor:
# Read a single record
sql = "SELECT candidateid,cnd.FirstName, cnd.LastName,Concat('\\xxx.xxx.x.xxx\files\Cand_Res/',orgguid,'/',DATE_FORMAT(cnd.createddate,'%Y%m'),'/',candidateguid,'/',File) as filePath from candidate cnd join mstorganization org on cnd.orgid = org.OrgId order by cnd.modifieddate limit 1"
cursor.execute(sql)
result = cursor.fetchone()
print(result)
Now I am getting the file path.
I am trying to open this file in Python.
I tried options as,
f=open("//remote_machine/folder1/file1.doc", "r"),
f=open("\\\\remote_machine\\folder1\\file1.doc", "r")
...
....
given in
https://mail.python.org/pipermail/python-win32/2009-February/008847.html
and in
http://www.thecodingforums.com/threads/how-to-open-a-remote-file-using-python.671892/
but I am not being able to open it.
Am I doing any error?
If I run the path I am getting the document.
My document path is:
\\xxx.xxx.x.xxx\Files\Cand_Res/0FB45CD9-B9E3-4ED5-BBD0-B0EA3DA62B2E/201308/da0791ba-b123-4cfc-ac1e-5a42af2091d8/2f14e4b3-4fb8-4e5f-bcb8-f5d34ee9ab8d.doc
I am using Python 2.7.6 | 64-bit | (default, Sep 15 2014, 17:36:35) [MSC v.1500 64 bit (AMD64)] on win32 Enthought
Canopy. This is not my default Python location.
My current directory is:
>>> os.getcwd()
'C:\\Windows\\system32'
>>>
I am using Windows 7 Professional 64 bit.
If any body may kindly suggest.
Regards,
Subhabrata Banerjee.
More information about the Python-list
mailing list