I am using Python to automate some installations in my everyday workflow.
The installation requires mounting a .dmg file to the system in order to start and complete the installation. Everything works fine until I try to eject/unmount the attached volume, it gives an error that the volume is used by Python and cannot be ejected/unmounted. The installation process is already completed by the time the unmount is executed, so in theory, files should no longer be in use.
Force unmount helps with the unmount process, but for some reason, it interferes with subsequent subprocess.Popen command that starts the installed application and the app crashes at startup. The crash doesn't occur if the volume is not unmounted, which is a sign the issue is caused by the unmount process.
I would like to try to unmount the volume without forcing the process, but I don't know how to unlock the files being used by Python for the installation. Is there a way to force python to unlock those files?
Thanks in advance.