Home/Support/Support Forum/[Errno 13] Permission denied
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

[Errno 13] Permission denied

0 votes
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
asked Jun 19, 2017 in 3rd Party Python and API development in other Languages by jeancarlosgnu New to the Community (0 points)
edited Jun 19, 2017 by jeancarlosgnu

Please log in or register to answer this question.

1 Answer

0 votes
Would need to see what lines 6, 14, 28 are before I could say yes or no on that one.
answered Jun 19, 2017 by mvut Veteran of the Digi Community (11,298 points)
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.
...