[Errno 13] Permission denied

Hello, programming a python application as modbus Server.
The following error is displayed, when trying to open a socket

File “Server.py”, line 28, in _InitFrontEnd
serversocket.bind((‘127.0.0.1’, 502))
File “/usr/lib/python2.7/socket.py”, line 224, in meth
error: [Errno 13] Permission denied
/userfs/WEB/python $

I think they are permissions issues for the python user, but I do not have access to the root user.

try root / dbps … But it is not correct

The device is:XBee Gateway Wi-Fi
With python version: Python 2.7.1

Thank you for your attention

Would need to see what lines 6, 14, 28 are before I could say yes or no on that one.

Hi, thanks for answering

The problem seems to be in the lines:

serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
serversocket.bind((‘127.0.0.1’, 502))
serversocket.listen(5)

show

serversocket.bind((‘127.0.0.1’, 502))
File “/usr/lib/python2.7/socket.py”, line 224, in meth
error: [Errno 13] Permission denied

in this line show:

File “/usr/lib/python2.7/socket.py”, line 224, in meth
error: [Errno 13] Permission denied

That does not appear to be the standard XBee socket commands. What kind of socket are you tryng to open?

Trying to open a socket for a modbus server on the Gateway.

I using tipical examples from Digi :

https://www.digi.com/wiki/developer/index.php/Modbus_Serial_Over_Mesh

https://www.digi.com/wiki/developer/index.php/TCP_Server_Loopback_Transport

That code is for a Transport product and not an XBee Gateway.

I saw this code work on a product digi:
ConnectPort X2D

Is this different?

Yes they are different devices with different operating systems.