On Mar 14, 3:03 am, Roman Medina-Heigl Hernandez
wrote:
> Karthik Gurusamy escribió:
>
>
>
> > On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez
> > wrote:
> >> Hi,
>
> >> I'm experimenting with Python and I need a little help with this. Wh
On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez
wrote:
> Hi,
>
> I'm experimenting with Python and I need a little help with this. What I'd
> like is to launch an interactive shell, having the chance to send first
> several commands from python. I've written the following code:
>
> =
On Nov 6, 2:54 pm, Thomas Christensen <[EMAIL PROTECTED]>
wrote:
> This issue has been raised a couple of times I am sure. But I have yet
> to find a satisfying answer.
>
> I am reading from a subprocess and this subprocess sometimes hang, in
> which case a call to read() call will block indefinit
On Sep 30, 8:48 pm, Anh Khuong <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am using pexpect and I want to send output of pexpet to both stdout and log
> file concurrently.
> Anybody know a solution for it please let me know.
spawn class takes a 'logfile' parameter:
__init__(self, command, args=[],
On Sep 24, 6:27 pm, Tim Arnold <[EMAIL PROTECTED]> wrote:
> I have a bunch of processes to run and each one needs its own working
> directory. I'd also like to know when all of the processes are
> finished.
>
> (1) First thought was threads, until I saw that os.chdir was process-
> global.
> (2) Ne
On Aug 22, 1:51 pm, Sean DiZazzo <[EMAIL PROTECTED]> wrote:
> On Aug 22, 1:30 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > I'm working on acronlike functionality for my application.
> > The outer loops runs continuously wakin
On Sep 2, 7:16 am, topazcode <[EMAIL PROTECTED]> wrote:
> I am using the subprocess module to run some shell commands on a Linux
> system:
>
> import subprocess
> output = subprocess.call('''ssh server1 "uptime"''', shell=True)
>
> The above assigns the output variable with a return code, i.e. 0 in
Hi,
I'm working on a cron like functionality for my application.
The outer loops runs continuously waking every x seconds (say x=180,
300, ..).
It needs to know what events in cron has expired and for each event do
the work needed.
It's basically like unix cron or like a calendar application with
On May 1, 8:01 pm, Yves Dorfsman <[EMAIL PROTECTED]> wrote:
> In the following script, m1() and m2() work fine. I am assuming m2() is
> faster although I haven't checked that (loops through the list twice instead
> of once).
>
> Now what I am trying to do is something like m3(). As currently writte
On Apr 29, 6:29 pm, gert <[EMAIL PROTECTED]> wrote:
> Is this the best way to use ssh ?
> How can i use ssh keys instead of passwords ?
> I dont understand what happens when pid does not equal 0 , where does
> the cmd get executed when pid is not 0 ?
> How do you close the connection ?
>
> #http://
On Mar 3, 9:57 am, [EMAIL PROTECTED] wrote:
> Hi,
>
> I've seen several threads on this subject, but haven't (yet) run
> across one that answers my specific questions. This should be really
> easy for someone, so here goes:
>
> I'm running some numerical simulations under Ubuntu, and using Python
On Jan 31, 8:12 am, erikcw <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a list of numbers each with a +/- margin of error. I need to
> identify which ones overlab each other.
>
> For example:
> 55 +/- 3
> 20 +/- 2
> 17 +/- 4
> 60 +/- 3
>
> #base, max, min
> list = [
> (55, 58, 52),
> (20, 22, 18),
On Jan 27, 11:08 am, Olivier Lefevre <[EMAIL PROTECTED]> wrote:
> >> Indeed, if I do this interactively, I can tell after 3 lines that I've
> >> gotten all there is to get right now and the fourth readline() call
> >> hangs.
>
> > Can you really?
>
> Yes interactively: at the command prompt, you ca
On Jan 25, 11:59 pm, Paddy <[EMAIL PROTECTED]> wrote:
> On Jan 26, 5:43 am, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
>
> > Wondering if there is a way to measure a child process's cpu usage
> > (sys and user) when the child is stil
Hi,
Wondering if there is a way to measure a child process's cpu usage
(sys and user) when the child is still running. I see os.times()
working fine in my system (Linux 2.6.9-42.7.ELsmp), but it gives valid
data only after the child has exited. When the child is alive,
os.times() data for child is
On Jan 12, 6:19 am, Svenn Are Bjerkem <[EMAIL PROTECTED]>
wrote:
> On Jan 9, 9:18 pm, Zentrader <[EMAIL PROTECTED]> wrote:
>
> > On Jan 9, 5:56 am, Svenn Are Bjerkem <[EMAIL PROTECTED]>
> > wrote:
>
> > >I have been looking for a way to execute this command
> > > as a part of a script, but it seems
On Jan 8, 1:20 am, Robert Latest <[EMAIL PROTECTED]> wrote:
> Hello,
>
> look at this function:
>
> --
> def test():
> child = os.popen('./slow')
> for line in child:
> print line
> -
>
> The program "slow" just writes the numbers 0 through 9 on stdout, one l
On Dec 31 2007, 6:46 pm, crybaby <[EMAIL PROTECTED]> wrote:
> 1) what are these characters:
> \x1b]0;
> ~\x07\x1b[?1034h
>
> in line '\x1b]0;[EMAIL PROTECTED]:[EMAIL PROTECTED] ~]'?
These are probably escape sequences in your shell prompt string.
Typically they are interpreted by the terminal, lik
On Dec 27, 7:36 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Thu, 27 Dec 2007 21:17:01 -0600, Shane Geiger wrote:
> > import tempfile
> > tmp = tempfile.mktemp()
>
> > import os
> > os.remove(tmp)
>
> Not only does that not answer the Original Poster's question, but I don't
> think it does w
On Dec 24, 6:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> hello,
>
> I'm new in Python and i would like to use Pexpect to execute a root
> command (i want to mount via a Pyhton script a drive)
>
> so that's my script for the moment :
>
> from os import *
> import pexpect
> import os
> cm
I see python doesn't have ++ or -- operators unlike say, C.
I read some reasonings talking about immutable scalars and using ++/--
doesn't make much sense in python (not sure if ++i is that far-fetched
compared to the allowed i += 1)
In any case, I accidentally wrote ++n in python and it silently
On Oct 26, 9:29 pm, Frank Stutzman <[EMAIL PROTECTED]> wrote:
> My apologies in advance, I'm new to python
>
> Say, I have a dictionary that looks like this:
>
> record={'BAT': '14.4', 'USD': '24', 'DIF': '45', 'OAT': '16',
> 'FF': '3.9', 'C3': '343', 'E4': '1157', 'C1': '339',
> 'E
On Oct 24, 12:07 pm, mrstephengross <[EMAIL PROTECTED]>
wrote:
> Hi folks. I'm using os.popen() to run a command; according to the
> documentation, the filehandle.close() oepration is suppsoed to return
> the exit code. However, when I execute something like "exit 5",
> close() returns 1280. Here's
On Oct 16, 2:48 pm, [EMAIL PROTECTED] wrote:
> Does anyone know of an approximation to raising a negative base to a
> fractional exponent? For example, (-3)^-4.1 since this cannot be
> computed without using imaginary numbers. Any help is appreciated.
Use complex numbers. They are part of pyth
On Oct 10, 10:02 am, "Shawn Milochik" <[EMAIL PROTECTED]> wrote:
> On 10/4/07, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
>
>
>
> > Christopher Spears wrote:
> > > One of the exercises in Core Python Programming is to
> > > create a regular expression that will match a street
> > > address. Here is
On Oct 3, 9:46 am, JD <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want send my jobs over a whole bunch of machines (using ssh). The
> jobs will need to be run in the following pattern:
>
> (Machine A) (Machine B) (Machine C)
>
> Job A1 Job B1Job C1
>
> Job A2 Job B2
On Sep 25, 8:01 am, Erik Jones <[EMAIL PROTECTED]> wrote:
> On Sep 24, 2007, at 9:38 PM, Robert Dailey wrote:
>
> > Hi,
>
> > I've been reading the python documentation on 'positive lookbehind
> > assertion' and I don't understand at all how it works. The python
> > docs give the following example:
On Sep 24, 2:22 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> On Sep 23, 2:58 am, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
> > On Sep 22, 8:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Let's s
On Sep 24, 7:34 am, Horse <[EMAIL PROTECTED]> wrote:
> I've written a python script that copies a nightly Oracle backup file
> to another server. Every couple days, the script fails with this
> error message:
>
> Error copying Q:/Oradata/GISPROD/Backups/3UISN35R_1_1 to s:/gisprod/
> backups/3UISN3
On Sep 22, 8:28 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Let's say I have this Python file called loop.py:
>
> import sys
> print 'hi'
> sys.stdout.flush()
Add sys.stdout.close()
> while 1:
> pass
>
> And I want to call it from another Python process and read the value
> 'hi'. Ho
On Sep 19, 7:17 pm, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Wed, 19 Sep 2007 20:58:03 +, Karthik Gurusamy wrote:
> > While it's easy to explain the behavior, I think the decision to dis-
> > allow mutable items as keys is a bit
On Sep 19, 3:06 pm, Paddy <[EMAIL PROTECTED]> wrote:
> On Sep 19, 9:58 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
> > Since we know hashing is used, all that is needed is, a well-defined
> > way to construct a hash out of a mutable. "Given a sequence, ho
On Sep 19, 6:16 am, Sion Arrowsmith <[EMAIL PROTECTED]>
wrote:
> sapsi <[EMAIL PROTECTED]> wrote:
> > Why can't lists be hashed?
>
> Several people have answered "because they're mutable" without
> explaining why mutability precludes hashing. So:
>
> Consider a dict (dicts have been in Python a *l
On Sep 19, 1:11 pm, David <[EMAIL PROTECTED]> wrote:
> On 9/19/07, James Matthews <[EMAIL PROTECTED]> wrote:
>
> > Hi List
>
> > I have a list of files from my current directory:
>
> > import os
>
> > files = os.listdir(os.getcwd())
>
> > Now this list also includes some files that i don't want lik
On Sep 17, 4:14 pm, [EMAIL PROTECTED] wrote:
> Hello,
>
> I want to write a terminal program in pygtk. It will run a subprocess,
> display everything it writes in its standard output and standard
> error, and let the user write text into its standard input.
>
> The question is, how can I know if th
On Sep 8, 11:02 am, [EMAIL PROTECTED] wrote:
> Hi;
>
> I'm trying to insert XYZ before a keyword in a string. The first and
> the last occurence of hello in the string t1 (t1="hello world hello.
> hello \nwhy world hello") are keywords. So after the insertion of XYZ
> in this string, the result sho
On Sep 5, 1:37 pm, James Stroud <[EMAIL PROTECTED]> wrote:
> Karthik Gurusamy wrote:
> > On Sep 5, 11:17 am, James Stroud <[EMAIL PROTECTED]> wrote:
>
> >> for i in xrange(number_of_reads):
> >>for dev in devs:
> >> try:
> >>
On Sep 5, 11:17 am, James Stroud <[EMAIL PROTECTED]> wrote:
> bambam wrote:
> > I have about 30 pages (10 * 3 pages each) of code like this
> > (following). Can anyone suggest a more compact way to
> > code the exception handling? If there is an exception, I need
> > to continue the loop, and conti
On Sep 2, 12:26 pm, herman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to find out all the process id with the process name
> 'emacs'.
>
> In the shell, i can do this:
>
> $ ps -ef |grep emacs
> root 20731 8690 0 12:37 pts/200:00:09 emacs-snapshot-gtk
> root 25649 25357 0 13:55 pt
On Aug 21, 8:33 pm, Grant Edwards <[EMAIL PROTECTED]> wrote:
> On 2007-08-22, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:
>
> > Not sure on non-unix platforms, but in unix like platforms it's best
> > to reuse shell's power.
>
> >>&
On Aug 21, 3:09 pm, avishay <[EMAIL PROTECTED]> wrote:
> Hello
> I'm trying to chain two programs with a pipe (the output of one
> feeding the input of the other). I managed to capture the output and
> feeding the input of each program independently with popen, but how do
> I tie them together? Is
On Aug 1, 12:41 am, Helmut Jarausch <[EMAIL PROTECTED]>
wrote:
> Many thanks to all of you!
> It's amazing how many elegant solutions there are in Python.
Here is yet another solution.
pexpect.split_command_line()
>From the documentation:
split_command_line(command_line)
This splits a comman
On Jul 17, 5:35 am, Bruno Desthuilliers wrote:
> mosi a écrit :
>
>
>
> > Problem:
> > how to get binary from integer and vice versa?
> > The simplest way I know is:
> > a = 0100
> > a
> > 64
>
> > but:
> > a = 100 (I want binary number)
> > does not work that way.
>
> > a.__hex__ exists
> > a._
On Jul 16, 5:18 pm, Dan Bishop <[EMAIL PROTECTED]> wrote:
> On Jul 16, 7:10 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote:> Hi,
>
> > The string format operator, %, provides a functionality similar to the
> > snprintf function in C. In C, the function does not
Hi,
The string format operator, %, provides a functionality similar to the
snprintf function in C. In C, the function does not know the type of
each of the argument and hence relies on the embedded %
specifier to guide itself while retrieving args.
In python, the language already provides ways to
On Jul 4, 4:38 am, Phoe6 <[EMAIL PROTECTED]> wrote:
> Hi all,
> Consider this scenario, where in I need to use subprocess to execute a
> command like 'ping 127.0.0.1' which will have a continuous non-
> terminating output in Linux.
>
> # code
>
> >>>import subprocess
> >>>process = subprocess.Popen
On Jul 3, 2:33 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > If the problem does not require two way communication, which is
> > typical of a producer-consumer, it is a lot faster to allow P to fully
> > run before C is started.
>
> Why do you say it's *a lot* faster. I find that it is a lit
On Jul 2, 10:57 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> >>> I have found the stop-and-go between two processes on the same machine
> >>> leads to very poor throughput. By stop-and-go, I mean the producer and
> >>> consumer are constantly getting on and off of the CPU since the pipe
> >>>
On Jul 2, 6:32 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> Karthik Gurusamy wrote:
> > On Jul 2, 3:01 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> >> Karthik Gurusamy wrote:
> >>> On Jul 1, 12:38 pm, dlomsak <[EMAIL PROTECTED]> wrote:
> >&g
On Jul 2, 3:01 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> Karthik Gurusamy wrote:
> > On Jul 1, 12:38 pm, dlomsak <[EMAIL PROTECTED]> wrote:
> [...]
>
> > I have found the stop-and-go between two processes on the same machine
> > leads to very poor
On Jul 1, 12:38 pm, dlomsak <[EMAIL PROTECTED]> wrote:
> Thanks for the responses folks. I'm starting to think that there is
> merely an inefficiency in how I'm using the sockets. The expensive
> part of the program is definitely the socket transfer because I timed
> each part of the routine indivi
On Apr 20, 11:51 am, kevinliu23 <[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> So I have a question regarding the split() function in the string
> module. Let's say I have an string...
>
> input = "2b 3 4bx 5b 2c 4a 5a 6"
> projectOptions = (input.replace(" ", "")).split('2')
> print projectOptions
>
>
On Apr 16, 2:50 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote:
> Hi, I'm writing a program with a large data stream to which modules can
> connect using regular expressions.
>
> Now I'd like to not have to test all expressions every time I get a line,
> as most of the time, one of them having a
On Apr 14, 7:54 pm, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Sat, 14 Apr 2007 16:49:22 -0700, Karthik Gurusamy wrote:
> > I'm wondering if there is a cleaner approach -- something like
> > parser.opt_seen("-i")
>
> What do dir(parser) a
Hi,
I see that I can provide a default value for an option. But I couldn't
find out any way if the user really entered the option or the option
took that value because of default. A simple check for value with
default may not always work as the user might have manually
entered the same default val
On Feb 6, 5:26 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am trying to write a python cgi that calls a script over ssh, the
> problem is the script takes a very long time to execute so Apache
> makes the CGI time out and I never see any output. The script is set
> to print a
[EMAIL PROTECTED] wrote:
> The amount of data I read in is actually small.
>
> If you see my algorithm above it deals with 2000 nodes and each node
> has ot of attributes.
>
> When I close the program my computer becomes stable and performs as
> usual. I check the performance in Performance monito
[EMAIL PROTECTED] wrote:
> James Stroud wrote:
> > You see the difficulty don't you? How will the computer know in advance
> > that the regex matches only a finite set of possible strings?
>
> Well sure it might be a little difficult to figure _that_ out, although
> probably not all that hard if yo
Ben Finney wrote:
> [EMAIL PROTECTED] writes:
>
> > I'm fairly new to python. I like to define a big dictionary in two
> > files and use it my main file, build.py
> >
> > I want the definition to go into build_cfg.py and build_cfg_static.py.
>
> That sounds like a very confusing architecture, and s
Ben Cartwright wrote:
> [EMAIL PROTECTED] wrote:
> > I like to define a big dictionary in two
> > files and use it my main file, build.py
> >
> > I want the definition to go into build_cfg.py and build_cfg_static.py.
> >
> > build_cfg_static.py:
> > target_db = {}
> > target_db['foo'] = 'bar'
> >
>
60 matches
Mail list logo