![]() |
#1 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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.. |
![]() |
![]() |
![]() |
#2 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 348
Karma: 209937
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 |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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]# |
![]() |
![]() |
![]() |
#4 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 348
Karma: 209937
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?
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,278
Karma: 78869092
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
Do you mean instructions from https://www.mobileread.com/forums/sho...d.php?t=194376 or the newer https://www.mobileread.com/forums/sho...d.php?t=219173 ?
|
![]() |
![]() |
![]() |
#8 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 348
Karma: 209937
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.
|
![]() |
![]() |
![]() |
#9 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 09:29 AM. |
![]() |
![]() |
![]() |
#10 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
![]() |
![]() |
![]() |
#11 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 348
Karma: 209937
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.
|
![]() |
![]() |
![]() |
#12 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
|
that would be great..
|
![]() |
![]() |
![]() |
#13 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
|
This python package should work for you.
|
![]() |
![]() |
![]() |
#14 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 05:26 PM. |
![]() |
![]() |
![]() |
#15 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 348
Karma: 209937
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.
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Python help please | AndyW1691 | Library Management | 3 | 02-08-2012 09:51 AM |
What is python | The Terminator | General Discussions | 20 | 01-21-2011 12:58 PM |
Python 2.7 | DiapDealer | Calibre | 4 | 12-17-2010 11:19 AM |
PRS-900 Sony Digital Edition Library Install, and Install, ... | Hamlet53 | Sony Reader | 3 | 04-05-2010 03:29 PM |
Python 2.5 or 2.6? | itimpi | Calibre | 5 | 01-19-2009 12:48 PM |