# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2005 The Trustees of Princeton University
#
-# $Id: plcsh,v 1.5 2007/02/02 04:39:03 mlhuang Exp $
+# $Id$
#
import os
parser.print_help()
sys.exit(1)
-# If called by a script
-if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
+# If called by a script or api call is passed
+if len(sys.argv) > 1:
# Pop us off the argument stack
sys.argv.pop(0)
- execfile(sys.argv[0])
+ if os.path.exists(sys.argv[0]) and os.path.isfile(sys.argv[0]):
+ execfile(sys.argv[0])
+ else:
+ print eval(sys.argv[0])
+ sys.exit(0)
# Otherwise, run an interactive shell environment
else: