4borg web ui permission denied error

pi@raspberrypi ~ $ python ~/4borg/4BorgWeb.py
Loading PicoBorg Reverse on bus 1, address 44
Found PicoBorg Reverse at 44
PicoBorg Reverse loaded on bus 1
Setup camera
Setup the stream processing thread
Wait ...
Start the stream using the video port
Setup the watchdog
Traceback (most recent call last):
File "/home/pi/4borg/4BorgWeb.py", line 369, in
httpServer = SocketServer.TCPServer(("0.0.0.0", webPort), WebServer)
File "/usr/lib/python2.7/SocketServer.py", line 420, in __init__
self.server_bind()
File "/usr/lib/python2.7/SocketServer.py", line 434, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
/usr/lib/python2.7/dist-packages/picamera/encoders.py:545: PiCameraResolutionRounded: frame size rounded up from 240x180 to 240x192
width, height, fwidth, fheight)))
return getattr(self._sock,name)(*args)
socket.error: [Errno 13] Permission denied

I am a newbie....sorry....how do i fix this permission issue?

piborg's picture

In order to run the Web UI script it needs to have permission to connect to the network.

You need to use sudo to give that permission, like this:
sudo python ~/4borg/4BorgWeb.py

hari@erplite.com's picture

OK, that worked ... ie got the success message "ctrl-c to terminate the webserver"....but when I tried the IP address of the pi in Chrome on my Android smartphone....message "IP..... refused to connect". Strange since I have no problem connecting via Putty from my Win10 laptop.

piborg's picture

That sounds strange, if the webserver is running you should be able to connect.

Does it work correctly from the browser on your laptop?

hari@erplite.com's picture

Did CTRL-C... and got a several termination messages with the last one being "Web-server terminated"....which proves that the web-server was running... when I tried to the IP from both my laptop and my Android. I can connect to other webservers like my router.

I have searched hi and low....and found no solutions to this problem. Any suggestions would be appreciated.

piborg's picture

The only problems I can think of are that the URL is not completely correct.
First check the webPort value in the script and that the URL is http not https.

For example if webPort is set to 80 and the IP address is 192.168.1.10 then the full URL should be: http://192.168.1.10:80

hari@erplite.com's picture

Brilliant!!! The webport was set to 8000.....and once set back to 80....the web page opened correctly.....and 4Borg was easily controlled via my android smartphone. Thank you very much for your fast, and very effective support.

I've got a similar error. I've tried using "sudo" as you suggested but I'm still getting an error?

pi@raspberrypi:~/Documents/projects/zeroborg $ python ZeroBorgWebUI.py
Loading ZeroBorg on bus 1, address 40
Found ZeroBorg at 40
ZeroBorg loaded on bus 1
Setup camera
Setup the stream processing thread
Wait ...
Setup the watchdog
Start the stream using the video port
Traceback (most recent call last):
File "ZeroBorgWebUI.py", line 336, in
httpServer = SocketServer.TCPServer(("0.0.0.0", webPort), WebServer)
File "/usr/lib/python2.7/SocketServer.py", line 420, in __init__
self.server_bind()
File "/usr/lib/python2.7/SocketServer.py", line 434, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 13] Permission denied
^C^C
^Z
[1]+ Stopped python ZeroBorgWebUI.py
pi@raspberrypi:~/Documents/projects/zeroborg $ sudo python ZeroBorgWebUI.py
Loading ZeroBorg on bus 1, address 40
Found ZeroBorg at 40
ZeroBorg loaded on bus 1
Setup camera
mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0x2539e20 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Traceback (most recent call last):
File "ZeroBorgWebUI.py", line 321, in
camera = picamera.PiCamera()
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 417, in __init__
self._init_preview()
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 496, in _init_preview
self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
File "/usr/lib/python2.7/dist-packages/picamera/renderers.py", line 512, in __init__
self.renderer.connect(source)
File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 1467, in connect
self._connection = MMALConnection(source, self.inputs[0])
File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 1280, in __init__
prefix="Failed to enable connection")
File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 157, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources (other than memory)

piborg's picture

The second error is slightly different to the first.

The second time (with sudo) fails on the line:

camera = picamera.PiCamera()

This is usually caused by another script using the camera or not having the camera connected.

I think what happened is the first run started using the camera, but it did not make it available again when it failed.

What I suggest you do is disconnect the Raspberry Pi power completely, then power it up and try running the script with sudo again before running anything else.

Your suggestion has helped thanks. I've now got the webserver running but the web interface seems to have lost it's style/images?

Images: 
piborg's picture

It looks like something is missing somewhere in the HTML code.

Are you able to view the HTML source sent to the browser?
It can usually be viewed from most browsers by right-clicking on the page and selecting an option named something like "View Source" or "Page source".

Subscribe to Comments for "4borg web ui permission denied error"