Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

error when run as root #18

Closed
dauthiatull opened this issue Dec 7, 2013 · 5 comments
Closed

error when run as root #18

dauthiatull opened this issue Dec 7, 2013 · 5 comments

Comments

@dauthiatull
Copy link

using this on the raspberry pi
i can get it to work as user but need to run it as root so I can us the gpio eg;
sudo python myscript.py
but when run with sudo I get
Traceback (most recent call last):
File "testoui.py", line 10, in
env.start()
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/environment.py", line 66, in start
self._process_device(dev, cache=False)
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/environment.py", line 133, in _process_device
self.registry.register(device)
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/subscribe.py", line 29, in register
self._resubscribe(device.basicevent.eventSubURL)
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/subscribe.py", line 43, in _resubscribe
headers=headers)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 361, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 464, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 356, in send
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.0.191', port=49154): Max retries exceeded with url: /upnp/event/basicevent1 (Caused by <class 'socket.error'>: [Errno 111] Connection refused)

I can fix it by using sudo -E. this allows it to run correctly while allowing me to still access the gpio.

can you explain this to me. I am a complete noob.

@iancmcc
Copy link
Owner

iancmcc commented Dec 11, 2013

You sure it happens when you run it as root but not otherwise? Doesn’t make a lot of sense; that exception indicates that the device isn’t responding within the retry limit.

-- Ian

On Saturday, 7 December 2013 at 11:38, dauthiatull wrote:

using this on the raspberry pi
i can get it to work as user but need to run it as root so I can us the gpio eg;
sudo python myscript.py
but when run with sudo I get
Traceback (most recent call last):
File "testoui.py", line 10, in
env.start()
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/environment.py", line 66, in start
self.processdevice(dev, cache=False)
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/environment.py", line 133, in processdevice
self.registry.register(device)
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/subscribe.py", line 29, in register
self.resubscribe(device.basicevent.eventSubURL)
File "/usr/local/lib/python2.7/dist-packages/ouimeaux/subscribe.py", line 43, in _resubscribe
headers=headers)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 361, in request
resp = self.send(prep, *_sendkwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 464, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 356, in send
raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.0.191', port=49154): Max retries exceeded with url: /upnp/event/basicevent1 (Caused by : [Errno 111] Connection refused)
I can fix it by using sudo -E. this allows it to run correctly while allowing me to still access the gpio.
can you explain this to me. I am a complete noob.


Reply to this email directly or view it on GitHub (#18).

@dauthiatull
Copy link
Author

yes I had to run it as root because of the rpi gpio needs root but I would get that error unless I run it with
sudo -E to preserve the enviroment

@bradmccormick
Copy link

Same deal for me. I had a script running beautifully and it began failing after a couple of days. I changed it to run using the sudo -E switch and it now works flawlessly. I'm a noob, too, though, so I can't explain it.

@iancmcc
Copy link
Owner

iancmcc commented Jan 7, 2014

Taking a look at this shortly. I'll be doing a largish release in the next week. — Ian

On Sat, Jan 4, 2014 at 2:50 PM, bradmccormick [email protected]
wrote:

Same deal for me. I had a script running beautifully and it began failing after a couple of days. I changed it to run using the sudo -E switch and it now works flawlessly. I'm a noob, too, though, so I can't explain it.

Reply to this email directly or view it on GitHub:
#18 (comment)

@iancmcc iancmcc added the bug label Mar 24, 2014
@iancmcc iancmcc modified the milestone: v0.8 Mar 24, 2014
@iancmcc iancmcc modified the milestones: v0.8, 0.7.3 Aug 10, 2014
@iancmcc
Copy link
Owner

iancmcc commented Aug 11, 2014

I'm pretty sure this happened because you had good cache as one user and bad cache as root. So when you didn't do -E, $HOME was /root and it would use the bad cache. In which case, it's roughly a dupe of #26 and is thereby fixed. Please reopen if it recurs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants