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 write

Re: How to display unicode char in Windows

2010-10-16 Thread hiral
On Oct 15, 5:24 pm, Michel Claveau - MVPenleverlesx_xx...@xmclavxeaux.com.invalid wrote: Hi! 1) the good syntax is:     # -*- coding: latin-1 -*-     print **     oo = ö     print char=%s % oo     print

Re: How to display unicode char in Windows

2010-10-16 Thread hiral
On Oct 15, 11:06 pm, John Nagle na...@animats.com wrote: On 10/15/2010 4:57 AM, hiral wrote: Hi, I tried... code # coding: latin-1 print ** oo = ö print char=%s % oo print

Re: How to display unicode char in Windows

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

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: 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

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 jeanmic...@sequans.com 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' - is linux executable file which

How to display unicode char in Windows

2010-10-15 Thread hiral
Hi, I tried... code # coding: latin-1 print ** oo = ö print char=%s % oo print ** /code but it is not printing ö char; any idea? Thank you. -Hiral -- http://mail.python.org/mailman

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

2010-10-13 Thread hiral
() if options.file: subprocess.call(options.file) Requirement: $ python myscript.py -h currently it prints the help message with '-e' and '-h' help message becides I want to display help message of 'mybinary' 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
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 kushal.kumaran+pyt...@gmail.com wrote: On Mon, Jun 14, 2010 at 7:01 PM,hiralhiralsmaill...@gmail.com wrote: 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

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

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

Re: optparse: best way

2010-06-09 Thread hiral
On Jun 8, 3:03 pm, Jean-Michel Pichavant jeanmic...@sequans.com 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

Re: optparse: best way

2010-06-09 Thread hiral
(-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: Replace in large text file ?

2010-06-09 Thread hiral
On Jun 6, 7:27 am, Steve vvw...@googlemail.com wrote: On 5 June, 08:53, Steve vvw...@googlemail.com 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

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...)

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

2010-05-05 Thread hiral
) 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-09 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
(0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (167major+23minor)pagefaults 0swaps As you can observe output of 'time' command got printed as garbage. Can you please let me know how can I get output of 'time' same as terminal. Thank you in advance. -Hiral -- http://mail.python.org/mailman

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

2010-03-15 Thread hiral
On Mar 15, 7:14 am, Tim Roberts t...@probo.com wrote: hiralhiralsmaill...@gmail.com wrote: ... Output: real    0.0m0.010002421s user    0.0m0.0s sys     0.0m0.0s Command: $ time ls Output: real    0m0.007s user    0m0.000s sys     0m0.000s Is this the intended behaviour? What

Re: to create variable from dict

2010-03-15 Thread hiral
On Mar 12, 8:02 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Luis M. González wrote: On Mar 12, 10:59 am,hiralhiralsmaill...@gmail.com wrote: 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

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'

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

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