Call another file

Peter Hansen peter at engcorp.com
Fri May 10 22:50:09 EDT 2002


Catherine Yang wrote:
> 
> How to use Python to call another file, e.g. a SAS file *.sas ?

Well, since you don't usually "call" a file, you might get
a variety of helpful and unhelpful answers.

My try at being helpful is this:

import os
sasFileName = 'MYFILE.SAS'
os.system('sasapp.exe %s' % sasFileName)

In other words, I'm guessing you really want to call the
application that uses .SAS files, passing it the name
of the file in question.  Replace 'sasapp.exe' with the
appropriate path to the executable etc.

Or was I way off the mark here with my guess as to what
you're trying to do?

-Peter



More information about the Python-list mailing list