无法从 NAS 读取文件
Cannot read file from NAS
我正在尝试使用 Jupyter Notebook(macOS、Python 3、SynologyDS218+)从 NAS 读取 excel 文件。
当文件存储在本地时,脚本工作得非常好,但我无法确定正确的代码或文件路径调整以在移动到 NAS 后访问文件。
我登录到 NAS,从 Mac Finder 文件路径是:
服务器:smb://NAS/home/folder/file.xlsx
我评论过...
Python - how to read path file/folder from server
...并因此尝试了多种代码变体,但没有成功。
我正在使用:
pd.read_excel(“//NAS/home/folder/file.xlsx”, sheet_name=‘total’, header=84, index_col=0, usecols=‘B,AL,DC’, skiprows=0, parse_dates=True).dropna()
但不管 code/file 路径变化如何,都会返回相同的错误:
FileNotFoundError [Errno 2] No such file or directory: //NAS/home/folder/file.xlsx
我终于找到了读取文件所需的正确代码/文件路径调整。参见 https://apple.stackexchange.com/questions/349102/accessing-a-nas-device-from-python-code-on-mac-os
尽管驱动器已映射且 Mac Finder 指示文件路径 "smb://NAS/home/folder/file.xlsx",但使用 Control+Command+C 将文件路径从 Finder 复制到剪贴板返回“/Volumes/home/folder/file.xlsx”。使用此文件路径找到文件并允许读取它。
我正在尝试使用 Jupyter Notebook(macOS、Python 3、SynologyDS218+)从 NAS 读取 excel 文件。
当文件存储在本地时,脚本工作得非常好,但我无法确定正确的代码或文件路径调整以在移动到 NAS 后访问文件。
我登录到 NAS,从 Mac Finder 文件路径是:
服务器:smb://NAS/home/folder/file.xlsx
我评论过...
Python - how to read path file/folder from server
...并因此尝试了多种代码变体,但没有成功。
我正在使用:
pd.read_excel(“//NAS/home/folder/file.xlsx”, sheet_name=‘total’, header=84, index_col=0, usecols=‘B,AL,DC’, skiprows=0, parse_dates=True).dropna()
但不管 code/file 路径变化如何,都会返回相同的错误:
FileNotFoundError [Errno 2] No such file or directory: //NAS/home/folder/file.xlsx
我终于找到了读取文件所需的正确代码/文件路径调整。参见 https://apple.stackexchange.com/questions/349102/accessing-a-nas-device-from-python-code-on-mac-os
尽管驱动器已映射且 Mac Finder 指示文件路径 "smb://NAS/home/folder/file.xlsx",但使用 Control+Command+C 将文件路径从 Finder 复制到剪贴板返回“/Volumes/home/folder/file.xlsx”。使用此文件路径找到文件并允许读取它。