Unable to mount smb with osascript after Ventura 13.3.1 (a) update

Hi,

I have been successful in mounting the smb volume from my Synology NAS using Python script in the past but the access was denied since MacOS launch an update to Ventura 13.3.1 (a). The following are the code to access the volume:


import os


os.system("osascript -e 'mount volume \"smb://mysvr/Documents/Expense\"'")

ImportPath = '/Volumes/Documents/Expense/ABC.xlsx'

orginalfile = os.path.join(ImportPath)

ImportPath = '/Users/myname/Documents/Coding/XYZ.xlsx'

targetfile = os.path.join(ImportPath)

shutil.copy(orginalfile, targetfile)

os.system("umount /Volumes/Documents/Expense")


The error is pointed to "shut.copy..." with the error message as "FileNotFoundError: [Errno 2] No such file or directory: '/Volumes/Documents/Expense/ABC.xlsx'".


I went to Setting > General > Sharing > File Sharing to switch set that as "ON" but resulting in the same issue.


I hope someone can advise on what is causing the issue. Thanks in advance.


Regards



Posted on May 6, 2023 7:48 PM

Reply
Question marked as Top-ranking reply

Posted on May 8, 2023 10:47 PM

I would hazard a guess that it has to do with the python script not having permissions to access Documents. Apps need to request access to locations such as Documents, etc. You'll need to grant Terminal / iTerm Full Disk Access and/or Developer Tools under System Settings -> Privacy & Security.

Similar questions

2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Unable to mount smb with osascript after Ventura 13.3.1 (a) update

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.