On Sep 18, 11:28 am, Ned Deily <[email protected]> wrote:
> In article <[email protected]>,
> Lawrence D'Oliveiro <[email protected]_zealand> wrote:
>
> > In message <[email protected]>, Ned Deily
> > wrote:
> > > try:
> > > importreadline
> > > except ImportError:
> > > print("Modulereadlinenot available.")
> > > else:
> > > import rlcompleter
> > > readline.parse_and_bind("tab: complete")
>
> > > Note the print() form which works with either Python 2 or 3.
> > You should be writing diagnostics to stderr, not stdout.
>
> In general, sure. Statements in a PYTHONSTARTUP file, like here, are
> only executed in interactive mode and it isn't likely that someone is
> going to be redirecting stdout or stderr; that would kind of defeat the
> purpose ofreadlinecompletion functions which is what this is all
> about. But, if you feel strongly about it, I'm sure a contributed patch
> to improve the rlcompleter documentation would be welcome.
>
> --
> Ned Deily,
> [email protected]
Hi, Thanks for the replies.
The issue isn't with readline. The readline module or rlcompleter
module are both available, and loading them has no effect on the
behavior of tab:
>>> import readline
[Now i hit tab...]
>>> ./
File "<stdin>", line 1
./
^
SyntaxError: invalid syntax
[Hit tab twice...]
>>> ./
./.bash_history ./.bash_profile ./.bash_profile.pysave
./.CFUserTextEncoding ./.cups ./.dropbox
./.DS_Store ./.fontconfig ./.ipython
./.lesshst ./.ssh ./.subversion
./.Trash ./.Xauthority ./
Desktop ./Documents ./
Downloads ./inputrc
./Library ./Movies ./
Music ./Pictures ./
Public ./python
./Sites
>>> ./
>>> import rlcompleter
>>> pri[TAB]--> completes
>>> if testvar:
... [one TAB: nothing], [two TABs: "Display all 179 possibilities y/
n?"] (Note: here i need it to insert a tab, just as it should!)
So this ostensibly makes it very hard to write or paste any code into
the command line!
any further ideas? Thanks again
~N
--
http://mail.python.org/mailman/listinfo/python-list