Chris F.A. Johnson cfajohnson at gmail.com
Sat Nov 19 06:55:58 CET 2005

On 2005-11-18, Belebele wrote:
>>From an interactive python shell, I execute the following:
>                 import os
>                 for line in os.popen('alias').readlines():
>                           print line
> No aliases are printed.
> I started python from an bash environment that had many aliases
> defined. I expected to see the list of aliases from within the
> interactive python shell.

    Since bash does not export aliases, they cannot be seen by a child

> What could I do to see those aliases defined in the shell from where
> I started python?

    Store them in a file before calling python, and read that file.

   Chris F.A. Johnson, author   |    <http://cfaj.freeshell.org>
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |          is released under the
   2005, Apress                 |     GNU General Public Licence

More information about the Python-list mailing list