I have a script that processes command line arguments
def main(argv=None):
syslog.syslog(Sparkler stared processing)
if argv is None:
argv = sys.argv
if len(argv) != 2:
syslog.syslog(usage())
else:
r = parseMsg(sys.argv[1])
syslog.syslog(r)
On 10/06/2011 18:21, Mark Phillips wrote:
I have a script that processes command line arguments
def main(argv=None):
syslog.syslog(Sparkler stared processing)
if argv is None:
argv = sys.argv
if len(argv) != 2:
syslog.syslog(usage())
else:
r =
On Fri, Jun 10, 2011 at 10:41 AM, MRAB pyt...@mrabarnett.plus.com wrote:
On 10/06/2011 18:21, Mark Phillips wrote:
I have a script that processes command line arguments
def main(argv=None):
syslog.syslog(Sparkler stared processing)
if argv is None:
argv = sys.argv
if
On Fri, Jun 10, 2011 at 12:58 PM, Mark Phillips
m...@phillipsmarketing.biz wrote:
How do I write my script so it picks up argument from the output of commands
that pipe input into my script?
def main():
import sys
print sys.stdin.read()
if __name__ == '__main__':
main()
$ echo
On Fri, Jun 10, 2011 at 11:03 AM, Dennis daoden...@gmail.com wrote:
On Fri, Jun 10, 2011 at 10:58 AM, Mark Phillips
m...@phillipsmarketing.biz wrote:
On Fri, Jun 10, 2011 at 10:41 AM, MRAB pyt...@mrabarnett.plus.com wrote:
On 10/06/2011 18:21, Mark Phillips wrote:
How do I write my script
On 06/10/2011 12:58 PM, Mark Phillips wrote:
How do I write my script so it picks up argument from the
output of commands that pipe input into my script?
You can check
if os.isatty(sys.stdin): # -- this check
do_stuff_with_the_terminal()
else:
read_options_from_stdin()
-tkc
On Fri, Jun 10, 2011 at 11:03 AM, Kurt Smith kwmsm...@gmail.com wrote:
On Fri, Jun 10, 2011 at 12:58 PM, Mark Phillips
m...@phillipsmarketing.biz wrote:
How do I write my script so it picks up argument from the output of
commands
that pipe input into my script?
def main():
import sys
On 6/10/11 12:58 PM, Mark Phillips wrote:
On Fri, Jun 10, 2011 at 10:41 AM, MRAB pyt...@mrabarnett.plus.com
mailto:pyt...@mrabarnett.plus.com wrote:
On 10/06/2011 18:21, Mark Phillips wrote:
I have a script that processes command line arguments
def main(argv=None):
On Jun 10, 2011 10:26 AM, Mark Phillips m...@phillipsmarketing.biz
wrote:
I have a script that processes command line arguments
def main(argv=None):
syslog.syslog(Sparkler stared processing)
if argv is None:
argv = sys.argv
if len(argv) != 2:
On Fri, Jun 10, 2011 at 11:58 AM, Mark Phillips
m...@phillipsmarketing.biz wrote:
\
Kurt,
How does one write a main method to handle both command line args and stdin
args?
Here is what I came up with:
The one weird thing, the line from above didn't seem to work so I changed it
if
On Fri, Jun 10, 2011 at 1:33 PM, Dennis daoden...@gmail.com wrote:
On Fri, Jun 10, 2011 at 11:58 AM, Mark Phillips
fred
['alice']
fred
Just realized the if/else will have to be changed slightly if we want
to output both argv and stdin.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Jun 10, 2011 at 11:31 AM, Tim Chase
python.l...@tim.thechases.com wrote:
On 06/10/2011 12:58 PM, Mark Phillips wrote:
How do I write my script so it picks up argument from the
output of commands that pipe input into my script?
You can check
if os.isatty(sys.stdin): # -- this
On 06/10/2011 04:00 PM, Benjamin Kaplan wrote:
On Fri, Jun 10, 2011 at 11:31 AM, Tim Chase
if os.isatty(sys.stdin): #-- this check
Any reason for that over sys.stdin.isatty()?
my knowledge of os.isatty() existing and my previous lack of
knowledge about sys.stdin.isatty()
:)
-tkc
On 10/06/11 20:03:44, Kurt Smith wrote:
On Fri, Jun 10, 2011 at 12:58 PM, Mark Phillips
m...@phillipsmarketing.biz wrote:
How do I write my script so it picks up argument from the output of commands
that pipe input into my script?
def main():
import sys
print sys.stdin.read()
if
14 matches
Mail list logo