Re: [Tutor] Find and test a device by MAC address

2007-01-04 Thread lumbricus
Quick and dirty: As root: >>> from scapy import * >>> arping("192.168.0.1/24") # or whatever fits to your network and then filter the answers; or build your own arp packets with ARP(). -- Freedom, Freedom, Freedom, Oi! -- Zoidberg Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu

Re: [Tutor] how to know if a file exists

2007-01-04 Thread Vikram Shenoy
Hi, import os if os.path.exists('/path/to/file'): # File exists else: # File doesn't exist It works for files as well as directories. Regards, Vikram U Shenoy ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tut

Re: [Tutor] Embedding strings in a python script

2007-01-04 Thread Kent Johnson
Tony Cappellini wrote: > What I'd like to know, is there a way I can embed/endcode the cvs string > above in the python script, so that when that script is modified and > checked into cvs, that the cvs header string above will not be modified > by cvs? Try using \x24 instead of $: cvs_header='

Re: [Tutor] how to know if a file exists

2007-01-04 Thread Kent Johnson
shawn bright wrote: > hello there, > i am writing an app for linux. what command would be easiest to test and > see if a certain file exist ? os.path.exists() or os.path.isfile() Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

[Tutor] Any Good book for python

2007-01-04 Thread deepak shingan
Hi Folks, I am new in Python area and want to know Python concepts with more deatils. Please suggest some good books on python. Thanks in Advance -Deepak __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://m

[Tutor] Patches

2007-01-04 Thread Øyvind
Hello. I need to access SMTP with SSL and found this patch: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1567274&group_id=5470 But, I cannot find anything with Google or in the Python documentation about how to apply a patch. Ok, one slight modification. I did find something: 5.

Re: [Tutor] Any Good book for python

2007-01-04 Thread Arun Kumar PG
"Python in a nutshell" is a good one. Also Python docs are the all time favorite. On 1/4/07, deepak shingan <[EMAIL PROTECTED]> wrote: Hi Folks, I am new in Python area and want to know Python concepts with more deatils. Please suggest some good books on python. Thanks in Advance -Deepak

Re: [Tutor] Any Good book for python

2007-01-04 Thread Hiran Venugopalan
"Byte of python" by Swaroop [swaroopch.info] is a simple book for starters,but never a alltime help book.If you are just a starter like me,you can learn the ideas on python on looking to that and which will surely help you to learn python in deep. Its there at http://swaroopch.info/text/Byte_of_P

Re: [Tutor] Patches

2007-01-04 Thread Kent Johnson
Øyvind wrote: > Hello. > > I need to access SMTP with SSL and found this patch: > https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1567274&group_id=5470 > > But, I cannot find anything with Google or in the Python documentation > about how to apply a patch. > > Is patch a program I h

Re: [Tutor] how do i access object

2007-01-04 Thread Ketan Maheshwari
Hi As suggested by Alan, I wrote a method getcenter as follows *** def getcenter(self): xy=self.canvas.coords(self.id) xcenter=(xy[2]-xy[0])/2 ycenter=(xy[3]-xy[1])/2 return xcenter, ycenter *** However, when I call this method from the instance of Circle class I get

Re: [Tutor] Any Good book for python

