由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - error of opening a file located in a remote server from pyt (转载)
相关主题
perl 的问题python 小问题
入门问题,perl里s@\_@@g 是什么意思?如何实现 strtok() ?
Help -- How to output error messages to a file for scripts called by system calls???这个有更好的算法吗?
请教,关于g++ -l的问题请教python 打开文件的问题!多谢!
python smtp 587 连不上gmail, socket error?有一个文件夹里有大概1000个文件。我有以下的Python语句调用后(转载)
包子,怎样在Python里产生一个csv file,再email 出去?how to use make file in Visual c++
help: 一个很简单的 PayPal API 总是报错; PayPal alternativehow to display an excel file in java? (转载)
How to compile multiple c files into one obj file?How to see the content of a library file
相关话题的讨论汇总
话题: file话题: csv话题: error话题: pyt话题: located
进入Programming版参与讨论
1 (共1页)
l******9
发帖数: 579
1
【 以下文字转载自 JobHunting 讨论区 】
发信人: light009 (light009), 信区: JobHunting
标 题: error of opening a file located in a remote server from pyton
发信站: BBS 未名空间站 (Sun Jul 27 19:03:52 2014, 美东)
I need to access read a csv file located in a server from python 3.2 on win7.
The file name is
csv_file =
file_loc = '\serverName.myCompanyName.com\mypath\Files\myfile.csv'
with open(file_loc , 'r') as csv_file # error !!!
csv_reader = csv.reader(csv_file, delimiter=',')
error:
IOError: [Errno 2] No such file or directory: '\serverName.myCompanyName
.com\mypath\Files\myfile.csv'
But, I can access the folder and open the file from win 7 .
Thanks
n*****t
发帖数: 22014
2
两个斜杠?不懂 python,不过看着你这个打开方式没说明协议啊

win7.

【在 l******9 的大作中提到】
: 【 以下文字转载自 JobHunting 讨论区 】
: 发信人: light009 (light009), 信区: JobHunting
: 标 题: error of opening a file located in a remote server from pyton
: 发信站: BBS 未名空间站 (Sun Jul 27 19:03:52 2014, 美东)
: I need to access read a csv file located in a server from python 3.2 on win7.
: The file name is
: csv_file =
: file_loc = '\serverName.myCompanyName.com\mypath\Files\myfile.csv'
: with open(file_loc , 'r') as csv_file # error !!!
: csv_reader = csv.reader(csv_file, delimiter=',')

l**********n
发帖数: 8443
3
Remember that backslash is an "escape" character so
you must us r"" or double the number of backslashes
without the "r":
path="\servername\share\folder\file.ext"
OR Use forward slashes to specify the UNC Path:
open('//HOST/share/path/to/file')
1 (共1页)
进入Programming版参与讨论
相关主题
How to see the content of a library filepython smtp 587 连不上gmail, socket error?
is it possible use VC 6.0 library file in .net包子,怎样在Python里产生一个csv file,再email 出去?
can't understand this function definitionhelp: 一个很简单的 PayPal API 总是报错; PayPal alternative
Big # of files output problem in CHow to compile multiple c files into one obj file?
perl 的问题python 小问题
入门问题,perl里s@\_@@g 是什么意思?如何实现 strtok() ?
Help -- How to output error messages to a file for scripts called by system calls???这个有更好的算法吗?
请教,关于g++ -l的问题请教python 打开文件的问题!多谢!
相关话题的讨论汇总
话题: file话题: csv话题: error话题: pyt话题: located