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 about. Heres and

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 > am talking about. Heres and

Re: Command line arguments in Windows

2008-03-04 Thread Steve Holden
Chris wrote: > On Mar 4, 8:38 am, "Mike Walker" <[EMAIL PROTECTED]> wrote: >>> If you run a python file, ie. just double clicking it the only >>> argument you will have will be the filename of the script. If you >>> create a shortcut to the script and in the target box add your >>> arguments (if y

Re: Command line arguments in Windows

2008-03-04 Thread Chris
On Mar 4, 8:38 am, "Mike Walker" <[EMAIL PROTECTED]> wrote: > > If you run a python file, ie. just double clicking it the only > > argument you will have will be the filename of the script. If you > > create a shortcut to the script and in the target box add your > > arguments (if you have quotati

Re: Command line arguments in Windows

2008-03-03 Thread Mike Walker
"Mark Tolonen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > From the command line, the 'ftype' and 'assoc' commands can be used > view how an extension is handled: > > C:\>assoc .py > .py=Python.File > > C:\>ftype Python.File > Python.File="C:\Python25\python.exe" "%1" %

Re: Command line arguments in Windows

2008-03-03 Thread Mark Tolonen
"Mike Walker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> If you run a python file, ie. just double clicking it the only >> argument you will have will be the filename of the script. If you >> create a shortcut to the script and in the target box add your >> arguments (if yo

Re: Command line arguments in Windows

2008-03-03 Thread Mike Walker
> If you run a python file, ie. just double clicking it the only > argument you will have will be the filename of the script. If you > create a shortcut to the script and in the target box add your > arguments (if you have quotation marks place them after not inside) > you will see your arguments

Re: Command line arguments in Windows

2008-03-03 Thread Chris
On Mar 4, 7:12 am, "Mike Walker" <[EMAIL PROTECTED]> wrote: > I am having some problems with command line arguments in Windows. The same > code under Linux works fine. > > In Windows I only get one argument no matter how many arguments are passed > on the command line. I think there is some problem

Re: command-line arguments in IDLE

2007-11-07 Thread Tal Einat
Russ P. wrote: > Is it possible to pass command-line arguments when running a program > in IDLE? The "Run" menu does not seem to provide that option. Thanks. thunderfoot's workaround should work well, but requires changing the script. If you want IDLE environment, but don't mind running IDLE from

Re: command-line arguments in IDLE

2007-11-07 Thread [EMAIL PROTECTED]
On Nov 7, 6:27 am, "Russ P." <[EMAIL PROTECTED]> wrote: > Is it possible to pass command-line arguments when running a program > in IDLE? The "Run" menu does not seem to provide that option. Thanks. Can't you just fake the command line args by setting sys.argv? This isn't too sophisticated, but it

Re: command-line arguments in IDLE

2007-11-07 Thread Ginger
it does have one in activepython Thanks and Regards, Ginger - Original Message - From: "Russ P." <[EMAIL PROTECTED]> To: Sent: Wednesday, November 07, 2007 8:56 AM Subject: command-line arguments in IDLE > Is it possible to pass command-line arguments when running a program > in ID

Re: command line arguments using subprocess

2007-03-15 Thread Gabriel Genellina
En Wed, 14 Mar 2007 16:51:04 -0300, Jim <[EMAIL PROTECTED]> escribió: > I'm trying to use subprocess to drive a Perl script. I'm having some > trouble getting it to spot the command line arguments. Basically, if > I call subprocess(args).wait() where args has a second item, I can't > convince th

Re: Command line arguments on Vista

2007-01-16 Thread jmike
Thanks for the answers; that was the problem exactly. --JMike Duncan Booth wrote: > It sounds like the registry entry for running Python files is messed up. > Can you go to a command line and see what the command 'ftype Python.File' > displays? (Assuming that command lines and ftype still work

Re: Command line arguments on Vista

2007-01-13 Thread Gabriel Genellina
"Duncan Booth" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > It sounds like the registry entry for running Python files is messed up. > Can you go to a command line and see what the command 'ftype Python.File' > displays? (Assuming that command lines and ftype still work on V

Re: Command line arguments on Vista

2007-01-12 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > But on Windows Vista, when I run that command, I get > > there are 1 args > arg: printargs.py > > What's up with that? It sounds like the registry entry for running Python files is messed up. Can you go to a command line and see what the command 'ftype Pyth

Re: Command line arguments on Vista

2007-01-12 Thread jmike
Some further information: perl seems to do the same thing (losing arguments). We think it may have something to do with file association. Any ideas anyone? --JMike -- http://mail.python.org/mailman/listinfo/python-list

Re: Command line arguments on Vista

2007-01-12 Thread jmike
By the way, note that if I say (on Vista) python printargs.py booga -a wooga I get the desired output: > there are 4 args > arg: printargs.py > arg: booga > arg: -a > arg: wooga So the quesiton still stands, what's up with that? Thanks, --JMike -- http://mail.pytho

Re: Command line arguments question (Windows XP)

2006-03-21 Thread [EMAIL PROTECTED]
Ross Ridge wrote: > Tim Golden wrote: > > python.file="C:\Python24\python.exe" "%1" %* > > [EMAIL PROTECTED] wrote: > > So now I got to decide whether the file association should be > > set to "%2" "%3" "%4" "%5" "%6" "%7" "%8" "%9" and change the > > programs that count the arguments or set it to

Re: Command line arguments question (Windows XP)

2006-03-21 Thread Ross Ridge
Tim Golden wrote: > python.file="C:\Python24\python.exe" "%1" %* [EMAIL PROTECTED] wrote: > So now I got to decide whether the file association should be > set to "%2" "%3" "%4" "%5" "%6" "%7" "%8" "%9" and change the > programs that count the arguments or set it to "%*" and change > the programs

Re: Command line arguments question (Windows XP)

2006-03-21 Thread [EMAIL PROTECTED]
Tim Golden wrote: > [ezd] > > | # u.py > | import sys > | print 'args',sys.argv > | > | in "Command Prompt" window, with 2 command lines on 2 PCs: > | > | # Case (1L): > | C:\tmp> u.py a b c > | args ['C:\\tmp\\u.py'] > | > | # Case (1D): > | C:\tmp> u.py a b c > | args ['C:\\tmp\\u.py', 'a', 'b',

RE: Command line arguments question (Windows XP)

2006-03-21 Thread Tim Golden
[ezd] | # u.py | import sys | print 'args',sys.argv | | in "Command Prompt" window, with 2 command lines on 2 PCs: | | # Case (1L): | C:\tmp> u.py a b c | args ['C:\\tmp\\u.py'] | | # Case (1D): | C:\tmp> u.py a b c | args ['C:\\tmp\\u.py', 'a', 'b', 'c'] Almost certainly means that the associ

Re: command line arguments

2005-09-01 Thread Peter Hansen
Jon Hewer wrote: >>What's the purpose of this utility? Is it to do something with the URL? >>And the URL must always be specified? What about the name? Also >>mandatory, or optional? The relationship between the two? > > > its just a simple rss reader. i'm writing it almost purely just to >

Re: command line arguments

2005-09-01 Thread Jon Hewer
>What's the purpose of this utility? Is it to do something with the URL? >And the URL must always be specified? What about the name? Also >mandatory, or optional? The relationship between the two? its just a simple rss reader. i'm writing it almost purely just to get me using language (i'm le

Re: command line arguments

2005-08-31 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: > py>parser.add_option("-n", "--name", dest="name", action="store", > py> help="enter a name") > py>parser.add_option("-u", "--url", action="store", dest="url", > help = "enter an url") It's worth noting that this will have the same eff

Re: command line arguments

2005-08-31 Thread [EMAIL PROTECTED]
You also could opt for the OptionParser in optparse, it is quiet powerful, and you can keep your code clean. Your requirements would translate to something like: py>#!/usr/bin/env python py>"""show OptionParser py>""" py>from optparse import OptionParser py> py>def main(): py>parser = OptionPar

Re: command line arguments

2005-08-31 Thread Peter Hansen
Jon Hewer wrote: > i am writing a little script and currently implementing command line > arguments following the guide by mark pilgrim from dive into python; > > http://diveintopython.org/scripts_and_streams/command_line_arguments.html > > thats all fine, however i am not sure of the BEST way to

Re: Command Line arguments

2005-08-26 Thread Martin v. Löwis
Trent Mick wrote: >>I used the python2.4.MSI from python.org site (dated 3-6-05). I think this >>was the first time they went to MSI verses an exe based installer. >> >>it says Python 2.4 (#60 November 30th, 2004) when I start it. > > > I think Martin has been doing MSIs for a little bit longer t

Re: Command Line arguments

2005-08-26 Thread Trent Mick
[michael wrote] > >> I wonder why this was needed for 2.4 and not 2.2? I don't think it was > >> lingering things from old installs because it happened on a persons > >> computer that had never had any python installed before 2.4. > > [Trent] > > It might be due to a bug in the Python 2.4 install

Re: Command Line arguments

2005-08-26 Thread michael
On Thu, 25 Aug 2005 11:39:48 -0700, Trent Mick wrote: > [michael wrote] >> SOLVED! Thank you. >> >> I wonder why this was needed for 2.4 and not 2.2? I don't think it was >> lingering things from old installs because it happened on a persons >> computer that had never had any python installed bef

Re: Command Line arguments

2005-08-25 Thread Trent Mick
[michael wrote] > SOLVED! Thank you. > > I wonder why this was needed for 2.4 and not 2.2? I don't think it was > lingering things from old installs because it happened on a persons > computer that had never had any python installed before 2.4. It might be due to a bug in the Python 2.4 installer

Re: Command Line arguments

2005-08-25 Thread michael
On Thu, 25 Aug 2005 00:46:41 -0700, Tim Roberts wrote: > michael <[EMAIL PROTECTED]> wrote: > >>I have a question about Windows based python (2.4 and later). >> >>For example, if I make a script called test.py like so: >> >>import sys >>print sys.argv >> >>then run it: >> >>python test.py this is

Re: Command Line arguments

2005-08-25 Thread michael
On Thu, 25 Aug 2005 00:46:41 -0700, Tim Roberts wrote: > michael <[EMAIL PROTECTED]> wrote: > >>I have a question about Windows based python (2.4 and later). >> >>For example, if I make a script called test.py like so: >> >>import sys >>print sys.argv >> >>then run it: >> >>python test.py this is

Re: Command Line arguments

2005-08-25 Thread Tim Roberts
michael <[EMAIL PROTECTED]> wrote: >I have a question about Windows based python (2.4 and later). > >For example, if I make a script called test.py like so: > >import sys >print sys.argv > >then run it: > >python test.py this is a test > >I see a list with > >['test.py', 'this', 'is', 'a', 'test'