[Tutor] Capture command output

2005-11-02 Thread Johan Geldenhuys
I've been musy with the os command on how to kill a process. That's been sorted out to an extend. Many thanks for your input. Now I have a question in the same direction: I use os.execpv(cmd, [cmd, args]). That executes the command that have output. This was the best way of getting the pid and

Re: [Tutor] Style/Conceptual Help

2005-11-02 Thread Rob Dowell
Thanks, I'll do that. Danny Yoo wrote: >On Wed, 2 Nov 2005, Rob Dowell wrote: > > > >>Oh, and about the email addresses, ebgreen is an account I use when >>doing email via a web interface (i.e. I'm not at home) and this is my >>home address. >> >> > >[meta: list administration] > >Hi Rob, >

Re: [Tutor] os command

2005-11-02 Thread Hugo González Monteverde
Hi Johan Geldenhuys wrote: > Hugo, > > I see that 'os.execcvp()' doesn't actually make two seperate processes. > This is what I have working now: > """ > > import os, signal, time > pid = os.fork() > print 'pid; ',pid > if pid == 0: #child process >#os.execvp('tcpdump', ['tcpdump',

Re: [Tutor] os command

2005-11-02 Thread Hugo González Monteverde
Hi Johan Geldenhuys wrote: > Hugo, > > I see that 'os.execcvp()' doesn't actually make two seperate processes. > This is what I have working now: > """ > > import os, signal, time > pid = os.fork() > print 'pid; ',pid > if pid == 0: #child process >#os.execvp('tcpdump', ['tcpdump',

Re: [Tutor] os command

