En Wed, 08 Jul 2009 14:23:54 -0300, Emile van Sebille
escribió:
On 7/8/2009 10:07 AM Lucas Junqueira said...
Hi, I'd like to run a simple windows command-line program from within
my python script and agt all the returt it generates. Is this possible?
How can I do it?
Depending on python
On 7/8/2009 10:07 AM Lucas Junqueira said...
Hi, I'd like to run a simple windows command-line program from within my
python script and agt all the returt it generates. Is this possible? How
can I do it?
Depending on python version, look into subprocess, commands or os.pipe
and related.
Emi
I think I found the problem. I recently removed Python 2.5 and
replaced it with 2.6. When I got in, I tried to run some django
commands and even they weren't producing output. On a hunch, I tried
to uninstall 2.6 and reinstall it, since now even django wasn't
producing output. When I tried, it told
On Mar 31, 9:57 am, JonathanB wrote:
> On Mar 30, 6:28 pm, John Machin wrote:
>
> > On Mar 31, 8:37 am, Irmen de Jong wrote:
> > > Does just typing:
>
> > > python
>
> Yes, just typing python takes me to my interactive prompt
>
> > > Or do you have a module in your E:\Python\dev directory cal
On Mar 31, 11:42 am, Terry Reedy wrote:
> JonathanB wrote:
> > Ok, I'm sure this is really simple, but I cannot for the life of me
> > get any print statements from any of my python scripts to actually
> > print when I call them from the windows command line. What am I doing
> > wrong?
>
> > hello
JonathanB wrote:
Ok, I'm sure this is really simple, but I cannot for the life of me
get any print statements from any of my python scripts to actually
print when I call them from the windows command line. What am I doing
wrong?
hello.py:
print "Hello World!"
command line:
E:\Python\dev>python
#This is pyFind, a python replacement for find(1)
import os, sys, re, fnmatch
from os.path import join
from optparse import OptionParser
usage = "usage: %prog --name [directory1 directory2]"
parser = OptionParser(usage=usage)
parser.add_option("--regex", dest="regex",
help="REGEX MATCHING DOES NO
On Mar 30, 6:28 pm, John Machin wrote:
> On Mar 31, 8:37 am, Irmen de Jong wrote:
> > Does just typing:
>
> > python
Yes, just typing python takes me to my interactive prompt
> > Or do you have a module in your E:\Python\dev directory called 'os', 'sys'
> > or something
> > else that may cl
On Mar 31, 8:37 am, Irmen de Jong wrote:
> JonathanB wrote:
> > Ok, I'm sure this is really simple, but I cannot for the life of me
> > get any print statements from any of my python scripts to actually
> > print when I call them from the windows command line. What am I doing
> > wrong?
>
> > hell
JonathanB wrote:
Ok, I'm sure this is really simple, but I cannot for the life of me
get any print statements from any of my python scripts to actually
print when I call them from the windows command line. What am I doing
wrong?
hello.py:
print "Hello World!"
command line:
E:\Python\dev>python
Here's an example...
BEGIN TEST.PY
import sys
print "Original:", sys.argv
for arg in sys.argv:
arg = arg.strip('-\x93\x96') # add chars here you want to strip
print "Stripped:", arg
END TEST.PY
--
http://mail.python.org/mailman/listinfo/python-list
considering that all the command lines are in sys.argv, it's very
simple.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I think the lesson there is 'dont depend on getopt, write your own
> command line parser'. I always write my own, as it's so easy to do.
>
I suppose you built your own car so you could get out a bit, too? After
all, there's nothing tricky about a simple internal combust
[EMAIL PROTECTED] wrote:
> I think the lesson there is 'dont depend on getopt, write your own
> command line parser'. I always write my own, as it's so easy to do.
While I'll agree that getopt isn't ideal, I find optparse to be much better.
--
Benji York
--
http://mail.python.org/mailman/listinf
I think the lesson there is 'dont depend on getopt, write your own
command line parser'. I always write my own, as it's so easy to do.
--
http://mail.python.org/mailman/listinfo/python-list
MarkE wrote:
> The answer appears to be:
> An example command line for running the script was written in a word
> document. The "Autocorrect" (sic) feature in word replaces a normal
> dash
There is a lesson there I wish more people would learn: Word is not a
text editor. :)
--
Benji York
--
h
This was discovered after consultation with a colleague who shall
remain nameless but, well, nailed it basically.
The answer appears to be:
An example command line for running the script was written in a word
document. The "Autocorrect" (sic) feature in word replaces a normal
dash at least as I kno
I'm using getopt. I doubt getopt recognises \x96 as a command line
parameter prefix. I suppose I could iterate over sys.argv doing a
replace but that seems messy. I'd rather understand the problem.
That said, and me not understanding code pages that much, I chcp'd the
machines it works on both com
does it matter? Have it key off both "\x96" and "-".
--
http://mail.python.org/mailman/listinfo/python-list
I don't exactly know what is going on, but '\x96' is the encoding for
u'\N{en dash}' (a character that looks like the ASCII dash,
u'\N{hyphen-minus}', u'\x45') in the following windows code pages:
cp1250 cp1251 cp1252 cp1253 cp1254
cp1255 cp1256 cp1257 cp1258 cp874
Windows is clearly doing
20 matches
Mail list logo