On Tue, Mar 29, 2011 at 3:04 PM, Andrew Berg <bahamutzero8825 at gmail.com> wrote:
> First, what function should I use for easily executing Python scripts
> (during an interactive session)? Currently, I use
> subprocess.Popen(['python', 'script.py', 'arg1', 'arg2', 'argn'']), but
> it's a bit of a pain to type out a tuple.

One way is to use 'import', like so:

anthony at sudbury:~$ cat test.py
#!/usr/bin/env python

print "foo"
anthony at sudbury:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import test
foo
>>>
anthony at sudbury:~$

> Second, is there any way to have positional arguments listed before
> optional ones using argparse?

I'm pretty sure there is, but I'd have to look it up, and I'm feeling
equally lazy atm.  :P

 - Tony Yarusso