WinError 5 access denied after administrator privileges? - python

I installed a library called stockfish via pip install stockfish.
So I went on and tried to setup the Stockfish via:
from stockfish import Stockfish
stockfish = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win')
That throws a WinError 5, access denied:
Exception ignored in: <function Stockfish.__del__ at 0x0429AA48>
Traceback (most recent call last):
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py", line 270, in __del__
self.stockfish.kill()
AttributeError: 'Stockfish' object has no attribute 'stockfish'
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
emily = Stockfish(r'C:\Users\Acer\Desktop\chess\stockfish-11-win\src')
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\site-packages\stockfish\models.py", line 33, in __init__
self.stockfish = subprocess.Popen(
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Acer\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Zugriff verweigert
What have I done/tried?
I tried different Stockfish Downloads, running the Idle or CMD as admin, re-installed and used different PCs, but I somehow don't get to work with Stockfish - anyone able to help me out bypassing the access denied? What do I miss when initializing? Trying Stockfish returns <class 'stockfish.models.Stockfish'> , thus it seems like it's properly imported and functioning.

Related

OSError in willson davidson programme

I am runnning the python script pywd2015.py. Everything goes fine till i create a light curve. I get the following error.
qt.xkb.compose: failed to create compose table Traceback (most recent call last): File "/home/anil/astronomylab/Wilsion devinay /src/interfaces/syntheticcurve_interface.py", line 288, in plot_selected_light_curve results = lc_io.fill_for_synthetic_light_curve().save().run().read_synthetic_light_curve() File "/home/anil/astronomylab/Wilsion devinay /src/helpers/wd_utils/wd_io.py", line 44, in run self.process = subprocess.Popen(cmd, cwd=self._cwd) File "/usr/lib/python3.10/subprocess.py", line 969, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 8] Exec format error: '/home/anil/astronomylab/Wilsion devinay /wd-precompiled/lc_source.obj
I have tried to find the solution on internet, but i am unable to get any solution. Plese help to resolve the problem! What is causing it?

Getting error when trying to use Winotify (Python)

I'm trying to use the python module Winotify
to create toast notifications, but I'm running into a problem that I can't make heads or tails out off.
The test script I'm trying to run is the following:
from winotify import Notification
toast = Notification(app_id="windows app",
title="Winotify Test Toast",
msg="New Notification!")
toast.show()
But get the following error
Traceback (most recent call last):
File "D:\01 Libraries\Documents\Tosh0kan Studios\Coding\MangaDex Feed Notifier\_toaster.pyw", line 8, in <module>
toast.show()
File "C:\Users\igor\AppData\Local\Programs\Python\Python311\Lib\site-packages\winotify\__init__.py", line 197, in show
_run_ps(command=self.script)
File "C:\Users\igor\AppData\Local\Programs\Python\Python311\Lib\site-packages\winotify\__init__.py", line 72, in _run_ps
subprocess.Popen(
File "C:\Users\igor\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1022, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\igor\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1491, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
I really have no clue what's going on, so the most I tried was uninstalling and reinstalling, installing it in an older version of Python I have (version 3.9), and it still has the same problem.
Does anyone have any idea of what's happening?
EDIT
As #Pignotto said below, Powershell wasn't on my PATH variable. Once I added it, it worked fine.

Spyder Permission Error while starting the Kernel, Administrator rights do not change anything

when I start Spyder I get an error that says permission denied. This is the output from that in Spyder:
An error ocurred while starting the kernel
The error is:
Traceback (most recent call last):
File "C:\Users\John\anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole\plugin.py", line 1223, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "C:\Users\John\anaconda3\lib\site‑packages\jupyter_client\manager.py", line 313, in start_kernel
self.kernel = self._launch_kernel(kernel_cmd, **kw)
File "C:\Users\John\anaconda3\lib\site‑packages\jupyter_client\manager.py", line 220, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "C:\Users\John\anaconda3\lib\site‑packages\jupyter_client\launcher.py", line 131, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\Users\John\anaconda3\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\John\anaconda3\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Access is denied
It eventual pops up with a prompt that says
link to image
The advice I've found is to run Spyder in with administrator rights, but this does not fix my issue. I've found some other advice to do the following
As per #CarlosCordoba: "To fix this the OP needs to run conda update anaconda and then conda update jupyter_client in the Anaconda Prompt"
When I run conda update anaconda in the Anaconda cmd prompt with administrator rights this is what happens
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: - menuinst Exception
Traceback (most recent call last):
File "C:\Users\John\anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 246, in make_menu
menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix)
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 58, in install
_install(path, remove, prefix, mode='system')
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 33, in _install
data = json.load(open(path))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\John\\anaconda3\\Menu\\notebook.json'menuinst Exception
Traceback (most recent call last):
File "C:\Users\John\anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 246, in make_menu
menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix)
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 58, in install
_install(path, remove, prefix, mode='system')
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 33, in _install
data = json.load(open(path))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\John\\anaconda3\\Menu\\notebook.jsodone
Rolling back transaction: - menuinst Exception
Traceback (most recent call last):
File "C:\Users\John\anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 246, in make_menu
menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix)
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 58, in install
_install(path, remove, prefix, mode='system')
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 33, in _install
data = json.load(open(path))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\John\\anaconda3\\Menu\\notebook.json'menuinst Exception
Traceback (most recent call last):
File "C:\Users\John\anaconda3\lib\site-packages\conda\gateways\disk\create.py", line 246, in make_menu
menuinst.install(join(prefix, win_path_ok(file_path)), remove, prefix)
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 58, in install
_install(path, remove, prefix, mode='system')
File "C:\Users\John\anaconda3\lib\site-packages\menuinst\__init__.py", line 33, in _install
data = json.load(open(path))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\John\\anaconda3\\Menu\\notebook.jsodone
[WinError 5] Access is denied
()
Any help? I've only got a little knowledge in Python, and using this for mathematical optimization in a class.
EDIT: A little extra information. When I try to launch Spyder from the Anaconda Navigator it just spins forever, never launching.
I fixed it! I did a soft boot, and then in the Anaconda terminal ran spyder --reset. Then, ran Spyder with Administrative privileges, and it was able to connect!

