Search code examples
pythoncmdvirtual-machinehost

The File ... is not in a folder shared with the host and cannot be opened by the host


I want to Open my Python file in a VM with the cmd. When i execute it it always showes these message: The File ... is not in a folder shared with the host and cannot be opened by the host.

How can i fix that?


Solution

  • You don't provide many details. Without a shared folder this can be achieved with scp and ssh if you have ssh key access fully set up. Substitute {mcs["user"]}@{host}.local with your username and VM name as appropriate. Substitute ubuntu.py with your python file

    scp ubuntu.py {mcs["user"]}@{host}.local:. 
    ssh {mcs["user"]}@{host}.local python3 ubuntu.py