I am having a problem and since I don't really know much about Python, I would appreciate the help of someone else to help me understand what my problem is.
I am building a Portable Wireless Radio. The Raspberry Pi utilizes Pianobar to go out to the Pandora servers, log in to my account, get my stations, and then begin playing the first one.
I am following the official Adafruit guide: https://learn.adafruit.com/pi-wifi-radio/overview
I have followed the guide all the way up until Pianobar was working. I am able to run "pianobar" from the command line. It connects and begins playing music in less than 10 seconds.
However, when I start the script that allows the 16x2 LCD Keypad to interface with pianobar, it doesn't work.
More specifically, it gets through the first half of the script. The LCD displays the IP address and says "Retrieving Station List...". After 10 seconds, the script exits with all of this.
pi@pandora ~/Python-WiFi-Radio $ sudo python PiPhi.py
Spawning pianobar...
Receiving station list...
Traceback (most recent call last):
File "PiPhi.py", line 288, in <module>
stationList, stationIDs = getStations()
File "PiPhi.py", line 190, in getStations
pianobar.expect('Select station: ', timeout=10)
File "/usr/local/lib/python2.7/dist-packages/pexpect.py", line 1311, in expect
return self.expect_list(compiled_pattern_list, timeout, searchwindowsize)
File "/usr/local/lib/python2.7/dist-packages/pexpect.py", line 1325, in expect_list
return self.expect_loop(searcher_re(pattern_list), timeout, searchwindowsize)
File "/usr/local/lib/python2.7/dist-packages/pexpect.py", line 1409, in expect_loop
raise TIMEOUT (str(e) + '\n' + str(self))
pexpect.TIMEOUT: Timeout exceeded in read_nonblocking().
<pexpect.spawn object at 0xb6b305b0>
version: 2.3 ($Revision: 399 $)
command: /usr/bin/sudo
args: ['/usr/bin/sudo', '-u', 'pi', 'pianobar']
searcher: searcher_re:
0: re.compile("Select station: ")
TIME: -03:35/03:43
TIME: -03:35/03:43
after: <class 'pexpect.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 2315
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
pi@pandora ~/Python-WiFi-Radio $
http://pastebin.com/6Lm3dTwx - THIS IS THE SCRIPT THAT I AM TRYING TO RUN
From my basic knowledge, it looks like it it taking longer than whatever timeout is to retrieve the station list. Please help me as I am completely lost. Thanks!
I had the same problem, for a low tech fix I just pinged google 10 times in the startup script. This gave the system long enough to get the network connection stabalized.