equivalent of source <file> in python?

Stefan Schwarzer sschwarzer at sschwarzer.net
Tue Aug 24 16:12:06 EDT 2010


Hi Astan,

On 2010-08-24 21:18, Astan Chee wrote:
> I'm trying to convert my tcsh script to python and am stuck at one part, 
> particularly the part of the script that looks like this:
> 
> #!/bin/tcsh
> setenv LSFLOG /var/tmp/lsf_log
> source /etc/setup
> unalias cp
> umask 0
> env >> ${AFLOG}
> 
> What is the equivalent of doing this in python2.5?

I guess it doesn't make sense to "translate" this to Python
line by line. For example, you can't "source" shell code
into a Python program. The above commands don't look as if
they were the purpose of the program, but rather mostly some
preparation/setup before solving the actual problem.

Maybe it's more helpful to tell us what you want to achieve
in the end and we might be able to make suggestions on that.

How long is the shell script and what's your Python code so
far?

Stefan



More information about the Python-list mailing list