i trying install java silently in background using python script. path correct , verified isfile. recieve access denied exception. running administrator on local machine.
subprocess.popen('c:\users\xuser\jdk-8u45-windows-x64.exe /s addlocal="toolsfeature,sourcefeature"'); error returns
windowserror: [error 5] access denied
are running in regular terminal? in windows, need open terminal specially administrative privileges:
- in start menu search window, type cmd , press
ctrl+shift+enter. or, navigate programs > accessories > right click on command prompt , clickrun administrator. - run python script in new terminal.
edit: search yields may issue executing command after navigating directory installer located in; see windowserror [error 5] access denied.
install_dir=r"c:\users\xuser\" assert os.path.isdir(install_dir) os.chdir(install_dir) subprocess.popen('jdk-8u45-windows-x64.exe /s addlocal="toolsfeature,sourcefeature"') finally, use array of commands unix (not sure if it's required in windows), not 1 long string, e.g.
subprocess.popen(['jdk-8u45-windows-x64.exe', '/s', 'addlocal="toolsfeature,sourcefeature"']).
Comments
Post a Comment