Home > OS >  I cannot open files on Windows Parallels VM from Python script running on Mac
I cannot open files on Windows Parallels VM from Python script running on Mac

Time:02-18

My Python script running on macOS cannot open files on Windows Parallels VM because of "PermissionError: [Errno 1] Operation not permitted". However, the script can open the copies of those files with the same privileges if they are on the macOS host.

From the macOS terminal I can correctly open the files at both locations.

Any advice?

import os

def main():
    fnOnMacOs='/Users/Juhasz/test.txt'
    fnOnWinVM='/Volumes/[C] Windows 10 64-bit.hidden/Users/Juhasz/test.txt'
    fileOnMacOs=os.open(fnOnMacOs, os.O_RDONLY)
    fileOnWinVM=os.open(fnOnWinVM, os.O_RDONLY)

if __name__ == "__main__":
    main()
Traceback (most recent call last):
  File "/Users/Juhasz/PycharmProjects/accessingVM/main.py", line 10, in <module>
    main()
  File "/Users/Juhasz/PycharmProjects/accessingVM/main.py", line 7, in main
    fileOnWinVM = os.open(fnOnWinVM, os.O_RDONLY)
PermissionError: [Errno 1] Operation not permitted: '/Volumes/[C] Windows 10 64-bit.hidden/Users/Juhasz/test.txt'
open '/Users/Juhasz/test.txt'
open '/Volumes/[C] Windows 10 64-bit.hidden/Users/Juhasz/test.txt'

CodePudding user response:

After further research I found the solution based on this post: PermissionError: [Errno 1] Operation not permitted after macOS Catalina Update

I had to set Full Disk Access permission for PyCharm in System Preferences on my Mac.

  • Related