2005-11-02 Thread Johan Geldenhuys
Hugo, I see that 'os.execcvp()' doesn't actually make two seperate processes. The advice you gave me works good. I just had to fgure out with what params I should call it. I'm still a bit unsure of how to call the sysem command with more than one argument. This is what I have working now: """

Re: [Tutor] Style/Conceptual Help

2005-11-02 Thread Danny Yoo
On Wed, 2 Nov 2005, Rob Dowell wrote: > Oh, and about the email addresses, ebgreen is an account I use when > doing email via a web interface (i.e. I'm not at home) and this is my > home address. [meta: list administration] Hi Rob, No problem. What you can do, if you want to avoid the modera

Re: [Tutor] Talking to UDPServer: Follow-up

2005-11-02 Thread Carroll, Barry
Greetings: After studying the socket examples and tutorials y'all pointed me to, I settled on Examples 19.3 and 19.4 in Alex Martelli's " Python in a Nutshell" as my starting point. They worked fine, of course, right out of the box. My task now is to extend the client script to handle the command

Re: [Tutor] Style/Conceptual Help

2005-11-02 Thread Rob Dowell
Thanks for the input Danny. I had already begun to separate the presentation layer from the computation by moving code out of the button click function. Your idea of a separate config class is a good one and I will implement it soon. I'll also begin fragmenting the function that does all the wo

Re: [Tutor] os command

2005-11-02 Thread Hugo González Monteverde
In UNIX, you use the fork() exec() technique for starting a new process, from the very first process(init) onwards. The os.system() uses a shell to do that, or you may do it yourself (in your script) A "command" is just an executable file running(process), unless you've got a library function

Re: [Tutor] Style/Conceptual Help

2005-11-02 Thread Danny Yoo
On Wed, 2 Nov 2005 [EMAIL PROTECTED] wrote: > I would be interested in some input/suggestions on the pythonicness of > the way I did things and on style, or anything else you see that I can > improve. Hi ebgreen, The only big thing I'd point out is that the buttonClick() method of the applicat

Re: [Tutor] Tutorials on the web

2005-11-02 Thread Carroll, Barry
Johan: The link is helpful indeed. In five minutes I found six tutorials I want to check out for my current project. Thank you. Barry > Message: 5 > Date: Wed, 02 Nov 2005 11:02:45 +0200 > From: Johan Geldenhuys <[EMAIL PROTECTED]> > Subject: [Tutor] Tutorials on the web > To: Tutor > Messa

[Tutor] Style/Conceptual Help

2005-11-02 Thread ebgreen
I had posted once before with a TKinter problem that I was having and it was solved in one message so thanks a lot to the List. I now have working code and I would be interested in some input/suggestions on the pythonicness of the way I did things and on style, or anything else you see that I can

Re: [Tutor] idle shell command recall

2005-11-02 Thread Graeme
rio wrote: > is there any way from the idle shell to recall the last line(s) of code > entered like or does for DOS prompt or BASH? Alt + P = History Previous Alt + N = History Next Also in the menu, if you go to Options > Configure IDLE > Keys, you'll find a list of all the available key op

Re: [Tutor] idle shell command recall

2005-11-02 Thread Kent Johnson
rio wrote: > is there any way from the idle shell to recall the last line(s) of code > entered like or does for DOS prompt or BASH? Use the mouse or the arrow keys to put the cursor in the line you want to recall. Press Return and you will get a fresh, editable copy of the line at your curren

Re: [Tutor] while/if/elif/else loops

2005-11-02 Thread Kent Johnson
rio wrote: > i too am a newbie to programming (except BASIC over 20 years ago!). > randrange() didnt seem to be in the random module (pyth2.4.2) Sure it is, check your spelling and make sure you call it random.randrange(): Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on w

Re: [Tutor] Decoding decleration

2005-11-02 Thread Kent Johnson
Johan Geldenhuys wrote: > I receive this error when executing a file: > "Non-ASCII character '\x8b' in file task.py on line 1, but no encoding > declared". > > Can anybody tell me what the encoding is supposed to look like and is it > standard on all files that is trying to use Non-ASCII charact

[Tutor] idle shell command recall

2005-11-02 Thread rio
is there any way from the idle shell to recall the last line(s) of code entered like or does for DOS prompt or BASH? brian __ Find your next car at http://autos.yahoo.ca ___

Re: [Tutor] while/if/elif/else loops

2005-11-02 Thread rio
i too am a newbie to programming (except BASIC over 20 years ago!). randrange() didnt seem to be in the random module (pyth2.4.2) random() IS but it doesn;t seem to take arguments. it returns a float between 0.0 and 0., so random.random()*2 means half will be (0.0-0.9) & half (1.0-1.9

[Tutor] Tutorials on the web

2005-11-02 Thread Johan Geldenhuys
Here is a link to a range of tutorials: http://www.awaretek.com/tutorials.html Maybe this wil help some people to know where to find a good tutorial ona specific subject. Johan ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/list

Re: [Tutor] while/if/elif/else loops

2005-11-02 Thread Pujo Aji
Hello,I see two things can be changed a little bit.1. redundant: while, if2. print style at the last statement.see below:#Coin Toss Game#Zameer Manjiimport randomprint "This game will simulate 100 coin tosses and then tell you the number of head's and tails"tosses = 0heads = 0tails = 0while tosses<

[Tutor] Decoding decleration

2005-11-02 Thread Johan Geldenhuys
I receive this error when executing a file: "Non-ASCII character '\x8b' in file task.py on line 1, but no encoding declared". Can anybody tell me what the encoding is supposed to look like and is it standard on all files that is trying to use Non-ASCII characters? Thanks, Johan

Re: [Tutor] os command

2005-11-02 Thread Johan Geldenhuys
Sorry for the late reply, But is it necessary to use a child process? I don't want to execute the command in another process. What happens with the parent process and how do I execute my command in the parent process? Thanks Hugo González Monteverde wrote: > Hi, > > os.system will return the e

Re: [Tutor] while/if/elif/else loops

2005-11-02 Thread bob
At 02:36 PM 11/1/2005, Zameer Manji wrote: >Ok after looking at everyones replies my program looks like this: > >#Coin Toss Game >#Zameer Manji >import random > >print "This game will simulate 100 coin tosses and then tell you the >number of head's and tails" > >tosses = 0 >heads = 0 >tails = 0 > >