On 5/28/2014 3:44 AM, onlyvin...@gmail.com wrote:
On Friday, January 19, 2001 1:22:23 AM UTC+5:30, Rolander, Dan wrote:
What is the best way to run a python script from within the interpreter?
What command should I use?
try using execfile(filename)
or in 3.x
with open(filename) as f: exec f
These both assume that you want to run the script in the same process as
the interpreter and within the module containing the statement. This is
rare. People usually either want to import into a separate module or run
in a separate process. For the latter, use the subprocess module and the
same command line that you would use in a console.
Terry Jan Reedy