Re: Python Command Line Arguments

2017-04-17 Thread breamoreboy
On Saturday, April 15, 2017 at 6:45:51 PM UTC+1, Grant Edwards wrote: > On 2017-04-14, Bernd Nawothnig wrote: > > > He should switch to argparse in any case because getopt is no longer > > supported and does only receive bugfixes. > > In my book, "receiving bug fixes" means it's still supported.

Re: Python Command Line Arguments

2017-04-17 Thread breamoreboy
ify it to what I need, it only half works. The problem is the > >> try/except. If you don't specify an input/output, they are blank at the end > >> but it shouldn't be. > >> > >> import getopt > >> import sys > > > > I am guessin

Re: Python Command Line Arguments

2017-04-15 Thread Grant Edwards
On 2017-04-14, Bernd Nawothnig wrote: > He should switch to argparse in any case because getopt is no longer > supported and does only receive bugfixes. In my book, "receiving bug fixes" means it's still supported. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Command Line Arguments

2017-04-14 Thread Bernd Nawothnig
u don't specify an input/output, they are blank at the end >> but it shouldn't be. >> >> import getopt >> import sys > > I am guessing you are wanting to parse command-line arguments rather than > particularly wanting to use the getopt module. >

Re: Python Command Line Arguments

2017-04-12 Thread ian . stegner
On Thursday, April 13, 2017 at 12:38:48 PM UTC+10, MRAB wrote: > On 2017-04-13 02:59, ian.steg...@gmail.com wrote: > > I have this code which I got from > > https://www.tutorialspoint.com/python/python_command_line_arguments.htm The > > example works fine but when I modify it to what I need, it o

Re: Python Command Line Arguments

2017-04-12 Thread MRAB
On 2017-04-13 02:59, ian.steg...@gmail.com wrote: I have this code which I got from https://www.tutorialspoint.com/python/python_command_line_arguments.htm The example works fine but when I modify it to what I need, it only half works. The problem is the try/except. If you don't specify an inp

Re: Python Command Line Arguments

2017-04-12 Thread Jason Friedman
ank at the end > but it shouldn't be. > > import getopt > import sys > Hello Ian, I am guessing you are wanting to parse command-line arguments rather than particularly wanting to use the getopt module. If I am correct you might want to spend your time instead learning the ar

Python Command Line Arguments

2017-04-12 Thread ian . stegner
I have this code which I got from https://www.tutorialspoint.com/python/python_command_line_arguments.htm The example works fine but when I modify it to what I need, it only half works. The problem is the try/except. If you don't specify an input/output, they are blank at the end but it shouldn

Re: Determine actually given command line arguments

2013-05-16 Thread Henry Leyh
On 16.05.2013 08:08, Jussi Piitulainen wrote: Henry Leyh writes: But now I would also like to be able to _write_ such a config file FILE that can be read in a later run. And FILE should contain only those arguments that were given on the command line. Say, I tell argparse to look for argument

Re: Determine actually given command line arguments

2013-05-15 Thread Jussi Piitulainen
Henry Leyh writes: > But now I would also like to be able to _write_ such a config file > FILE that can be read in a later run. And FILE should contain only > those arguments that were given on the command line. > > Say, I tell argparse to look for arguments -s|--sopt STRING, > -i|--iopt INT, -b

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 17:29, Roy Smith wrote: In article , Henry Leyh wrote: On 15.05.2013 14:24, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article , Henry Leyh wrote: >On 15.05.2013 14:24, Roy Smith wrote: >> In article , >> Henry Leyh wrote: >> >>> Is there a simple way to determine which >>> command line arguments were actually given on the commandline, i.e. does >>> argpa

Re: Determine actually given command line arguments

2013-05-15 Thread Skip Montanaro
> However, maybe I could ... ... switch to getopt? Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 16:08, Skip Montanaro wrote: Yes, I was trying that and it sort of works with strings if I use something sufficiently improbable like "__UNSELECTED__" as default. But it gets difficult with boolean or even number arguments where you just may not have valid "improbable" defaults.

Re: Determine actually given command line arguments

2013-05-15 Thread Wayne Werner
On Wed, 15 May 2013, Henry Leyh wrote: Yes, I was trying that and it sort of works with strings if I use something sufficiently improbable like "__UNSELECTED__" as default. But it gets difficult with boolean or even number arguments where you just may not have valid "improbable" defaults. You

