zachfeldman/alexa-home

Weird output when I run chmod +x startupScript.sh && ./startupScript.sh

Closed this issue · 16 comments

Hi Zach,

From my R-Pi, when I run chmod +x startScript.sh && ./startupScript.sh, I get the following:

$ /home/pi/.rvm/gems/ruby-2.2.0/gems/hue-0.1.3/lib/hue/client.rb:20:in bridge': Hue::NoBridgeFound (Hue::NoBridgeFound) from /home/pi/.rvm/gems/ruby-2.2.0/gems/hue-0.1.3/lib/hue/client.rb:49:invalidate_user'
from /home/pi/.rvm/gems/ruby-2.2.0/gems/hue-0.1.3/lib/hue/client.rb:14:in initialize' from /home/pi/dev/alexa-home/modules/lights.rb:4:innew'
from /home/pi/dev/alexa-home/modules/lights.rb:4:in <top (required)="">' from app.rb:8:inrequire'
from app.rb:8:in <main>' "Error: Address family not supported by protocol - socket(2) for \"::1\" port 7055" watir-login.rb:80:inrescue in start_crawler': undefined method last_command' for nil:NilClass (NoMethodError) from watir-login.rb:74:instart_crawler'
from watir-login.rb:86:in `

'

Then I think the app.rb and watir-login.rb quits, because I run ps aux | grep ruby and those 2 are no longer showing.
original

Thanks!!!

Are you using the configuration file options as outlined in the README.md? Specifically the part that says:

" If you don't want to use all of the existing modules,"

I disabled all of the modules in the config.yml file by commenting out each of the modules.

When I go back to my Pi and run the startupScript.sh, I get the following:
pi@raspberrypi ~/dev/alexa-home $ ./startupScript.sh
pi@raspberrypi ~/dev/alexa-home $ app.rb:8:in <main>': undefined methodinclude?' for nil:NilClass (NoMethodError)
"Error: Address family not supported by protocol - socket(2) for "::1" port 7055"
watir-login.rb:80:in rescue in start_crawler': undefined methodlast_command' for nil:NilClass (NoMethodError)
from watir-login.rb:74:in start_crawler' from watir-login.rb:86:in

'

I enabled iriver just to test it and I get this now:

pi@raspberrypi ~/dev/alexa-home $ [2015-03-03 19:36:27] INFO WEBrick 1.3.1
[2015-03-03 19:36:27] INFO ruby 2.2.0 (2014-12-25) [armv6l-linux-eabihf]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2015-03-03 19:36:27] INFO WEBrick::HTTPServer#start: pid=2481 port=4567
"Error: Address family not supported by protocol - socket(2) for "::1" port 7055"
watir-login.rb:80:in rescue in start_crawler': undefined methodlast_command' for nil:NilClass (NoMethodError)
from watir-login.rb:74:in start_crawler' from watir-login.rb:86:in

'

Seems like Sinatra starts, but in Chrome I get:
GET http://localhost:4567/command?q=alexa%20what%20time%20is%20it&_=1425426466786 net::ERR_CONNECTION_REFUSED

Fixed the ""Error: Address family not supported by protocol - socket(2) for "::1" port 7055"" issue. Had to do with IPv6. You have to edit the /etc/hosts file (http://raspberrypi.stackexchange.com/questions/1868/ruby-and-selenium-webdriver-address-family-not-supported-by-protocol-socket)

/etc/hosts

127.0.0.1 localhost
#::1 localhost ip6-localhost ip6-loopback
#fe00::0 ip6-localnet
#ff00::0 ip6-mcastprefix
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters

127.0.1.1 raspberrypi

But now I get this:

pi@raspberrypi ~/dev/alexa-home $ [2015-03-03 19:53:53] INFO WEBrick 1.3.1
[2015-03-03 19:53:53] INFO ruby 2.2.0 (2014-12-25) [armv6l-linux-eabihf]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2015-03-03 19:53:54] INFO WEBrick::HTTPServer#start: pid=2451 port=4567
"Error: Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path="
watir-login.rb:80:in rescue in start_crawler': undefined methodlast_command' for nil:NilClass (NoMethodError)
from watir-login.rb:74:in start_crawler' from watir-login.rb:86:in

'

Ran: sudo apt-get install ice weasel and that fixed "Error: Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path="

Now I get:
pi@raspberrypi ~/dev/alexa-home $ [2015-03-03 20:42:18] INFO WEBrick 1.3.1
[2015-03-03 20:42:18] INFO ruby 2.2.0 (2014-12-25) [armv6l-linux-eabihf]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2015-03-03 20:42:18] INFO WEBrick::HTTPServer#start: pid=2442 port=4567
"Error: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)"
watir-login.rb:80:in rescue in start_crawler': undefined methodlast_command' for nil:NilClass (NoMethodError)
from watir-login.rb:74:in start_crawler' from watir-login.rb:86:in

'

Hey @hancho123 , I was pretty sure the last_command issue was solved in the most recent commit - when did you download the software here?

I downloaded the zip file maybe 2-3 days ago...

Actually this is probably unrelated. It seems like IceWeasel is having trouble starting up. Did you try restarting your Pi after installation? Can you start IceWeasel independent of the script?

I've restarted my Pi probably 20 times last night. haha.

I think for sure the app.rb is working fine.
pi@raspberrypi ~/dev/alexa-home $ ruby app.rb
[2015-03-04 00:30:46] INFO WEBrick 1.3.1
[2015-03-04 00:30:46] INFO ruby 2.2.0 (2014-12-25) [armv6l-linux-eabihf]
== Sinatra/1.4.5 has taken the stage on 4567 for development with backup from WEBrick
[2015-03-04 00:30:46] INFO WEBrick::HTTPServer#start: pid=2453 port=4567

But when I run watir-login.rb, that's where I run into the problems:
pi@raspberrypi ~/dev/alexa-home $ ruby watir-login.rb
"Error: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)"
watir-login.rb:80:in rescue in start_crawler': undefined methodlast_command' for nil:NilClass (NoMethodError)
from watir-login.rb:74:in start_crawler' from watir-login.rb:86:in

'

Not sure how to fix "Error: unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)".

How do I start IceWeasel? Sorry this is pretty new for me... Thanks for your help!

Not really sure how to start it from the command line, do some research. This looks to be a problem with starting IceWeasel from Watir though, not the code in this repository (but I could be wrong)

Nice, how?

haha... i gave up. Sorry!

No worries, as mentioned I don't think this is a problem with the library itself so probably best to close the issue anyway. If you take another stab at it feel free to post more errors!

Figured out the problem. I was suppose to run the ./startupScript.sh from the terminal while in the GUI.

Now when I run ./startupScript.sh, Iceweasel automatically pops up and fills the email and password. Stupid me! Thanks!

Awesome! Np.