The NZ Linux Resource

[AuckLUG] Readline and Python on SuSE 10.1

Neville C. Dempsey NevilleD.AuckLug at sgr-a.net
Mon Oct 23 22:14:17 NZDT 2006


Hi Marco,

On Sun, 2006-10-22 at 08:45 +1300, Marco Scuderi wrote:
> Hi there,
> I am fiddling with SuSe10.1 as a hobby but with some problems.
> One I cannot get pass is how to configure Python 2.4.3 to accept the module
> for readline 5.1.
> I assume I have installed readline correctly albeit I do not have a clue as
> how to verify it, but when launching Python I get an error message saying
> that there is no such a module called readline.
I use ScientificLinux/FermiLinux/RHEL4, but the following may help you
get a perspective.

Search for a module called readline.py, IIRC this links to the C library
libreadline.so.  

You can also use python directly to see if readline is visible.

nevilled at alfa:~ $ python
Python 2.5b3 (r25b3:51041, Aug 16 2006, 11:48:01)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
>>> dir(readline)
['__doc__', '__file__', '__name__', 'add_history', 'clear_history',
'get_begidx', 'get_completer', 'get_completer_delims',
'get_current_history_length', 'get_endidx', 'get_history_item',
'get_history_length', 'get_line_buffer', 'insert_text',
'parse_and_bind', 'read_history_file', 'read_init_file', 'redisplay',
'remove_history_item', 'replace_history_item', 'set_completer',
'set_completer_delims', 'set_history_length', 'set_startup_hook',
'write_history_file']
>>> readline.get_history_item(0)
>>> readline.get_history_item(1)
'import readline'
>>> readline.get_history_item(2)
'dir(readline)'
>>> readline.get_history_item(3)
'readline.get_history_item(0)'
>>> quit()

Points to note:
o you need to import readline (from the file readline.py or
readline.pyc) to be able to use the attributes.  ( eg add_history
etc...)
o You may need to set the search path to find the readline.py that come
with your distribution...  (but is should be already there as I believe
readline.py is in the "python" standard libraries.)
o once you import the module, you can query is contents from pythng
using the dir procedure.  eg dir(readline)

> I also noticed that when I install Python with """python setup.py install"""
> I get an error message about Python trying to rename the readline module
> because it was not properly loaded. It does not say what it has renamed it
> to :))
> 
> Any advice?
This COULD be that it is trying the create a readline.pyc from
readline.py, and your write permission are not right. 
> 
> Also, what should I do to get more accustomed to Linux? Over the past few
> years I have tried and always failed to install GRASS 5, R statistical
> software, f2c, SPE, and a number of other dependencies required for these
> packages. Not that I am giving up, but not being able to run a single
> software I would like to use, makes using Linux a bit hard.
> I tried attending the local LUGs when I was overseas and I was told my stuff
> was too obscure for them. I have attended an installfest only to be told
> they would only help with bistro installation, not specific packages.
> 
> What would you suggest I do now that I am back home?
What you kind of need to be given 
1) byte size linux problems to solve... and 
2) work up to more difficult problems.  
For example:
A) try setting up linux as per one of the linux training manuals, they
typically have about 10 chapters of fun an interesting things to do, and
worked/fmailir solutions so you don't get bogged down to anything too
obscure.
B) Think of some interesting project to work on.  (Lots of fun things
can be done on linux without having to fork out for software licenses)
C) then try you hand at helping other people solve their problem,  keep
an eye out for topics you are familiar with, that way you don't have to
suffer a learning curve to be helpful.
D) If you are lucky enough to find some on more expert on you pet topic,
team up with them, and get then to vet problem you are working on avoid
getting bogged down on anything too tough. 
E) Review the bugzilla for unfixed bugs... fix some bugs... make some
other bod happy :-)
X)pert: No instructions on what to do at this stage, after all you are
now the expert... :-)

BTW: I have complete stage B with python... I am happy to give you some
python tutorials and direction finders if you are keen, in the hope it
become a two way exchange. One graphical/windowing package I developed
used GTK and runs on Linux/Unix and Windows without modifications.  This
portability is perfect if you want to be able to be able to have access
to you efforts what ever OS platform is inflicted on you.  

Other interesting things that you can do python is target "jython", and
you applications will run under java also.  Nokia even has a phone that
has a python interpretor build in.  (I have not done these myself, but
the mind boggles....)  

Reg
NevilleD
> Thanks a lot,
> Marco
> 
> Mission Bay
> _______________________________________________
> AuckLUG mailing list
> AuckLUG at linux.net.nz
> http://www.linux.net.nz/cgi-bin/mailman/listinfo/aucklug




More information about the AuckLUG mailing list If you have any questions or comments about this page, email the Webmaster
Design Copyright © 1998-2005 Linux.net.nz