Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-10-2013, 12:29 PM   #1
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
install pyserial on python 2.7.2

Hi guys

I am writing some code to talk to the serial port
I have installed the Kernal from XCSoar that gives me

/dev/ttyUSB0 when using USB OTG prolific usb-serial adapter

I can read and write to the serila port change baud rate etc via shell

But I want to do some serial stuff in python


the import serial command doesnt work ( as the 2.7.2 does have serial to import )

any suggestions..
fat265 is offline   Reply With Quote
Old 08-10-2013, 01:28 PM   #2
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 342
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
PySerial be installed very easily, just run this command on your Kobo in your Python bin directory:
Code:
./python2.7 ./pip install pyserial
KevinShort is offline   Reply With Quote
 
Advertisement
Old 08-10-2013, 02:01 PM   #3
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I normally run python scripts like this

python script.py or
./script.py

python is found in /mnt/onboard/.python
the executable is in /usr/bin

if i run you example ( ./python2.7 ./pip install pyserial )

It doesn't work because I don't have pip

but I can run this but get error ??? see below



[root@(none) bin]# python install pyserial
File "install", line 1
SyntaxError: Non-ASCII character '\xa0' in file install on line 2, but no encodi
ng declared; see http://www.python.org/peps/pep-0263.html for details
[root@(none) bin]#
fat265 is offline   Reply With Quote
Old 08-10-2013, 02:05 PM   #4
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I did this also but no go

ln -s /mnt/onboard/.python/bin/python2.7 /usr/bin/python2.7
fat265 is offline   Reply With Quote
Old 08-10-2013, 02:09 PM   #5
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 342
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Do you have pip in the python bin directory? How did you install python on your Kobo?
KevinShort is offline   Reply With Quote
Old 08-10-2013, 02:23 PM   #6
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I dont have pip

I installed python following instructions from weather app

/mnt/onboard/.python

Then install-python.sh

Python and pygame work fine but no pip
fat265 is offline   Reply With Quote
Old 08-10-2013, 03:10 PM   #7
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 7,348
Karma: 46281507
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Do you mean instructions from http://www.mobileread.com/forums/sho...d.php?t=194376 or the newer http://www.mobileread.com/forums/sho...d.php?t=219173 ?
PeterT is offline   Reply With Quote
Old 08-10-2013, 04:15 PM   #8
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 342
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
If you're using the python installation from the weather app, then to install pySerial you'll have to download it from the internet and maybe also download and install setuptools on your Kobo. I didn't include pip in the weather app's python, only in my newer python package for firmware 2.6 and above.
KevinShort is offline   Reply With Quote
Old 08-10-2013, 06:37 PM   #9
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I am using older version weather app.

I will try the new version however i have several devices that have old firmware
So its handy to still use old python install because if i default my kobo the sercue version of firmware is older.

This way if i brick my glo or touch for example i can easily get it running by powering it uo while holding home or front light button


Some help re downloading pip would be good

I have internet access on my kobo via wifi so i can wget or ftp stuff directky if needed


Still learning linux its been 20 years since i used linux

Last edited by fat265; 08-11-2013 at 10:29 AM.
fat265 is offline   Reply With Quote
Old 08-11-2013, 11:34 AM   #10
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I extracted pi pfrom youer new python install and ths is what i got

[root@(none) bin]# ./python ./pip install pyserial
Traceback (most recent call last):
File "./pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
[root@(none) bin]#


can i run pip from your recent python.zip file using older kobo firmware ?
because above is what I get
fat265 is offline   Reply With Quote
Old 08-11-2013, 04:15 PM   #11
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 342
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
I'm in the process of setting up a virtual debian armel machine, once I do I'll compile and upload python with pip for pre-2.6 firmware.
KevinShort is offline   Reply With Quote
Old 08-11-2013, 05:46 PM   #12
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
that would be great..
fat265 is offline   Reply With Quote
Old 08-12-2013, 08:19 PM   #13
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 342
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
This python package should work for you.
KevinShort is offline   Reply With Quote
Old 08-13-2013, 06:16 PM   #14
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
it works if i run python2.7 from cmd line

[root@(none) bin]# python2.7
Python 2.7.5 (default, Aug 12 2013, 15:43:02)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>


but when i run just python i get this

[root@(none) bin]# python
Traceback (most recent call last):
File "/mnt/onboard/.python/lib/python2.7/site.py", line 548, in <module>
main()
File "/mnt/onboard/.python/lib/python2.7/site.py", line 530, in main
known_paths = addusersitepackages(known_paths)
File "/mnt/onboard/.python/lib/python2.7/site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "/mnt/onboard/.python/lib/python2.7/site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/mnt/onboard/.python/lib/python2.7/site.py", line 231, in getuserbase
USER_BASE = get_config_var('userbase')
File "/mnt/onboard/.python/lib/python2.7/sysconfig.py", line 516, in get_config_var
return get_config_vars().get(name)
File "/mnt/onboard/.python/lib/python2.7/sysconfig.py", line 449, in get_config_vars
import re
File "/mnt/onboard/.python/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/mnt/onboard/.python/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/mnt/onboard/.python/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/mnt/onboard/.python/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
[root@(none) bin]#



if i run some of my existing code with that worked before hand with the only modiification being

#!/usr/bin/python2.7 on the first line

I get this

[root@(none) python]# ./dt2.py
Traceback (most recent call last):
File "./dt2.py", line 3, in <module>
import struct, pygame, os, sys, time, thread
File "/mnt/onboard/.python/lib/python2.7/site-packages/pygame/__init__.py", line 127, in <module>
from pygame.base import *
ImportError: ld-linux-armhf.so.3: cannot open shared object file: No such file or directory
[root@(none) python]#


Iany suggestions

P.S

thanks heaps you are a life saver \
hoping to re-pay the community with my own kobo hacking adventures
once i got everything working..


Last edited by fat265; 08-13-2013 at 06:26 PM.
fat265 is offline   Reply With Quote
Old 08-14-2013, 03:23 PM   #15
KevinShort
Addict
KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.KevinShort can program the VCR without an owner's manual.
 
KevinShort's Avatar
 
Posts: 342
Karma: 165069
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Hmm, I compiled in a virtual debian armel system, so I don't know why it's looking for something armhf related. I'll keep looking into it.
KevinShort is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Python help please AndyW1691 Library Management 3 02-08-2012 10:51 AM
What is python The Terminator General Discussions 20 01-21-2011 01:58 PM
Python 2.7 DiapDealer Calibre 4 12-17-2010 12:19 PM
PRS-900 Sony Digital Edition Library Install, and Install, ... Hamlet53 Sony Reader 3 04-05-2010 04:29 PM
Python 2.5 or 2.6? itimpi Calibre 5 01-19-2009 01:48 PM


All times are GMT -4. The time now is 08:18 PM.


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