4borg web ui permission denied error
Forums:
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
Fri, 09/16/2016 - 10:05
Permalink
Network permissions
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
Fri, 09/16/2016 - 15:22
Permalink
progress but ....refused to connect
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
Fri, 09/16/2016 - 16:36
Permalink
refused to connect
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
Fri, 09/16/2016 - 17:44
Permalink
webserver running...but
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
Fri, 09/16/2016 - 18:02
Permalink
Check the full URL is okay
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 ishttp
nothttps
.For example if
webPort
is set to80
and the IP address is192.168.1.10
then the full URL should be:http://192.168.1.10:80
hari@erplite.com
Fri, 09/16/2016 - 18:44
Permalink
Eureka!!!
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.
shreyas@shreyas...
Sat, 01/14/2017 - 11:54
Permalink
Similar error not fixed by using sudo
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
Sat, 01/14/2017 - 20:33
Permalink
Error using sudo
The second error is slightly different to the first.
The second time (with
sudo
) fails on the line: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.shreyas@shreyas...
Sat, 01/14/2017 - 22:22
Permalink
Your suggestion has helped
Your suggestion has helped thanks. I've now got the webserver running but the web interface seems to have lost it's style/images?
piborg
Mon, 01/16/2017 - 12:24
Permalink
Something is missing
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".