Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-31-2013, 07:49 PM   #1
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Python for Kobo Firmware 2.6+

Python for Kobo devices running firmware 2.6 and newer.

Download Here


Usage
  • To install, just extract the zip file onto your Kobo.
  • For easy running of Python, create a symlink in /usr/bin to your Python binary:
    Code:
    ln -s <your python location>/bin/python2.7 /usr/bin/python
  • If you want to use Pygame, start Python like this:
    Code:
    LD_LIBRARY_PATH=<your python location>/pygamelibs/ python

Last edited by KevinShort; 08-03-2013 at 09:16 AM.
KevinShort is offline   Reply With Quote
Old 08-14-2013, 05:10 PM   #2
MarekGibek
Zealot
MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.
 
MarekGibek's Avatar
 
Posts: 129
Karma: 34471
Join Date: Aug 2013
Location: Cracow, Poland
Device: Kobo Touch N905C
Hi Kevin!

I'm really interested in running python (armhf version) and pygame. Your previous version worked perfect for me with software <= 2.5.2. But when I try this one with 2.8.1 - python console is starting but as soon as I type "import pygame" it crashes.

How did you prepare it? I would like to reproduce your steps. Did you compile it or did you take it from linux distribution - if yes, from which one?

Thanks,
Marek
MarekGibek is offline   Reply With Quote
Advert
Old 08-15-2013, 12:20 PM   #3
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Hi, Marek, do you not get any error message when python crashes? Did you make sure to set LD_LIBRARY_PATH to the location of the pygamelibs directory?

I compiled python inside a virtual armhf system. I used the directions here to set up a virtual raspberry pi. Another option is to grab the armhf packages from debian.
KevinShort is offline   Reply With Quote
Old 08-16-2013, 06:27 AM   #4
MarekGibek
Zealot
MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.
 
MarekGibek's Avatar
 
Posts: 129
Karma: 34471
Join Date: Aug 2013
Location: Cracow, Poland
Device: Kobo Touch N905C
Thank you Kevin! That's exactly what I wanted to know. It reports problem with importing time (time.so? - there is such library) even if I set LD_LIBRARY_PATH, but I'll try to recompile it myself - that should help. Thank you very much for directions!!
MarekGibek is offline   Reply With Quote
Old 08-18-2013, 04:54 PM   #5
Morg
Junior Member
Morg began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2012
Location: Germany
Device: Kobo Touch N905C
[edit]Download problem vanished. Will try installing...

Last edited by Morg; 08-18-2013 at 07:40 PM.
Morg is offline   Reply With Quote
Advert
Old 08-18-2013, 07:39 PM   #6
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Hi, Morg. The download is still working on my end. If you still can't get it to work I can upload the file somewhere else.
KevinShort is offline   Reply With Quote
Old 08-18-2013, 08:08 PM   #7
Morg
Junior Member
Morg began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2012
Location: Germany
Device: Kobo Touch N905C
Hi,

download works now - no idea why, though...

Trying to run python isn't too promising as yet...

I ran the "install-python.sh" script and exported LD_LIBRARY_PATH, giving /usr/lib as (additional) path as the installer moved the libraries there (right?)

Python crashes on "import pygame", although I don't understand why. Using verbose output, it stops working on

dlopen("/mnt/onboard/.python/lib/python2.7/lib-dynload/strop.so", 2);

The complete log is attached. I can't make out an error, so I have some problems understanding what is happening... any ideas?

Oh, Kobo Touch 905C, 2.8.1 with devpts/telnet/ftp enabled and nickel killed...
Attached Files
File Type: txt py.log.txt (16.1 KB, 470 views)

Last edited by Morg; 08-19-2013 at 01:52 AM.
Morg is offline   Reply With Quote
Old 08-19-2013, 12:59 PM   #8
MarekGibek
Zealot
MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.
 
MarekGibek's Avatar
 
