03-11-2015, 05:58 PM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Mar 2015
Device: Kobo mini
|
Python on mini, dies on import library
Trying to run Python for the first time on a Kobo mini.
I've backed up the SD card, installed telnet and python OK; I can do "Hello world". But Python dies silently if I attempt to import a library, anything other than 'sys'. Is there an obvious gotcha? Code:
[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 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'] >>> import pygame,os [root@(none) ~]# 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 urllib2 [root@(none) ~]# In other words, attempting to import sys works; attempting to import either of the two libraries used by weather.py fails immediately, and stops python. The above is from python shell, but the same happens in python scripts. I've tried deleting the .pyo and .pyc files for urllib2; then running the script that attempts to "import urllib2" again. The files were recreated, Python halted again. I'm hoping this is something obvious that I'm doing wrong.... what would it be? Any suggestions for how I can move forward? (Mini firmware is 3.4.1, btw.) Many thanks! |
03-12-2015, 11:52 AM | #2 |
Addict
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
|
Hmm, did you try this version of Python?
|
Advert | |
|
03-12-2015, 05:46 PM | #3 |
Junior Member
Posts: 3
Karma: 10
Join Date: Mar 2015
Device: Kobo mini
|
Hi Kevin, thanks so much for replying.
I copied the contents of that package over the /mnt/onboard/.python folder (that was created by installing your weather package), and it's definitely got me further. Running my test script (which interpolates print statements between the first half-dozen lines of weather.py) now gets as far as the second one, i.e. it succesfully executes "import urllib2", which it previously dies on. Although it still dies on "import pygame, os". But first things first - before getting that far, it reports two errors. Same thing occurs going to shell: Code:
[root@(none) koboWeather]# python Error processing line 1 of /mnt/onboard/.python/lib/python2.7/site-packages/._easy-install.pth: Traceback (most recent call last): File "/mnt/onboard/.python/lib/python2.7/site.py", line 156, in addpackage if not dircase in known_paths and os.path.exists(dir): File "/mnt/onboard/.python/lib/python2.7/genericpath.py", line 18, in exists os.stat(path) TypeError: must be encoded string without NULL bytes, not str Remainder of file ignored Error processing line 1 of /mnt/onboard/.python/lib/python2.7/site-packages/._setuptools.pth: Traceback (most recent call last): File "/mnt/onboard/.python/lib/python2.7/site.py", line 156, in addpackage if not dircase in known_paths and os.path.exists(dir): File "/mnt/onboard/.python/lib/python2.7/genericpath.py", line 18, in exists os.stat(path) TypeError: must be encoded string without NULL bytes, not str Remainder of file ignored Python 2.7.5 (default, Aug 1 2013, 23:18:00) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> Thanks for all you help, Ben |
03-13-2015, 11:45 AM | #4 |
Addict
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
|
That's a step in the right direction.
Copying the new python installation over the existing one might not be the best idea. I'd recommend deleting python entirely and then re-installing. There's a chance that some files from the old python install are interfering with the new python version. When it dies importing pygame and os, is it still completely quiet or is it printing an error? |
04-05-2015, 02:02 PM | #5 |
Junior Member
Posts: 8
Karma: 962
Join Date: Dec 2012
Device: Kindle paperwhite, Kobo Mini
|
Hi,
I also have a mini with firmaware 3.4.1 and have telnet and the python environment installed as per Kevins thread. I can import os, pygame and sys. I am new to Kobo development [just bought a mini 3 days ago and started trolling the forums for hacking and developing my own "apps" on the kobo] I'd like to use python and pyside for the "app" that get data/info over a network /tcp [from a raspberry pi ] and displays it in the gui/qt widgets of the app. I think the kobo mini is ideal for a home automation display unit. I have seen Marek mention that python and pyside can be used for drawing to the eink display. This is the piece of the puzzle I have not managed to see yet on the mobilereads forum. Is there a forum thread for this or come sample code? Pls help. Thanks in advance Jason |
Advert | |
|
04-10-2015, 11:02 AM | #6 | |
Addict
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
|
Quote:
There are a few threads in this forum with code to refresh the e-ink display. You can find compiled binaries ready to run in my original python package for Kobo. Someone posted source code for refreshing the display in this forum as well. |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using Calibre as a Python Library | dwyera | Development | 1 | 07-30-2012 07:17 AM |
[Old Thread] import library or export to single file add to existing library | PCreighton | Calibre | 4 | 04-10-2011 01:08 AM |
Can't import library books in reader library | missbrooklyn | Sony Reader | 7 | 04-08-2011 03:48 AM |
How do I import this library ? | Giuseppe Chillem | Library Management | 11 | 02-01-2011 05:10 PM |
Import ebook conversion in python script | erollisi | Calibre | 1 | 08-19-2010 09:43 PM |