Re: Determine actually given command line arguments

2013-05-15 Thread Skip Montanaro
> Yes, I was trying that and it sort of works with strings if I use something > sufficiently improbable like "__UNSELECTED__" as default. But it gets > difficult with boolean or even number arguments where you just may not have > valid "improbable" defaults. You could now say, so what, it's th

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 15:00, Oscar Benjamin wrote: On 15 May 2013 13:52, Henry Leyh wrote: On 15.05.2013 14:24, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does

Re: Determine actually given command line arguments

2013-05-15 Thread Oscar Benjamin
On 15 May 2013 13:52, Henry Leyh wrote: > On 15.05.2013 14:24, Roy Smith wrote: >> >> In article , >> Henry Leyh wrote: >> >>> Is there a simple way to determine which >>> command line arguments were actually given on the commandline, i.e. does &g

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 14:24, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know which of its namespace members were actually hit during parse_args(). I

Re: Determine actually given command line arguments

2013-05-15 Thread Jussi Piitulainen
Colin J. Williams writes: > On 15/05/2013 2:34 AM, Henry Leyh wrote: > > Hello, > > I am writing a program that gets its parameters from a combination > > of config file (using configparser) and command line arguments > > (using argparse). Now I would also lik

Re: Determine actually given command line arguments

2013-05-15 Thread Dave Angel
On 05/15/2013 08:24 AM, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know which of its namespace members were actually hit during parse_args(). I

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article , Henry Leyh wrote: > Is there a simple way to determine which > command line arguments were actually given on the commandline, i.e. does > argparse.ArgumentParser() know which of its namespace members were > actually hit during parse_args(). I think what you'

Re: Determine actually given command line arguments

2013-05-15 Thread Colin J. Williams
On 15/05/2013 2:34 AM, Henry Leyh wrote: Hello, I am writing a program that gets its parameters from a combination of config file (using configparser) and command line arguments (using argparse). Now I would also like the program to be able to _write_ a configparser config file that contains

Determine actually given command line arguments

2013-05-14 Thread Henry Leyh
Hello, I am writing a program that gets its parameters from a combination of config file (using configparser) and command line arguments (using argparse). Now I would also like the program to be able to _write_ a configparser config file that contains only the parameters actually given on

Re: Question About Command line arguments

2011-06-10 Thread Hans Mulder
On 10/06/11 20:03:44, Kurt Smith wrote: On Fri, Jun 10, 2011 at 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? def main(): import sys print sys.stdin.read() if __name__ == '__main__':

Re: Question About Command line arguments

2011-06-10 Thread Tim Chase
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 -

Re: Question About Command line arguments

2011-06-10 Thread Benjamin Kaplan
On Fri, Jun 10, 2011 at 11:31 AM, Tim Chase 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 check Any reason for

Re: Question About Command line arguments

2011-06-10 Thread Dennis
On Fri, Jun 10, 2011 at 1:33 PM, Dennis 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

Re: Question About Command line arguments

2011-06-10 Thread Dennis
On Fri, Jun 10, 2011 at 11:58 AM, Mark Phillips 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 os.isatty(sys.stdin): to this:

Re: Question About Command line arguments

2011-06-10 Thread Benjamin Kaplan
On Jun 10, 2011 10:26 AM, "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 l

Re: Question About Command line arguments

2011-06-10 Thread Robert Kern
On 6/10/11 12:58 PM, Mark Phillips wrote: On Fri, Jun 10, 2011 at 10:41 AM, MRAB 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): syslog.

Re: Question About Command line arguments

2011-06-10 Thread Mark Phillips
On Fri, Jun 10, 2011 at 11:03 AM, Kurt Smith wrote: > On Fri, Jun 10, 2011 at 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? > > def main(): >import sys >print sys.stdin.read() > > if

Re: Question About Command line arguments

2011-06-10 Thread Tim Chase
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 -

Re: Question About Command line arguments

2011-06-10 Thread Dennis
On Fri, Jun 10, 2011 at 11:03 AM, Dennis wrote: > On Fri, Jun 10, 2011 at 10:58 AM, Mark Phillips > wrote: >> On Fri, Jun 10, 2011 at 10:41 AM, MRAB wrote: >> >> On 10/06/2011 18:21, Mark Phillips wrote: > >> > How do I write my script so it picks up argument from the output of commands > that p

