I'm both a Python noob and a Kobo noob (I just bought a mini mainly in the hope of running a version of this script).
Followed all instructions for backing up SD card, installing telnet, installing python and weather package OK. When I ran weather.sh for the first time it prompted for my location but then just stopped with no further output.
Using God's Own Debugging Technique (i.e. lots of print statements) I established that it dies somewhere in the first line of weather.py, i.e. "import urllib2". If I swap the first two lines around, it instead dies on "import pygame, os".
Some mucking about with test files established that a simple syntax error gave a nice Python error message, as I'd hope; and that attempting to import a made-up library also gave a proper error message, e.g. "ImportError: No module named horse", which suggested to me that this wasn't just a matter of paths (but what do I know?).
FWIW:
Code:
[root@(none) ~]# echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin
I also read a bit of Python docs, went into the Python shell and did
Code:
>>> import sys
>>> sys.path
['', '/mnt/onboard/.python/lib/python27.zip', '/mnt/onboard/.python/lib/python2.7', '/mnt/onboard/.python/lib/python2.7/plat-linux2', '/mnt/onboard/.python/lib/python2.7/lib-tk', '/mnt/onboard/.python/lib/python2.7/lib-old', '/mnt/onboard/.python/lib/python2.7/lib-dynload', '/mnt/onboard/.python/lib/python2.7/site-packages']
At this point, now I knew about the Python shell, I thought I could try importing the relevant libraries in there to see what happened:
Code:
>>> import pygame,os
[root@(none) ~]# python
Python 2.7.2 (default, Feb 4 2012, 12:18:06)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame,os
[root@(none) ~]# python
Python 2.7.2 (default, Feb 4 2012, 12:18:06)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame, os
[root@(none) ~]#
In other words, attempting to import sys works; attempting to import either of the two libraries used by weather.py fails immediately stops python.
I'm hoping this is something obvious that I'm doing wrong.... what would it be?
many thanks in advance.