writing command-line options into file

2011-03-14 Thread hiral
For following example, how to write command-line option OR metavar into file... parser.add_option("-opt1", metavar="MY_OPTION1", default=123) parser.add_option("-opt2", metavar="YOUR_OPTION2" ,default= "abc") parser.add_option('-opt3", metavar="FLAG", default=True) do we have any facility to writ

Re: pipe using python

2010-10-16 Thread hiral
I am planning to use python module if available. -- http://mail.python.org/mailman/listinfo/python-list

pipe using python

2010-10-16 Thread hiral
Hi, Like we 'named pipes', how we can achieve comminication between more than two processes. And how it can be scaled to remote machines? Any idea? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to display unicode char in Windows

2010-10-16 Thread hiral
On Oct 15, 11:38 pm, "Mark Tolonen" wrote: > "hiral" wrote in message > > news:90b62600-a0a4-47d5-bb6f-a3ae14cf6...@9g2000prn.googlegroups.com... > > > Hi, > > I tried... > > > > > # coding: latin-1 > > print "

Re: How to display unicode char in Windows

2010-10-16 Thread hiral
On Oct 15, 11:06 pm, John Nagle wrote: > On 10/15/2010 4:57 AM, hiral wrote: > > > Hi, > > I tried... > > > > > # coding: latin-1 > > print "**"

Re: How to display unicode char in Windows

2010-10-16 Thread hiral
On Oct 15, 5:24 pm, "Michel Claveau - MVP" wrote: > Hi! > > 1) the good syntax is: >     # -*- coding: latin-1 -*- >     print "**" >     oo = "ö" >     print "char=<%s>" % oo >     print "**

How to display unicode char in Windows

2010-10-15 Thread hiral
Hi, I tried... # coding: latin-1 print "**" oo = "ö" print "char=<%s>" % oo print "**" but it is not printing "ö" char;

Re: optparser: how to register callback to display binary's help

2010-10-15 Thread hiral
On Oct 13, 6:03 pm, Jean-Michel Pichavant wrote: > hiral wrote: > > Hi, > > > I want to display help message of python script and then display help > > message from the binary file (which also supports -h option): > > > Assumptions: > > 1) 'mybinary&#x

optparser: how to register callback to display binary's help

2010-10-13 Thread hiral
e", help="Execute binary", metavar="FILE") (options, args) = parser.parse_args() if options.file: subprocess.call(options.file) Requirement: $ python myscript.py -h Thank you in advance. -Hiral -- http://mail.python.org/mailman/listinfo/python-list

Seeking help with urllib2 response reading

2010-08-02 Thread Hiral Shah
s same API with java, everything is fine all time. I am unable to understand why read() method is changing server behavior!! Can anyone please guide me in same? Thank you so much for your time. Waiting for your reply. Thanks, Hiral -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess.Popen()/call() and appending file

2010-06-15 Thread hiral
On Jun 14, 7:11 pm, Kushal Kumaran wrote: > On Mon, Jun 14, 2010 at 7:01 PM,hiral wrote: > > Hi, > > > Do we have any facility to append file from Popen()/call(); see below > > example... > > > 1 import subprocess > > 2 f=open('log', 'w&#x

subprocess.Popen()/call() and appending file

2010-06-14 Thread hiral
Hi, Do we have any facility to append file from Popen()/call(); see below example... 1 import subprocess 2 f=open('log', 'w') 3 ...# writing some log-into into log file 4 p = subprocess.Popen(cmd, stdout=f, stderr=f) # (Q) 5 ...# do remaining stuff Q: At line# 4, the output of the 'cmd' will wip

subprocess.Popen()/call() and appending file

2010-06-14 Thread hiral
Hi, Do we have any facility to append file from Popen()/call(); see below example... 1 import subprocess 2 f=open('log', 'w') 3 ...# writing some log-into into log file 4 p = subprocess.Popen(cmd, stdout=f, stderr=f) # (Q) 5 ...# do remaining stuff Q: At line# 4, the output of the 'cmd' will wip

Re: Replace in large text file ?

2010-06-09 Thread hiral
On Jun 6, 7:27 am, Steve wrote: > On 5 June, 08:53, Steve wrote: > > > I am new to Python and am wanting  to replace characters in a very > > large text file.6 GB > > In plain language what I wish to do is: > > > Remove all comma's > > Replace all @ with comma's > > Save as a new file. > > >

Re: optparse: best way

2010-06-09 Thread hiral
I should specify them as seperate options like... > parser.add_option("-o', dest=exe_file...) > parser.add_option("-oexe', dest=exe_file...) > parser.add_option("-otxt', dest=txt_file...) > parser.add_option("-opdf', dest=pdf_file...) > parser.add_option("-oppt', dest=ppt_file...) Thank you in advance. -Hiral -- http://mail.python.org/mailman/listinfo/python-list

Re: optparse: best way

2010-06-09 Thread hiral
On Jun 8, 3:03 pm, Jean-Michel Pichavant wrote: > hiralwrote: > > Hi, > > > I am using optparser to do following... > > > Command syntax: > > myscript -o[exension] other_arguments > >     where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. > > > Now to parse this, I am doing following... > > >

optparse: best way

2010-06-08 Thread hiral
Hi, I am using optparser to do following... Command syntax: myscript -o[exension] other_arguments where; extension can be 'exe', 'txt', 'pdf', 'ppt' etc. Now to parse this, I am doing following... parser.add_option("-oexe', dest=exe_file...) parser.add_option("-otxt', dest=txt_file...) par

how to import subprocess into my 'subprocess.py' file

2010-05-05 Thread hiral
tandard module name) with custom methods? Thank you in advance. -Hiral -- http://mail.python.org/mailman/listinfo/python-list

Is there any module/utility like 'rsync' in python

2010-04-08 Thread hiral
Hi, Is there any module/utility like 'rsync' in python. Thank you in advance. -Hiral -- http://mail.python.org/mailman/listinfo/python-list

output from popen

2010-04-05 Thread hiral
Hi, I am trying following script...

Re: to create variable from dict

2010-03-15 Thread hiral
On Mar 12, 8:02 pm, Jean-Michel Pichavant wrote: > Luis M. González wrote: > > On Mar 12, 10:59 am,hiral wrote: > > >> Hi, > > >> Is there any way to create variables which name matches with dict key? > > >> For example: > >> dict1 = {"ab

Re: result of os.times() is different with 'time' command Options

2010-03-14 Thread hiral
On Mar 15, 7:14 am, Tim Roberts wrote: > hiral wrote: > >... > >Output: > >real    0.0m0.010002421s > >user    0.0m0.0s > >sys     0.0m0.0s > > >Command: > >$ time ls > > >Output: > >real    0m0.007s > >user    0m0.000s &g

to create variable from dict

2010-03-12 Thread hiral
Hi, Is there any way to create variables which name matches with dict key? For example: dict1 = {"abc":'1", "def":"2"} Now I am looking to have variable name abc and it's value be '1' etc. Pl. suggest. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

python module/utility equivalent to 'time' (linux) and/or 'ntimer'(Windows)

2010-03-12 Thread hiral
Hi, Is there any python module/utility available which would report the time same as 'time' command in linux and/or report time same as 'ntimer' utility in Windows. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

result of os.times() is different with 'time' command Options

2010-03-12 Thread hiral
Hi, Python version: 2.6 Script: def pt(start_time, end_time): def ptime(time, time_str): min, sec = divmod(time, 60) hr, min = divmod(min, 60) stmt = time_str + '\t' if hr: stmt += str(hr) + 'h' stmt += str(min) + 'm' + str(sec) + 's'