0

I am trying to read an excel file from a NAS using Jupyter Notebook (macOS, Python 3, SynologyDS218+).

Script worked absolutely fine when the file was stored locally, but I cannot determine the correct code or file path adjustment to access the file once moved to the NAS.

I am logged into the NAS and from Mac Finder the file path is:

Server: smb://NAS/home/folder/file.xlsx

I have reviewed...

How to read an excel file directly from a Server with Python

Python - how to read path file/folder from server

https://apple.stackexchange.com/questions/337472/how-to-access-files-on-a-networked-smb-server-with-python-on-macos

... and tried numerous code variations as a result, but with no success.

I am using:

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()

But regardless of the code/file path variation, the same error is returned:

FileNotFoundError [Errno 2] No such file or directory: //NAS/home/folder/file.xlsx
  • 1
    (Disclaimer: I don't use a Mac) Can you not just map a drive from your local machine to the NAS drive and refer to the file via that path? – MurrayW Sep 02 '19 at 13:28
  • Totally agree with @MurrayW https://www.synology.com/en-global/knowledgebase/DSM/help/DSM/Tutorial/store_with_mac – Pitto Sep 02 '19 at 13:28
  • Drive is mapped and I have tried with no success. – user11079386 Sep 02 '19 at 13:48

1 Answers1

0

I finally located the correct code / file path adjustment necessary to read the file. See https://apple.stackexchange.com/questions/349102/accessing-a-nas-device-from-python-code-on-mac-os

Although the drive was mapped and Mac Finder indicated a file path of "smb://NAS/home/folder/file.xlsx", using Control+Command+C instead, to copy the file path from Finder to the clipboard returned "/Volumes/home/folder/file.xlsx". Using this file path located the file and allowed it to be read.