Re: Question About Command line arguments

2011-06-10 Thread Kurt Smith
On Fri, Jun 10, 2011 at 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? def main(): import sys print sys.stdin.read() if __name__ == '__main__': main() $ echo "fred" | python script.py fr

Re: Question About Command line arguments

2011-06-10 Thread Mark Phillips
On Fri, Jun 10, 2011 at 10:41 AM, MRAB 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:

Re: Question About Command line arguments

2011-06-10 Thread MRAB
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:

Question About Command line arguments

2011-06-10 Thread Mark Phillips
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]) syslo

Re: Parse config file and command-line arguments, to get a single collection of options

2011-05-28 Thread rzed
eel free to post answers on > that site > http://stackoverflow.com/questions/6133517/parse-config-file- > and-command-line-arguments-to-get-a-single-collection-of-optio>.) > This seems vaguely similar to a module I wrote and use all the time. It allows default value specification

Re: Parse config file and command-line arguments, to get a single collection of options

2011-05-25 Thread Raymond Hettinger
On May 25, 9:38 pm, Ben Finney wrote: > Howdy all, > > Python's standard library has modules for configuration file parsing > (configparser) and command-line argument parsing (optparse, argparse). I > want to write a program that does both, but also: > > * Has a cascade of options: default option

Parse config file and command-line arguments, to get a single collection of options

2011-05-25 Thread Ben Finney
ining StackOverflow points, I'm also asking this as a question there so feel free to post answers on that site http://stackoverflow.com/questions/6133517/parse-config-file-and-command-line-arguments-to-get-a-single-collection-of-optio>.) -- \ “Apologize, v. To lay the foundation

Re: Running a script with command line arguments

2011-05-02 Thread MRAB
> Hi, > I'm new to python and trying to run a borrowed script. The error I > get suggests that I need to give a proper command to run it. The > input file is "c26_1plus.csv" and the intended output file is > "c26_1plus_backbone.csv". > > Can anyone help? > The usage string in the script says that

Re: Ideas for a module to process command line arguments

2011-02-06 Thread Anjum Naseer
You may be interested in a little Python module I wrote to make handling of command line arguments even easier (open source and free to use) - http://freshmeat.net/projects/commando > On Tuesday, January 11, 2011 12:18 AM Sohail wrote: > Hey, every body has their own favorite method/w

Re: plac, the easiest command line arguments parser in the world

2011-02-06 Thread Anjum Naseer
You may be interested in a little Python module I wrote to make handling of command line arguments even easier (open source and free to use) - http://freshmeat.net/projects/commando > On Wednesday, June 02, 2010 12:37 AM Michele Simionato wrote: > I would like to announce to the wor

Re: Ideas for a module to process command line arguments

2011-01-13 Thread Michele Simionato
On Jan 12, 6:09 pm, Alice Bevan–McGregor wrote: > entirely sure what you mean by 'smart' options.  If your'e referring to > using a single hyphen and a list of characters to represent a long > option (which, to the rest of the world, use two leading hyphens) then > that's pretty weird.  ;) > > One

Re: Ideas for a module to process command line arguments

