刚刚在我的XP PC,Python 2.7和SMB共享上进行了测试
\myshare
os.listdir('\\myshare') # Fails with "WindowsError: [Error 53] The network path was not found"os.listdir('\\myshare/folder') # Succeeds我认为某些混乱可能是由WindowsError显示
repr()路径的而不是实际路径引起的-
>>> repr(path)"'\\myshare'">>> str(path)'\myshare'
如果这是Python 3和unipre问题,建议您先尝试修复字符串:
path = "\\mysharefolder"path = bytes(path, "utf-8").depre("unipre_escape")print os.listdir(path)(不幸的是,由于我没有安装Python 3,所以我无法对其进行测试,但是请告诉我它是否有效,我将编辑答案)



