Re: [Tutor] Proxies/Interceptors for file-like objects

2009-02-19 Thread spir
Le Wed, 18 Feb 2009 22:01:34 -0500, Kent Johnson ken...@tds.net s'exprima ainsi: Hmm. I guess this is Python 3? In 2.6, open is a function and trying to subclass it gives an error: In [10]: open Out[10]: built-in function open In [11]: class myopen(open): pass : TypeError:

Re: [Tutor] Proxies/Interceptors for file-like objects

2009-02-19 Thread Oxymoron
Thanks for the answers everyone. Denis, I wish to wrap an already open file handle basically, so simply extending and overriding doesn't help - my proxy won't be instantiated like a file, just used like one and if not intercepting I need to delegate down to the proxied real handle. If I'm missing

[Tutor] extracting a column from many files

2009-02-19 Thread Bala subramanian
Dear friends, I want to extract certain 6 different columns from a many files and write it to 6 separate output files. I took some help from the following link http://mail.python.org/pipermail/tutor/2004-November/033475.html to write one column from many input files to a particular output file.

Re: [Tutor] Proxies/Interceptors for file-like objects

2009-02-19 Thread Lie Ryan
On Thu, 19 Feb 2009 20:12:57 +1100, Oxymoron wrote: Thanks for the answers everyone. Denis, I wish to wrap an already open file handle basically, so simply extending and overriding doesn't help - my proxy won't be instantiated like a file, just used like one and if not intercepting I need

Re: [Tutor] Proxies/Interceptors for file-like objects

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 6:03 AM, Lie Ryan lie.1...@gmail.com wrote: If you replace sys.stdin with your own file object, you don't need to define all of the file object interface, just the one that generates an error if not defined (i.e. the ones that you use). Yes, probably just defining

Re: [Tutor] extracting a column from many files

2009-02-19 Thread Bala subramanian
Hi, I have to extract say column 1, column 2 . column 6 (six different columns) from 10 different input files. The function extract to extract the columns works fine. For each column extracted from the input files, i have to write it in one output file. I have to make 6 output files

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Wayne Watson
Title: Signature.html Hi, actually I had two aims with the pseudo code, 1. print it, and 2. check to see if it would pull in the two modules. I pulled it into Word, and quickly formatted it to get the line wrap out, and put it in some sort of readable format. After that, I thought why not just

[Tutor] verify the email

2009-02-19 Thread jitendra gupta
hello here is my code for sending the mail, using this code email is going 'CODE '' import smtplib from time import strftime from email.mime.multipart

[Tutor] Removing control characters

