Re: [Tutor] file.read..... Abort Problem (fwd)

2005-10-20 Thread Kent Johnson
> From: Tomas Markus <[EMAIL PROTECTED]> > Just to let you know my ressults (+ one tiny question :-): > I did a bit of investigation and narrowed the "invalid" characters group to > jus one the hex 1a. My code now looks quite small: > > fpath = 'c:\\pytemp\\bafir550.edi' > fl = file(fpath, 'rb') >

Re: [Tutor] file.read..... Abort Problem (fwd)

2005-10-20 Thread Danny Yoo
[Keeping tutor in CC] -- Forwarded message -- Date: Thu, 20 Oct 2005 23:21:13 +0200 From: Tomas Markus <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] file.read. Abort Problem Hi All, Just to let you know my ressults (+ one tiny questio

Re: [Tutor] file.read..... Abort Problem

2005-10-20 Thread Danny Yoo
> I was going to ask why you think regex is a sledgehammer for this one, Regex's are more complex because we have to then make sure that none of the testchars have any special meaning as regular expression metacharacters. If one of those test chars, for example, contained things like '-' or '\\',

Re: [Tutor] file.read..... Abort Problem

2005-10-20 Thread Kent Johnson
Kent Johnson wrote: > Here is a program that scans a string for test chars, either using a single > regex search or by individually searching for the test chars. The test data > set doesn't include any of the test chars so it is a worst case (neither scan > terminates early): > > # FindAny.py >

Re: [Tutor] file.read..... Abort Problem

2005-10-20 Thread Kent Johnson
Danny Yoo wrote: > > On Thu, 20 Oct 2005, Tomas Markus wrote: >>what is the most effective way to check a file for not allowed >>characters or how to check it for allowed only characters (which might >>be i.e. ASCII only). > > > If the file is small enough to fit into memory, you might use regul

Re: [Tutor] file.read..... Abort Problem

2005-10-20 Thread Danny Yoo
On Thu, 20 Oct 2005, Tomas Markus wrote: > I am trying to read a file with some 2500 lines and to do a scan for "not > allowed" characters in there (such as accented ones and so on). The problem > is that the file I am testing with has got one of those somewhere on line > 2100 (the hex value of

Re: [Tutor] file.read..... Abort Problem

2005-10-20 Thread Kent Johnson
Tomas Markus wrote: > Hello Pythoners, > > This is probably a very newbie question (after all I am one): > > I am trying to read a file with some 2500 lines and to do a scan for > "not allowed" characters in there (such as accented ones and so on). The > problem is that the file I am testing wi

[Tutor] file.read..... Abort Problem

2005-10-20 Thread Tomas Markus
Hello Pythoners, This is probably a very newbie question (after all I am one): I am trying to read a file with some 2500 lines and to do a scan for "not allowed" characters in there (such as accented ones and so on). The problem is that the file I am testing with has got one of those somewhere o