[Tutor] weird socket errors on linux with asyncore

2007-08-12 Thread Lawrence Wang
apologies if this doesn't belong on tutor. i have a long-running script that manages a bunch of sockets with asyncore, opening 600 connections every 30 seconds for short transactions, and every now and then (like anywhere from twice an hour to once every few hours) i get this weird error: "filedes

Re: [Tutor] Decoding

2007-08-12 Thread Kent Johnson
bhaaluu wrote: > Greetings, > >>From what I can tell of this "decoding" function, it uses > the chr() function to return the ascii character: > print chr(eval('65')) > A There is no need to use eval() here. Since the expected values are integers, just use int(): In [6]: chr(int('65')) Out[

Re: [Tutor] Decoding

2007-08-12 Thread Eric Walker
--- bhaaluu <[EMAIL PROTECTED]> wrote: > Greetings, > > From what I can tell of this "decoding" function, it > uses > the chr() function to return the ascii character: > > >>> print chr(eval('65')) > A > > >>> print ord('A') > 65 > > In this textbook example, the "code" is simple a > string o

Re: [Tutor] Decoding

2007-08-12 Thread Eric Walker
--- bhaaluu <[EMAIL PROTECTED]> wrote: > Greetings, > > From what I can tell of this "decoding" function, it > uses > the chr() function to return the ascii character: > > >>> print chr(eval('65')) > A > > >>> print ord('A') > 65 > > In this textbook example, the "code" is simple a > string of

Re: [Tutor] Decoding

2007-08-12 Thread bob gailer
Eric Walker wrote: > newbie here, > Welcome > I just tried playing around with the dec function and > I get errors. Please always post the traceback (error message), and the code you are using. > Correct me if I am wrong. After getting > the input, What input is dec() expecting? As I read it

Re: [Tutor] Decoding

2007-08-12 Thread bhaaluu
Greetings, >From what I can tell of this "decoding" function, it uses the chr() function to return the ascii character: >>> print chr(eval('65')) A >>> print ord('A') 65 In this textbook example, the "code" is simple a string of the ASCII characters' numeric values. Nothing fancy. What does th

Re: [Tutor] Decoding

2007-08-12 Thread Eric Walker
newbie here, I just tried playing around with the dec function and I get errors. Correct me if I am wrong. After getting the input, the string.split will parse the string across whitespace chars so in other words you get a list of each word entered. Then when it does the eval(x) part it dies. I tri

Re: [Tutor] Decoding

2007-08-12 Thread Khamid Nurdiev
Thanks, it really works. On 8/13/07, bhaaluu <[EMAIL PROTECTED]> wrote: > > Greetings, > > Disclaimer: I'm a Python Noob, > so use the code snippets > in this post, at your own risk! > > Is this what you're looking for? > > def dec(a): > import string > result='' > for x in string.spl

Re: [Tutor] Decoding

2007-08-12 Thread Dick Moores
At 02:12 PM 8/12/2007, Dick Moores wrote: At 01:15 PM 8/12/2007, Khamid Nurdiev wrote: Hello All,  I am currently learning python with the book "Python programming: An introduction to CS" by John M. Zelle and have come the section where he speaks of encoding messages. Currently the basic snippet

Re: [Tutor] Decoding

2007-08-12 Thread Dick Moores
At 01:15 PM 8/12/2007, Khamid Nurdiev wrote: Hello All,  I am currently learning python with the book "Python programming: An introduction to CS" by John M. Zelle and have come the section where he speaks of encoding messages. Currently the basic snippet looks like this: def dec():     import

Re: [Tutor] Decoding

2007-08-12 Thread bhaaluu
Greetings, Disclaimer: I'm a Python Noob, so use the code snippets in this post, at your own risk! Is this what you're looking for? def dec(a): import string result='' for x in string.split(a): result=result+chr(eval(x)) return result print dec(raw_input("Enter the messa

[Tutor] Decoding

2007-08-12 Thread Khamid Nurdiev
Hello All, I am currently learning python with the book "Python programming: An introduction to CS" by John M. Zelle and have come the section where he speaks of encoding messages. Currently the basic snippet looks like this: def dec(): > > import string > > message=raw_input("Enter the m

Re: [Tutor] IDLE 1.2 Question

2007-08-12 Thread Jerry VanBrimmer
Thank you, sorry for the repeat question. On 8/11/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > It depends whether IDLE is opened with a subprocess or not. If it's a > subprocess, your program will have a separate interpreter entirely from > that used by IDLE, so the namespace will be the de