Stockfish: PermissionError: [WinError 5] Access is denied

I am coding a chess game with the stockfish AI. However whenever i try to iport the library i get the error PermissionError: [WinError 5] Access is denied. I have searched up the error and havent found anything that has fixed my issue. I am pretty new to python so simple answers would be greatly appreciated. Here is my code:
from stockfish import Stockfish
stockfish = Stockfish(r"/users/meyer/appdata/local/programs/python/python39/lib/site-packages/stockfish")
And this is the error:
Traceback (most recent call last):
File "C:\Users\meyer\Desktop\Python\Chess\Chess ai.py", line 3, in <module>
stockfish = Stockfish(r"/users/meyer/appdata/local/programs/python/python39/lib/site-packages/stockfish")
File "C:\Users\meyer\AppData\Local\Programs\Python\Python39\lib\site-packages\stockfish\models.py", line 35, in __init__
self.stockfish = subprocess.Popen(
File "C:\Users\meyer\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\meyer\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Access is denied

Trying to use a python3 webscraper

Im trying to create a webscraper for the first time. The script wont run without a error code.
Tutorial I am using:
https://oxylabs.io/blog/python-web-scraping
I have followed all steps and have undergone further steps via other youtube tutorials but nothing has worked ;(
Error code:
Traceback (most recent call last):
File "C:\Users\hpy03\PycharmProjects\webtest\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\hpy03\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\hpy03\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/hpy03/PycharmProjects/webtest/test_scraping.py", line 5, in <module>
driver = webdriver.Chrome(executable_path='c:\path\to\windows\webdriver\executable.exe')
File "C:\Users\hpy03\PycharmProjects\webtest\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\hpy03\PycharmProjects\webtest\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'executable.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
It seems like you haven't referenced chromedriver properly. If you run chromedriver -v in Command Prompt, and get a version back, then just remove the executable_path=... from your code:
Before:
driver = webdriver.Chrome(executable_path='c:\path\to\windows\webdriver\executable.exe')
After:
driver = webdriver.Chrome()
Otherwise, you can place chromedriver.exe in the same folder as your code, and reference it like so:
driver = webdriver.Chrome(executable_path='./chromedriver.exe')
If you don't have chromedriver.exe, then see here.

Categories

Resources