2009-02-19 Thread Dinesh B Vadhia
I want a regex to remove control characters ( chr(32) and chr(126)) from strings ie. line = re.sub(r[^a-z0-9-';.], , line) # replace all chars NOT A-Z, a-z, 0-9, [-';.] with 1. What is the best way to include all the required chars rather than list them all within the r ? 2. How do

Re: [Tutor] Removing control characters

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 10:14 AM, Dinesh B Vadhia dineshbvad...@hotmail.com wrote: I want a regex to remove control characters ( chr(32) and chr(126)) from strings ie. line = re.sub(r[^a-z0-9-';.], , line) # replace all chars NOT A-Z, a-z, 0-9, [-';.] with 1. What is the best way to

Re: [Tutor] Removing control characters

2009-02-19 Thread Mark Tolonen
A regex isn't always the best solution: a=''.join(chr(n) for n in range(256)) a '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Wayne Watson
I now have wxPython, IDLE and Vim installed. IDLE didn't disappear during the wx install. It looks as though wxPython re-compiled library files. I'll be exploring vim now. Wayne Watson wrote: Hi, actually I had two aims with the pseudo code, 1. print it, and 2. check to see if it would

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 4:51 AM, Wayne Watson sierra_mtnv...@sbcglobal.netwrote: Hi, actually I had two aims with the pseudo code, 1. print it, and 2. check to see if it would pull in the two modules. I pulled it into Word, and quickly formatted it to get the line wrap out, and put it in some

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 9:58 AM, Wayne Watson sierra_mtnv...@sbcglobal.netwrote: I now have wxPython, IDLE and Vim installed. IDLE didn't disappear during the wx install. It looks as though wxPython re-compiled library files. I'll be exploring vim now. wxPython doesn't replace or remove

Re: [Tutor] extracting a column from many files

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 5:41 AM, Bala subramanian bala.biophys...@gmail.com wrote: Dear friends, I want to extract certain 6 different columns from a many files and write it to 6 separate output files. #!/usr/bin/env python from sys import argv lst_files=argv[1:]

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Wayne Watson
Title: Signature.html Ok, I now understand the role of wx. I'm going to un-install wx. I want to keep this program as close to the original as I can, which means I will use Tkinter from here on out. GUIs of different sorts seem to be a burgeoning industry. I'm willing to give vim a shot. I

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-19 Thread Eric Dorsey
Still doesnt work.. I just get this when I hit the up arrow: ^[[A Bah. It works in the 2.5 version that came packaged with it. Thanks for trying :) On Wed, Feb 18, 2009 at 11:27 PM, زياد بن عبدالعزيز الباتلي ziyad.alba...@gmail.com wrote: On Wed, 18 Feb 2009 20:19:56 -0700 Eric Dorsey

Re: [Tutor] Removing control characters

2009-02-19 Thread Dinesh B Vadhia
At the bottom of the link http://code.activestate.com/recipes/303342/ there are list comprehensions for string manipulation ie. import string str = 'Chris Perkins : 224-7992' set = '0123456789' r = '$' # 1) Keeping only a given set of characters. print ''.join([c for c in str if c in set])

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 10:59 AM, Wayne Watson sierra_mtnv...@sbcglobal.net wrote: I'm willing to give vim a shot. I believe in an earlier thread unrelated to this, Alan suggested it. I'm perhaps incorrectly assuming vim will take care of the Tkinter problem. If these editors aren't really

Re: [Tutor] Removing control characters

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 11:25 AM, Dinesh B Vadhia dineshbvad...@hotmail.com wrote: My solution is: print ''.join[string.replace(c, r) for c in str if c in set] But, this returns a syntax error. Any idea why? Probably because you didn't use parentheses - join() is a function. --

[Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Isaac Eiland-Hall
http://python.pastebin.com/m26864a1b Traceback (most recent call last): File ./loopy, line 328, in module set[current_set][current_section][current_key] = current_value KeyError: 'DEFAULT' First, apologies for the formatting - I'm teaching myself python after

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 11:34 AM, Isaac Eiland-Hall daychi...@gmail.comwrote: http://python.pastebin.com/m26864a1b Traceback (most recent call last): File ./loopy, line 328, in module set[current_set][current_section][current_key] = current_value KeyError: 'DEFAULT'

Re: [Tutor] Removing control characters

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 2:25 PM, Dinesh B Vadhia dineshbvad...@hotmail.com wrote: # 3) Replacing a set of characters with a single character ie. for c in str: if c in set: string.replace (c, r) to give 'Chris Perkins : $$$-' My solution is: print

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-19 Thread Robert Berman
Eric, I am running under Ubuntu 8.10. If I use IDLE the up arrow key gives me nothing at all. It does work using iPython which for most testing of ideas and code snippets has replaced IDLE. My GUI of choice is WING-personal which cost  $30.00 and is by far the best investment I have made

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 2:34 PM, Isaac Eiland-Hall daychi...@gmail.com wrote: http://python.pastebin.com/m26864a1b Traceback (most recent call last): File ./loopy, line 328, in module set[current_set][current_section][current_key] = current_value KeyError: 'DEFAULT'

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Kent Johnson
Oops, hit send by mistake...continued below. On Thu, Feb 19, 2009 at 3:40 PM, Kent Johnson ken...@tds.net wrote: On Thu, Feb 19, 2009 at 2:34 PM, Isaac Eiland-Hall daychi...@gmail.com wrote: http://python.pastebin.com/m26864a1b Traceback (most recent call last): File

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Wayne Watson
Actually, I had gotten comfortable with using IDLE a few weeks ago, and just put a short cut to the program within easy reach. I'd edit then execute with the icon. One day, I happened to hit F5 and it executed the program properly. Somehow I drifted back to the old way, unsuspectingly. Not

Re: [Tutor] Add readline capabilities to a Python build 2.6 on Ubuntu

2009-02-19 Thread Roel Schroeven
Robert Berman schreef: Eric, I am running under Ubuntu 8.10. If I use IDLE the up arrow key gives me nothing at all. It does work using iPython which for most testing of ideas and code snippets has replaced IDLE. FYI, in Idle the keys for going back and forth in the history are Alt-P

Re: [Tutor] Removing control characters

2009-02-19 Thread Dinesh B Vadhia
Okay, here is a combination of Mark's suggestions and yours: # string of all chars a = ''.join([chr(n) for n in range(256)]) a '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f

Re: [Tutor] Removing control characters

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 5:41 PM, Dinesh B Vadhia dineshbvad...@hotmail.com wrote: Okay, here is a combination of Mark's suggestions and yours: # replace unwanted chars in string s with t = .join([( if n in c else n) for n in s if n not in c]) t 'Product ConceptsHard candy with an

Re: [Tutor] Removing control characters

2009-02-19 Thread Mark Tolonen
Kent Johnson ken...@tds.net wrote in message news:1c2a2c590902191500y71600feerff0b73a88fb49...@mail.gmail.com... On Thu, Feb 19, 2009 at 5:41 PM, Dinesh B Vadhia dineshbvad...@hotmail.com wrote: Okay, here is a combination of Mark's suggestions and yours: # replace unwanted chars in string

[Tutor] I have a question plz help

2009-02-19 Thread rev pacce
My mom and I have been trying to hack into the administrator account on our laptop my mom got from her job awile ago so we can update the computer and itunes and stuff but we have failed many times. We had a pro hacker from colorado try and do it and he also failed my mom told me. i dont no if

Re: [Tutor] I have a question plz help

2009-02-19 Thread Kent Johnson
On Thu, Feb 19, 2009 at 8:29 PM, rev pacce julianpac...@yahoo.com wrote: My mom and I have been trying to hack into the administrator account on our laptop my mom got from her job awile ago so we can update the computer and itunes and stuff but we have failed many times. We had a pro hacker

[Tutor] wxPython dialog problem

2009-02-19 Thread Garry Willgoose
I'm just porting an old code from a GUI in Tkinter to one in wxPython and am having a problem with one of the dialog widgets. This is on OSX. The code below gives the result result= 5104 5103 5104 as expected but if I substitute the single line form that is commented out (as per the

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Lie Ryan
On Thu, 19 Feb 2009 11:45:52 -0800, Marc Tompkins wrote: Don't use reserved words as variable names! nitpick str, set is built-in function not reserved words. Reserved words are like if, for, from, as (see the whole list type keywords in help() ) Nevertheless, it is a bad idea to use