2007-01-04 Thread stv
> I am new in Python area and want to know Python concepts with more deatils. > Please suggest some good books on python. Beginning Python, by Hetland is excellent for almost any level (I think someone who has really mastered one language, and is currently working as a programmer, can simply read

[Tutor] how to stop a thread

2007-01-04 Thread shawn bright
hello there all, i have a python reference book that got me started knowing how to use threads, i can declare one as a class, and start it like this class SomeThread(threading.Thread): run_process = SomeThread() run_process.start() but how do i kill it ? This part is not in my book. Basically

Re: [Tutor] how to stop a thread

2007-01-04 Thread Kent Johnson
shawn bright wrote: > hello there all, > > i have a python reference book that got me started knowing how to use > threads, i can declare one as a class, and start it like this > > class SomeThread(threading.Thread): > > > run_process = SomeThread() > run_process.start() > > but how do i kill

[Tutor] farey() often gives incorrect result

2007-01-04 Thread Dick Moores
farey() is at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52317 Here's a script of mine that compares the results of farey() with bestFracForMaxDenom(), from my frac.py (at ): The maxDenom (the lim of farey()) is set at 100. The dec, or decimal, or value, or v of farey(), is generate

[Tutor] Testing the status of NFS mounts

2007-01-04 Thread Andrew Robert
Hi everyone, We have several NFS mounts that are in use. Occasionally, the NFS mounts seem to go out to lunch. The mounts appear active but are no longer functional. Is there a Python module specific to NFS that I might use to periodically check its status? I imagine I could make a script to

Re: [Tutor] how to stop a thread

2007-01-04 Thread shawn bright
i can do that, will use my config file, thanks much and thanks for the link. shawn On 1/4/07, Kent Johnson <[EMAIL PROTECTED]> wrote: shawn bright wrote: > hello there all, > > i have a python reference book that got me started knowing how to use > threads, i can declare one as a class, and s

Re: [Tutor] Testing the status of NFS mounts

2007-01-04 Thread Kent Johnson
Andrew Robert wrote: > Hi everyone, > > We have several NFS mounts that are in use. > > Occasionally, the NFS mounts seem to go out to lunch. > > The mounts appear active but are no longer functional. > > Is there a Python module specific to NFS that I might use to > periodically check its sta

[Tutor] python web dev

2007-01-04 Thread OkaMthembo
hi pythonistas! this is my first post. please could you tell me which is the best lightweight python web framework? also, which is the best templating language for python? (which can handle other data formats in addition to text). so far im lured by Cheetah, although i havent done any web dev wit

Re: [Tutor] Need help with rewriting script to use Decimal module

2007-01-04 Thread Terry Carroll
On Wed, 3 Jan 2007, Dick Moores wrote: > Terry, I just noticed that farey(0.36, 10) returns (1, 3), a pretty > big miss, IMO. The correct fraction with smallest error and maximum > denominator of 10 is 3/8, which I'm proud to say my klunky frac.py > (

Re: [Tutor] python web dev

2007-01-04 Thread Simon Brunning
On 1/4/07, OkaMthembo <[EMAIL PROTECTED]> wrote: > this is my first post. Welcome! > please could you tell me which is the best > lightweight python web framework? Best? That's a potentially contensious one. But I can tell you that if you were to look at either Django or TurboGears you wouldn't

Re: [Tutor] python web dev

2007-01-04 Thread Mike Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of OkaMthembo > Sent: Thursday, January 04, 2007 9:12 AM > To: tutor@python.org > Subject: [Tutor] python web dev > > hi pythonistas! > > this is my first post. please could you tell me which is th

Re: [Tutor] SPE - Stani's Python Editor ?

2007-01-04 Thread Mike Hansen
> -Original Message- > From: OkaMthembo [mailto:[EMAIL PROTECTED] > Sent: Thursday, January 04, 2007 9:18 AM > To: Mike Hansen > Subject: Re: [Tutor] SPE - Stani's Python Editor ? > > have you tried Komodo from ActiveState or Wingware? might be > great, comeercial though. > > I con

Re: [Tutor] python web dev

2007-01-04 Thread Christopher Arndt
Simon Brunning schrieb: > On 1/4/07, OkaMthembo <[EMAIL PROTECTED]> wrote: >> also, which is the best templating >> language for python? (which can handle other data formats in addition to >> text). so far im lured by Cheetah, although i havent done any web dev with >> python yet. > > Cheetah's go

Re: [Tutor] Need help with rewriting script to use Decimal module

2007-01-04 Thread Dick Moores
At 08:20 AM 1/4/2007, Terry Carroll wrote: >On Wed, 3 Jan 2007, Dick Moores wrote: > > > Terry, I just noticed that farey(0.36, 10) returns (1, 3), a pretty > > big miss, IMO. The correct fraction with smallest error and maximum > > denominator of 10 is 3/8, which I'm proud to say my klunky frac.py

Re: [Tutor] python web dev

2007-01-04 Thread Christopher Arndt
OkaMthembo schrieb: > this is my first post. please could you tell me which is the best > lightweight python web framework? "Web framework" and "lightweight" don't really go well together. There are so many things about web programming that you don't realise you need when you start, but *will* com

Re: [Tutor] python web dev

2007-01-04 Thread Noufal Ibrahim
OkaMthembo wrote: > hi pythonistas! > > this is my first post. please could you tell me which is the best > lightweight python web framework? also, which is the best templating > language for python? (which can handle other data formats in addition to > text). so far im lured by Cheetah, although

Re: [Tutor] python web dev

2007-01-04 Thread Kent Johnson
OkaMthembo wrote: > hi pythonistas! > > this is my first post. please could you tell me which is the best > lightweight python web framework? also, which is the best templating > language for python? (which can handle other data formats in addition to > text). so far im lured by Cheetah, althou

[Tutor] Assigning a variable stored in a dictionary

2007-01-04 Thread Tony Cappellini
I can't see the forest through the trees. I have stored 3 global variables in a dictionary, and associated each variable with a filename. Ideally, I want to read the contents of the text files, and store the contents in the global variables. The globals will be used by another function. However,

Re: [Tutor] Assigning a variable stored in a dictionary

2007-01-04 Thread Kent Johnson
Tony Cappellini wrote: > > I can't see the forest through the trees. > > I have stored 3 global variables in a dictionary, and associated each > variable with a filename. > Ideally, I want to read the contents of the text files, and store the > contents in the global variables. The globals will

[Tutor] coin toss program without using the for/range loop

2007-01-04 Thread David
How to write the coin toss program without using the for/range loop program. Program flips a coin 100 times and then tells you the number of heads and tails. I can only solve it using the for/range loop Import random Heads=0 For 1 in range (100): Heads+=random.randrange(2) pri

Re: [Tutor] coin toss program without using the for/range loop

2007-01-04 Thread Kent Johnson
David wrote: > How to write the coin toss program without using the for/range loop program. > > Program flips a coin 100 times and then tells you the number of heads > and tails. > > > > I can only solve it using the for/range loop > > > > Import random > > Heads=0 > > For 1 in rang

Re: [Tutor] coin toss program without using the for/range loop

2007-01-04 Thread Luke Paireepinart
Kent Johnson wrote: > David wrote: > >> How to write the coin toss program without using the for/range loop program. >> >> Program flips a coin 100 times and then tells you the number of heads >> and tails. >> >> >> >> I can only solve it using the for/range loop >> >> >> >> Import random >

Re: [Tutor] coin toss program without using the for/range loop

2007-01-04 Thread Christopher Arndt
Kent Johnson schrieb: > David wrote: >> print “Hit heads”+” “+str(heads)+” “+”times”+” “ + “hit tails” + “ >> “+str(100-heads)+” “ + “times” > > This sounds a lot like homework [...] An if you want to get extra marks for pythonicity ;-), read about string formatting here: http://www.python.org

Re: [Tutor] Question regarding parsing HTML with BeautifulSoup

2007-01-04 Thread Shuai Jiang (Runiteking1)
Hi, Wow, thats much more elegant than the idea I thought of. Thank you very much Kent! Marshall On 1/3/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Shuai Jiang (Runiteking1) wrote: > Hello, > > I'm working on a program that need to parse a financial document on the > internet > using Beautifu

Re: [Tutor] SPE - Stani's Python Editor ?

2007-01-04 Thread Shanmuhanathan T
I found eclipse+pydev to be as good as/better than komodo or wingware. also eclipse has other plugins which makes it a powerful IDEs for php/ruby/perl etc. Regards, Shanmu. On 1/4/07, Mike Hansen <[EMAIL PROTECTED]> wrote: > -Original Message- > From: OkaMthembo [mailto:[EMAIL PROTEC

Re: [Tutor] Need help with rewriting script to use Decimal module

2007-01-04 Thread Terry Carroll
On Wed, 3 Jan 2007, Dick Moores wrote: > Be that as it may, farey() is an amazing program. Not to beat this subject to death, but the comment at the bottom of http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52317 about continued fractions piqued my interest. I'm no mathematician, but