[IPython-user] pyreadline question

Jörgen Stenarson jorgen.stenarson at bostream.nu
Fri Mar 31 09:24:19 CST 2006


Hi Michael,

thanks for the report on problems with the doc I'll look into it over 
the weekend. I have also been thinking that there should be some way of 
specifying the location of the config file so I will look into that as 
well.

Ville, do you have any ideas on what would be the best way to support 
this in IPython?

/Jörgen

Michael Foord skrev:
> Michael Foord wrote:
>> Hello all,
>>
>> I'm updating Movable Python and am including pyreadline.
>>
>> First of all the instructions on installing from subversion seem to 
>> include an incorrect step.
>>
>>  From http://projects.scipy.org/ipython/ipython/wiki/PyReadline/Intro
>>
>>     "copy pyreadlineconfig.ini from pyreadline-egg/pyreadline/config"
>>
>> After running ``setup.py install`` I have a ``pyreadline/configuration`` 
>> directory which contains the ini file, but no ``pyreadline-egg`` 
>> directory and no ``config`` directory. I assume this is the right file 
>> anyway.
>>
>> The instructions say to copy this file to "your homedir". Movable Python 
>> is intended to be run from a USB stick on arbitrary computers, so I 
>> would like to be able to specify an alternative location for this file. 
>> How do I do this ?
>>
>> I don't mind patching the distribution, but I would prefer a better 
>> solution.
>>   
> I see that this file is used in rlmain.py.
> 
> Line 70 in __init__ :
> 
>             self.read_inputrc()
> 
> Line 1190 :
> 
>     def 
> read_inputrc(self,inputrcpath=os.path.expanduser("~/pyreadlineconfig.ini")):
> 
> Line 1234 in read_inputrc :
> 
>         if os.path.isfile(inputrcpath):
>             try:
>                 execfile(inputrcpath,loc,loc)
>             except Exception,x:
>                 import traceback
>                 print >>sys.stderr, "Error reading .pyinputrc"
>                 
> filepath,lineno=traceback.extract_tb(sys.exc_traceback)[1][:2]
>                 print >>sys.stderr, "Line: %s in file %s"%(lineno,filepath)
>                 print >>sys.stderr, x
>                 raise ReadlineError("Error reading .pyinputrc")
> 
> The quickest hack is for me to patch this to use an alternative 
> location. That's dirty though.
> 
> When Readline is instantiated there is no way for me to specify an 
> alternative location.
> 
> I don't instantiate Readline directly, because I use it through IPython. 
> It would be good to be able to programattically tell IPython where to 
> find this file (I have to calculate the location dynamically, because 
> the path will be different every time). IPython should then be able to 
> pass this to Readline.
> 
> What do you think ?
> 
> Fuzzyman
> http://www.voidspace.org.uk/python/index.shtml
> 
>> Thanks
>>
>> Fuzzyman
>> http://www.voidspace.org.uk/python/index.shtml
>>
>> _______________________________________________
>> IPython-user mailing list
>> IPython-user at scipy.net
>> http://scipy.net/mailman/listinfo/ipython-user
>>
>>   
> 
> _______________________________________________
> IPython-user mailing list
> IPython-user at scipy.net
> http://scipy.net/mailman/listinfo/ipython-user
> 




More information about the IPython-user mailing list