Posts: 129
Karma: 34471
Join Date: Aug 2013
Location: Cracow, Poland
Device: Kobo Touch N905C
Yeah. Morg, that's exactly what I'm experiencing, too. I didn't have time to recompile it myself yet. But maybe this is something stupid...

The archive is in zip format. Maybe that's a problem? Maybe there is a problem with attributes (missing +x attribute somewhere) or links not handled properly (if there are any).
MarekGibek is offline   Reply With Quote
Old 08-19-2013, 02:25 PM   #9
Morg
Junior Member
Morg began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2012
Location: Germany
Device: Kobo Touch N905C
Hi,

my download was a .tgz file; anyway, correct ungzipping more or less proves data integrity. As the /mnt/onboard is a VFAT filesystem, links don't work anyway, and rights are the same for every file / directory.

We should be able to rule those out - especially, as the programs run as root.

The object library in question - strop.so - is existent, readable and seems ok (the file header, that is).

So - I'm guessing here - either it is not okay, because either compiling or linking went wrong, or there are other (internal?) problems concerning python internals, dynamic linking or something I don't seem to think about.

Python internals have evaded me so far, and I have no experience with cross-compiler-toolchains, so I couldn't say something about that.

I have been running compilers on ARM devices natively, but I don't feel ready yet to put up a complete compiler suite on the Kobo... :-)

Using web search a bit seems to find a lot of issues with python and dlopen(). Further investigation from my side is somewhat futile, as I'm not even able to recognize an error reported by python... or am I overlooking something?
Morg is offline   Reply With Quote
Old 08-19-2013, 02:42 PM   #10
MarekGibek
Zealot
MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.
 
MarekGibek's Avatar
 
Posts: 129
Karma: 34471
Join Date: Aug 2013
Location: Cracow, Poland
Device: Kobo Touch N905C
Or maybe we can try to extract needed files from debian packages first, before going through the compilation torture .

Quote:
Another option is to grab the armhf packages from debian.
MarekGibek is offline   Reply With Quote
Old 08-19-2013, 03:41 PM   #11
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by Morg View Post
I ran the "install-python.sh" script and exported LD_LIBRARY_PATH, giving /usr/lib as (additional) path as the installer moved the libraries there (right?)

Python crashes on "import pygame", although I don't understand why. Using verbose output, it stops working on

dlopen("/mnt/onboard/.python/lib/python2.7/lib-dynload/strop.so", 2);

The complete log is attached. I can't make out an error, so I have some problems understanding what is happening... any ideas?

Oh, Kobo Touch 905C, 2.8.1 with devpts/telnet/ftp enabled and nickel killed...
You don't need to use install-python.sh for this python package. I just downloaded my python package and put it on my Glo after a factory reset, and everything works fine. There must be something different about the Touch. Maybe if you ran strace on python we could get some more ideas.
KevinShort is offline   Reply With Quote
Old 08-19-2013, 04:42 PM   #12
Morg
Junior Member
Morg began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2012
Location: Germany
Device: Kobo Touch N905C
Kevin,

you're right about the installer - though everything it does is moving the pygame libraries to /usr/lib (so you wouldn't need LD_LIBRARY_PATH at all) and linking the executable to /usr/bin.

I ran

strace -v -o py-trace.txt python -v -v -v

and entered

import pygame

The result: (only last lines; I guess, the rest is not interesting...)

