Fix permissions error on Windows

This commit is contained in:
David Lönnhager 2019-02-27 02:51:28 +01:00
parent fed15f5b90
commit c6ab8dcc48

View File

@ -149,16 +149,20 @@ def cleanupOldMplayerProcesses():
exeDir = os.path.dirname(os.path.abspath(sys.argv[0]))
for proc in psutil.process_iter(attrs=['pid', 'name', 'exe']):
if not proc.info['exe'] or proc.info['name'] != 'mplayer.exe':
continue
for proc in psutil.process_iter():
try:
info = proc.as_dict(attrs=['pid', 'name', 'exe'])
if not info['exe'] or info['name'] != 'mplayer.exe':
continue
# not anki's bundled mplayer
if os.path.dirname(proc.info['exe']) != exeDir:
continue
# not anki's bundled mplayer
if os.path.dirname(info['exe']) != exeDir:
continue
print("terminating old mplayer process...")
proc.kill()
print("terminating old mplayer process...")
proc.kill()
except SystemError:
pass
mplayerCmd = ["mplayer", "-really-quiet", "-noautosub"]
if isWin: