Home » socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

To solve socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions error follow below methods.

ERROR LOG

C:\python>python TestServer.py Traceback (most recent call last):
File "TestServer.py", line 19, in server = SocketServer.TCPServer((HOST, PORT), MyTCPHandler) File "C:\Python26\lib\SocketServer.py", line 400, in init self.server_bind() File "C:\Python26\lib\SocketServer.py", line 411, in server_bind self.socket.bind(self.server_address) File "", line 1, in bind

socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions

How to solve socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions ?

Refer the given methods to solve the issue.

Method 1:

IF Win7 is your operating system. Simply use the terminal command netstat -na|findstr port to see if the port has been utilised. So, if you wish to start the server without this notice, change to a different port that hasn’t been used before.

Method 2 :

Administrator accounts on Windows Vista/7 with UAC run programs in unprivileged mode by default.

Before running as administrator, programmes must prompt for administrator access with the all-too-familiar UAC dialogue. There is no “Run as Administrator” context menu option for Python programmes because they are not directly executable.

To determine whether the script has admin access, use ctypes.windll.shell32.IsUserAnAdmin() on python.exe, and ShellExecuteEx using the ‘run as’ verb on python.exe, with sys.argv[0] as a parameter to prompt the UAC popup if necessary.

Hope the above solution works.

Also read :

BadZipFile: File is not a zip file while unzipping a file