Code:
open("/mnt/onboard/.python/lib/python2.7/lib-dynload/strop.so", O_RDONLY|O_LARGEFILE) = 5
fstat64(5, {st_dev=makedev(179, 3), st_ino=456, st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=112, st_s
ize=56132, st_atime=2013/08/19-02:00:00, st_mtime=2012/02/04-22:19:44, st_ctime=2013/08/19-03:51:46}) = 0
write(2, "dlopen(\"/mnt/onboard/.python/lib"..., 70) = 70
futex(0x2aaf00a4, FUTEX_WAKE_PRIVATE, 2147483647) = 0
open("/mnt/onboard/.python/lib/python2.7/lib-dynload/strop.so", O_RDONLY|O_CLOEXEC) = 6
read(6, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\344\16\0\0004\0\0\0"..., 512) = 512
lseek(6, 49152, SEEK_SET)               = 49152
read(6, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1480) = 1480
lseek(6, 21012, SEEK_SET)               = 21012
read(6, "A-\0\0\0aeabi\0\1#\0\0\0\5ARM9TDMI\0\6\2\10\1\t\1"..., 46) = 46
exit_group(1)                           = ?
So as far as I can see, the lib strop.so is opened successfully, some bytes are read from ist (512, then 1480, then 46).

For some - unknown - reason, after exit_group the process stops.

Any further ideas how to use strace? I'd be glad to help.. :-)
Attached Files
File Type: txt py-trace.txt (131.8 KB, 476 views)
Morg is offline   Reply With Quote
Old 08-21-2013, 04:02 PM   #13
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
I don't know, morg. I don't have any other ideas at the moment.
KevinShort is offline   Reply With Quote
Old 11-09-2013, 04:15 PM   #14
MarekGibek
Zealot
MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.MarekGibek is out to avenge the death of his or her father, Domingo Montoya.
 
MarekGibek's Avatar
 
Posts: 129
Karma: 34471
Join Date: Aug 2013
Location: Cracow, Poland
Device: Kobo Touch N905C
I have pygame running along with kobo software 2.8.1.

Additional to Kevin's zip package I had to download and replace libs from debian wheezy (armhf):
- libsdl-mixer1.2 (http://packages.debian.org/wheezy/ar...er1.2/download)
- libts-0.0 (http://packages.debian.org/wheezy/ar...0.0-0/download)

After that "import pygame" works.

Don't think if it matters but I also upgrade python to 2.7.3 with python2.7-minimal from here: http://packages.debian.org/wheezy/ar...nimal/download.

But there is one problem: libpng and libjpeg from Kevin's package are not compatible with the ones from kobo's software (v2.8.1). If I use Kevin's versions loading images with pygame works but kobo software won't load. So I'm using kobo's versions and I had to convert all images which I am loading with pygame to BMP format.

I'm not entirely happy with it - it's a mess... but at least I was able to run my boot menu written in python without rewriting it or recompiling libs.
MarekGibek is offline   Reply With Quote
Old 11-17-2013, 05:21 AM   #15
Morg
Junior Member
Morg began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Dec 2012
Location: Germany
Device: Kobo Touch N905C
Hm...

I tried your tips on a spare SD card, and got it to work somehow. So I tried implementing it on my "live" SD, but systematically.

This meant:

Installing the koboPython-armhf.zip from the first post to /mnt/onboard/.python, _softlinking_ all pygame libs to /usr/lib, linking python2.7 to /usr/bin/python and running with

LD_LIBRARY_PATH=/usr/lib:/mnt/onboard/.python/lib:$LD_LIBRARY_PATH python

It worked - right out of the box and _before_ replacing the additional libs.. though I have no idea why it works now and not before...

Marek: what do you mean with "...but kobo software won't load"? My Touch works fine after installing python the described way...
Morg is offline   Reply With Quote
Reply

Tags
armhf, kobo, python


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kobo Firmware 2.6.1 MDK Kobo Reader 515 10-22-2013 06:40 PM
Glo Kobo Firmware 2.3.1 danskmacabre Kobo Reader 304 02-07-2013 01:52 AM
Touch Python/Pygame successfully running on Kobo Touch KevinShort Kobo Developer's Corner 18 10-24-2012 03:08 PM
kobo firmware The Terminator Kobo Reader 1 12-13-2010 06:26 PM
python command line tool for kobo reed Kobo Reader 2 06-05-2010 02:07 AM


All times are GMT -4. The time now is 01:37 PM.


MobileRead.com is a privately owned, operated and funded community.