mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
Merge pull request #289 from dlon/psutil-permissions
Fix permissions error on Windows
This commit is contained in:
commit
47eab46f05
1 changed files with 12 additions and 8 deletions
|
@ -149,16 +149,20 @@ def cleanupOldMplayerProcesses():
|
||||||
|
|
||||||
exeDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
exeDir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||||
|
|
||||||
for proc in psutil.process_iter(attrs=['pid', 'name', 'exe']):
|
for proc in psutil.process_iter():
|
||||||
if not proc.info['exe'] or proc.info['name'] != 'mplayer.exe':
|
try:
|
||||||
|
info = proc.as_dict(attrs=['pid', 'name', 'exe'])
|
||||||
|
if not info['exe'] or info['name'] != 'mplayer.exe':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# not anki's bundled mplayer
|
# not anki's bundled mplayer
|
||||||
if os.path.dirname(proc.info['exe']) != exeDir:
|
if os.path.dirname(info['exe']) != exeDir:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print("terminating old mplayer process...")
|
print("terminating old mplayer process...")
|
||||||
proc.kill()
|
proc.kill()
|
||||||
|
except SystemError:
|
||||||
|
pass
|
||||||
|
|
||||||
mplayerCmd = ["mplayer", "-really-quiet", "-noautosub"]
|
mplayerCmd = ["mplayer", "-really-quiet", "-noautosub"]
|
||||||
if isWin:
|
if isWin:
|
||||||
|
|
Loading…
Reference in a new issue