Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

automatically import modules upon interpreter invocation

149 views
Skip to first unread message

Daniel Fetchinson

unread,
Jun 25, 2008, 4:03:29 AM6/25/08
to pytho...@python.org
Hi folks, this seems like a very basic thing but I couldn't find a solution.
I always do the following after starting the python interpreter (on linux):

import rlcompleter
import readline
readline.parse_and_bind("tab: complete")

Is there a way of making python execute the above whenever it starts
up so that I don't have to type it all the time?

Cheers,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

Ken Seehart

unread,
Jun 25, 2008, 4:34:21 AM6/25/08
to Daniel Fetchinson, pytho...@python.org
Daniel Fetchinson wrote:
> Hi folks, this seems like a very basic thing but I couldn't find a solution.
> I always do the following after starting the python interpreter (on linux):
>
> import rlcompleter
> import readline
> readline.parse_and_bind("tab: complete")
>
> Is there a way of making python execute the above whenever it starts
> up so that I don't have to type it all the time?
>
> Cheers,
> Daniel
>
environment variable PYTHONSTARTUP can be set to a python file that runs
when you start the python interpreter

- Ken

Daniel Fetchinson

unread,
Jun 25, 2008, 4:44:16 AM6/25/08
to pytho...@python.org


Great, thanks!

Jeffrey Froman

unread,
Jun 26, 2008, 11:42:46 AM6/26/08
to
Daniel Fetchinson wrote:

> Is there a way of making python execute the above whenever it starts
> up so that I don't have to type it all the time?

Create a script containing these statements, and specify its location with
the PYTHONSTARTUP environment variable. Your script will run whenever
python starts.


Jeffrey

0 new messages