2011-01-12 Thread Alice Bevan–McGregor
On 2011-01-11 21:41:24 -0800, Michele Simionato said: Originally plac too was able to recognize flags automatically by looking at the default value (if the default value is a boolean then the option is a flag); however I removed that functionality because I wanted to be able to differentiate b

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 6:57 pm, Mike wrote: > On Jan 11, 11:26 am, Michele Simionato > wrote: > > In that case easy_install/pip/whatever will install the dependency > > automatically (who is installing > > dependencies by hand nowadays?). > > I do. Is this bad? :} You are simply spending more time than need

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 4:06 pm, Alice Bevan–McGregor wrote: > After looking into it, Plac's default help display isn't very helpful; > you need to massage your application a fair amount before generating > nice, complete-looking argument lists and such.  For example: > >         def main(verbose: ('prints mor

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Mike
On Jan 11, 11:26 am, Michele Simionato wrote: > > In that case easy_install/pip/whatever will install the dependency > automatically (who is installing > dependencies by hand nowadays?). More seriously I thought being based I do. Is this bad? :} -- http://mail.python.org/mailman/listinfo/python-

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 5:22 pm, Jean-Michel Pichavant wrote: > Michele Simionato wrote: > > On Jan 11, 4:06 pm, Alice Bevan McGregor wrote: > > >> Plac appears (from the documentation) to be written on top of argparse. > >>  :( > > > And the problem with that being what? > > ... not available to python 2.5 /

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Jean-Michel Pichavant
Michele Simionato wrote: On Jan 11, 4:06 pm, Alice Bevan–McGregor wrote: Plac appears (from the documentation) to be written on top of argparse. :( And the problem with that being what? ... not available to python 2.5 / 2.6 users :) JM -- http://mail.python.org/mailman/listinfo/

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 4:06 pm, Alice Bevan–McGregor wrote: > Plac appears (from the documentation) to be written on top of argparse. >  :( And the problem with that being what? -- http://mail.python.org/mailman/listinfo/python-list

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Alice Bevan–McGregor
On 2011-01-11 00:32:32 -0800, Michele Simionato said: It's a pity that the argument parsing modules in the standard library are so verbose that everybody is reinventing the same thing :-( It looks like you have reinvented plac: http://pypi.python.org/pypi/plac After looking into it, Plac's def

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Alice Bevan–McGregor
On 2011-01-11 00:32:32 -0800, Michele Simionato said: On Jan 11, 8:25 am, Alice Bevan–McGregor wrote: I got tired of using PasteScript and OptParse.  Mostly OptParse, actually.  :/ It's a pity that the argument parsing modules in the standard library are so verbose that everybody is reinvent

Re: Ideas for a module to process command line arguments

2011-01-11 Thread Michele Simionato
On Jan 11, 8:25 am, Alice Bevan–McGregor wrote: explicit callbacks or typecasting functions, etc. > > I got tired of using PasteScript and OptParse.  Mostly OptParse, actually.  :/ It's a pity that the argument parsing modules in the standard library are so verbose that everybody is reinventing

Re: Ideas for a module to process command line arguments

2011-01-10 Thread Alice Bevan–McGregor
On 2011-01-10 21:18:41 -0800, Sohail said: Hey, every body has their own favorite method/ways to process command line arguments. I've worked on a little CPython extension to handle command line arguments may be you'll find it interesting and useful Even I've implemente

Re: plac, the easiest command line arguments parser in the world

2010-06-04 Thread Kenny Meyer
3.1. > > With blatant immodesty, plac claims to be the easiest to use command > line arguments parser module in the Python world. Its goal is to > reduce the > learning curve of argparse from hours to minutes. It does so by > removing the need to build a command line arguments parser by

Re: plac, the easiest command line arguments parser in the world

2010-06-03 Thread Michele Simionato
On Jun 2, 6:37 am, Michele Simionato wrote: > I would like to announce to the world the first public release of > plac: > >  http://pypi.python.org/pypi/plac The second release is out. I have added the recognition of keyword arguments, improved the formatting of the help message, and added many t

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread alex23
Michele Simionato wrote: > It seems I have to take that claim back. A few hours after the > announce I was pointed out tohttp://pypi.python.org/pypi/CLIArgs > which, I must concede, is even easier to use than plac. It seems > everybody has written its own command line arguments parser

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Michele Simionato
On Jun 2, 6:37 am, Michele Simionato wrote: > With blatant immodesty, plac claims to be the easiest to use command > line arguments parser module in the Python world It seems I have to take that claim back. A few hours after the announce I was pointed out to http://pypi.python.org/pypi/C

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Michele Simionato
On Jun 2, 11:01 am, Stefan Behnel wrote: > I managed to talk a Java-drilled collegue of mine into > writing a Python script for a little command line utility, but he needed a > way to organise his argument extraction code when the number of arguments > started to grow beyond two. I told him that t

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Stefan Behnel
Paul Rubin, 02.06.2010 10:43: Tim Golden writes: pattern, which provides a minimally semi-self-documenting approach for positional args, but I've always found the existing offerings just a little too much work to bother with. I'll give plac a run and see how it behaves. After using optparse a

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Jean-Michel Pichavant
easiest to use command line arguments parser module in the Python world. Its goal is to reduce the learning curve of argparse from hours to minutes. It does so by removing the need to build a command line arguments parser by hand: actually it is smart enough to infer the parser from function annotations

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Michele Simionato
On Jun 2, 10:43 am, Paul Rubin wrote: > Tim Golden writes: > > pattern, which provides a minimally semi-self-documenting > > approach for positional args, but I've always found the existing > > offerings just a little too much work to bother with. > > I'll give plac a run and see how it behaves.

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Paul Rubin
Tim Golden writes: > pattern, which provides a minimally semi-self-documenting > approach for positional args, but I've always found the existing > offerings just a little too much work to bother with. > I'll give plac a run and see how it behaves. After using optparse a couple of times I got the

Re: plac, the easiest command line arguments parser in the world

2010-06-02 Thread Tim Golden
On 02/06/2010 05:37, Michele Simionato wrote: I would like to announce to the world the first public release of plac: http://pypi.python.org/pypi/plac Plac is a wrapper over argparse and works in all versions of Python starting from Python 2.3 up to Python 3.1. I like it. I'm a constant us

plac, the easiest command line arguments parser in the world

2010-06-01 Thread Michele Simionato
arguments parser module in the Python world. Its goal is to reduce the learning curve of argparse from hours to minutes. It does so by removing the need to build a command line arguments parser by hand: actually it is smart enough to infer the parser from function annotations. Here is a simple example

Re: passing command line arguments to executable

2010-04-06 Thread Bror Johansson
On 2010-04-03 18:09, mcanjo wrote: I have an executable (I don't have access to the source code) that processes some data. I double click on the icon and a Command prompt window pops up. The program asks me for the input file, I hit enter, and then it asks me for and output filename, I hit enter

Re: passing command line arguments to executable

2010-04-05 Thread Patrick Maupin
On Apr 5, 11:22 am, mcanjo wrote: > On Apr 4, 6:32 am, Simon Brunning wrote: > > > > > On 3 April 2010 18:20, mcanjo wrote: > > > > I tried doing the following code: > > > > from subprocess import Popen > > > from subprocess import PIPE, STDOUT > > > exefile = Popen('pmm.exe', stdout = PIPE, std

Re: passing command line arguments to executable

2010-04-05 Thread mcanjo
On Apr 4, 6:32 am, Simon Brunning wrote: > On 3 April 2010 18:20, mcanjo wrote: > > > I tried doing the following code: > > > from subprocess import Popen > > from subprocess import PIPE, STDOUT > > exefile = Popen('pmm.exe', stdout = PIPE, stdin = PIPE, stderr = > > STDOUT) > > exefile.communica

Re: passing command line arguments to executable

2010-04-04 Thread Joshua
On 4/3/10 12:09 PM, mcanjo wrote: I have an executable (I don't have access to the source code) that processes some data. I double click on the icon and a Command prompt window pops up. The program asks me for the input file, I hit enter, and then it asks me for and output filename, I hit enter a

Re: passing command line arguments to executable

2010-04-04 Thread Gabriel Genellina
put and standard error: there could > be some message that give you hints about the solution. To mcanjo: note that you didn't provide the second '\n' Also, are you sure the program does not accept command line arguments? Many do, and switch to interactive mode when no argument is provided. I'd try with -h /h --help /help -? /? -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list

Re: passing command line arguments to executable

2010-04-04 Thread Simon Brunning
On 3 April 2010 18:20, mcanjo wrote: > I tried doing the following code: > > from subprocess import Popen > from subprocess import PIPE, STDOUT > exefile = Popen('pmm.exe', stdout = PIPE, stdin = PIPE, stderr = > STDOUT) > exefile.communicate('MarchScreen.pmm\nMarchScreen.out')[0] > > and the Comm

Re: passing command line arguments to executable

2010-04-04 Thread Francesco Bochicchio
On 3 Apr, 19:20, mcanjo wrote: > On Apr 3, 11:15 am, Patrick Maupin wrote: > > > > > On Apr 3, 11:09 am, mcanjo wrote: > > > > I have an executable (I don't have access to the source code) that > > > processes some data. I double click on the icon and a Command prompt > > > window pops up. The p

Re: passing command line arguments to executable

2010-04-03 Thread Patrick Maupin
On Apr 3, 12:20 pm, mcanjo wrote: > On Apr 3, 11:15 am, Patrick Maupin wrote: > > > > > On Apr 3, 11:09 am, mcanjo wrote: > > > > I have an executable (I don't have access to the source code) that > > > processes some data. I double click on the icon and a Command prompt > > > window pops up. Th

Re: passing command line arguments to executable

2010-04-03 Thread mcanjo
On Apr 3, 11:15 am, Patrick Maupin wrote: > On Apr 3, 11:09 am, mcanjo wrote: > > > I have an executable (I don't have access to the source code) that > > processes some data. I double click on the icon and a Command prompt > > window pops up. The program asks me for the input file, I hit enter,

Re: passing command line arguments to executable

2010-04-03 Thread Simon Brunning
On 3 April 2010 17:09, mcanjo wrote: > I have an executable (I don't have access to the source code) that > processes some data. I double click on the icon and a Command prompt > window pops up. The program asks me for the input file, I hit enter, > and then it asks me for and output filename, I h

Re: passing command line arguments to executable

2010-04-03 Thread Patrick Maupin
On Apr 3, 11:09 am, mcanjo wrote: > I have an executable (I don't have access to the source code) that > processes some data. I double click on the icon and a Command prompt > window pops up. The program asks me for the input file, I hit enter, > and then it asks me for and output filename, I hit

passing command line arguments to executable

2010-04-03 Thread mcanjo
I have an executable (I don't have access to the source code) that processes some data. I double click on the icon and a Command prompt window pops up. The program asks me for the input file, I hit enter, and then it asks me for and output filename, I hit enter a second time and it goes off and doe

Re: How to pass Chinese characters as command-line arguments?

2010-01-31 Thread kj
In <7slr5ife6...@mid.uni-berlin.de> "Diez B. Roggisch" writes: >Am 31.01.10 16:52, schrieb kj: >> I want to pass Chinese characters as command-line arguments to a >> Python script. My terminal has no problem displaying these >> characters, and passing them

Re: How to pass Chinese characters as command-line arguments?

2010-01-31 Thread Diez B. Roggisch
Am 31.01.10 16:52, schrieb kj: I want to pass Chinese characters as command-line arguments to a Python script. My terminal has no problem displaying these characters, and passing them to the script, but I can't get Python to understand them properly. E.g. if I pass one such character t

How to pass Chinese characters as command-line arguments?

2010-01-31 Thread kj
I want to pass Chinese characters as command-line arguments to a Python script. My terminal has no problem displaying these characters, and passing them to the script, but I can't get Python to understand them properly. E.g. if I pass one such character to the simple script import sys

Re: Command line arguments??

2009-11-18 Thread Nobody
On Tue, 17 Nov 2009 23:57:55 +, Rhodri James wrote: >>> Quote the filenames or escape the spaces: >>> >>> C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt" >>> >>> We've been living with this pain ever since windowed GUIs encouraged >>> users >>> to put spaces in their file names (A

Re: Command line arguments??

2009-11-17 Thread greg
Rhodri James wrote: We've been living with this pain ever since windowed GUIs encouraged users to put spaces in their file names (Apple, I'm looking at you!). It's not really Apple's fault. There was no problem with spaces in filenames in the classic MacOS environment, because there was no tex

Re: Command line arguments??

2009-11-17 Thread Dave Angel
Nobody wrote: On Tue, 17 Nov 2009 11:47:46 -0800, Gerry wrote: How about this: lastarg = " ".join(sys.argv[2:]) What about it? IOW, why would you want to do that? Like many tricks, it'd work if several conditions applied: 1) there's exactly two arguments expected on the com

Re: Command line arguments??

2009-11-17 Thread Rhodri James
On Tue, 17 Nov 2009 19:26:46 -, Nobody wrote: On Mon, 16 Nov 2009 23:30:09 +, Rhodri James wrote: Quote the filenames or escape the spaces: C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt" We've been living with this pain ever since windowed GUIs encouraged users to put

Re: Command line arguments??

2009-11-17 Thread Nobody
On Tue, 17 Nov 2009 11:47:46 -0800, Gerry wrote: > How about this: > > lastarg = " ".join(sys.argv[2:]) What about it? IOW, why would you want to do that? -- http://mail.python.org/mailman/listinfo/python-list

Re: Command line arguments??

2009-11-17 Thread Gerry
On Nov 17, 2:26 pm, Nobody wrote: > On Mon, 16 Nov 2009 23:30:09 +, Rhodri James wrote: > > Quote the filenames or escape the spaces: > > > C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt" > > > We've been living with this pain ever since windowed GUIs encouraged users   > > to put s

Re: Command line arguments??

2009-11-17 Thread Nobody
On Mon, 16 Nov 2009 23:30:09 +, Rhodri James wrote: > Quote the filenames or escape the spaces: > > C:\Python26\Python.exe C:\echo.py "C:\New Folder\text.txt" > > We've been living with this pain ever since windowed GUIs encouraged users > to put spaces in their file names (Apple, I'm look

Re: Command line arguments??

2009-11-16 Thread rantingrick
On Nov 16, 5:30 pm, "Rhodri James" wrote: > We've been living with this pain ever since windowed GUIs encouraged users   > to put spaces in their file names (Apple, I'm looking at you!).   > Fundamentally, if people want the pretty they have to live with the   > consequences. Thanks everyone , p

Re: Command line arguments??

2009-11-16 Thread Rhodri James
On Mon, 16 Nov 2009 23:18:23 -, rantingrick wrote: I am currently having "fun" with command line arguments in a windows environment. If i get a path that has spaces anywhere in it my script gets the wrong arguments from sys.argv. You guy's probably know what i am talking a

Re: Command line arguments??

2009-11-16 Thread Benjamin Kaplan
On Mon, Nov 16, 2009 at 6:18 PM, rantingrick wrote: > I am currently having "fun" with command line arguments in a windows > environment. If i get a path that has spaces anywhere in it my script > gets the wrong arguments from sys.argv. You guy's probably know what i >

Command line arguments??

2009-11-16 Thread rantingrick
I am currently having "fun" with command line arguments in a windows environment. If i get a path that has spaces anywhere in it my script gets the wrong arguments from sys.argv. You guy's probably know what i am talking about. Heres and example. 'C:\\Python26\\Python.exe

Re: Raw command line arguments

2009-04-24 Thread Gabriel Genellina
En Fri, 24 Apr 2009 06:40:23 -0300, Enchanter escribió: How to pass the raw command line arguments to the python? That depends on the OS or the shell you're using. Such as: mypython.py txt -c "Test Only" {Help} The arguments I hope to get is: tx

Re: Raw command line arguments

2009-04-24 Thread Dave Angel
Enchanter wrote: How to pass the raw command line arguments to the python? Such as: mypython.py txt -c "Test Only" {Help} The arguments I hope to get is: txt -c "Test Only" {Help} -- Keep the quotation marks in the arguments. As

Re: Raw command line arguments

2009-04-24 Thread Chris Rebert
On Fri, Apr 24, 2009 at 2:40 AM, Enchanter wrote: > How to pass the raw command line arguments to the python? > > Such as: > >     mypython.py  txt -c "Test Only" {Help} > > > The arguments I hope to get is: > >              txt -c "Test Only" {He

Raw command line arguments

2009-04-24 Thread Enchanter
How to pass the raw command line arguments to the python? Such as: mypython.py txt -c "Test Only" {Help} The arguments I hope to get is: txt -c "Test Only" {Help} -- Keep the quotation marks in the arguments. -- http://mail.python.org/mai

Taking command line arguments from another program

2008-07-27 Thread aditya shukla
Hello folks ,I have a program in which a text file is generated as an output eg C:\prog\ prog -x test.txt Right now whenever i have to read the test file i have to put its name manually in my code. eg f=open("c:\\prog\\test.txt","r") How ever i want to add the name of the test file dynamically to

Re: Angle brackets in command-line arguments?

2008-07-16 Thread Keith Hughitt
> -- > >http://mail.python.org/mailman/listinfo/python-list > > In most Unix/Linux and related OS shells,  the angled brackets *do* > specify input and output streams as you surmise.  However, they are > *not* seen by the script  as command line arguments.  (And they are >

Re: Angle brackets in command-line arguments?

2008-07-16 Thread Gary Herron
seen by the script as command line arguments. (And they are *not* brackets, and do not need to be matched. ) For any command, cmd < file redirects the contents of file to cmd's standard input, which in Python is accessed by reading from sys.stdin (use input or raw_input or s

  1   2   >