Re: Unicode error in sax parser

2011-02-09 Thread Rickard Lindberg
On Tue, Feb 8, 2011 at 5:41 PM, Chris Rebert wrote: > On Tue, Feb 8, 2011 at 7:57 AM, Rickard Lindberg wrote: >> Hi, >> >> Here is a bash script to reproduce my error: > > Including the error message and traceback is still helpful, for future > reference.

Re: Unicode error in sax parser

2011-02-09 Thread Rickard Lindberg
does >sys.getfilesystemencoding() give you? > >Stefan Since I'm not registered on the Python mailing list I had some trouble replying to your message. My getfilesystemencoding() returns utf-8. -- Rickard Lindberg -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode error in sax parser

2011-02-09 Thread Rickard Lindberg
er.py", line 119, in parse self.prepareParser(source) File "/usr/lib64/python2.7/site-packages/_xmlplus/sax/expatreader.py", line 121, in prepareParser self._parser.SetBase(source.getSystemId()) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 0: ordinal not in range(128) The open(..) part works fine, but there still seems to be a problem inside the sax parser. -- Rickard Lindberg -- http://mail.python.org/mailman/listinfo/python-list

Unicode error in sax parser

2011-02-08 Thread Rickard Lindberg
Hi, Here is a bash script to reproduce my error: #!/bin/sh cat > å.timeline < 0.13.0devb38ace0a572b+ 2011-02-01 00:00:00 2011-02-03 08:46:00 asdsd 2011-01-24 16:38:11

Re: Creating alot of class instances?

2009-07-05 Thread Rickard Lindberg
instance(name): for instance in instance_list: if instance.name == name: return instance return None Note that this might very well return None if no instance with that particular name was found. -- Rickard Lindberg -- http://mail.python.org/mailman/listinfo/python-list

Re: Is code duplication allowed in this instance?

2009-07-03 Thread Rickard Lindberg
I don't see why you need to use the same algorithm in the test code. But maybe your case is special. On the other hand you can not perform black-box testing if the output is not known for a given input. -- Rickard Lindberg -- http://mail.python.org/mailman/listinfo/python-list

Re: Sequence splitting

2009-07-02 Thread Rickard Lindberg
post might appear on the list soon. The reason for getting those can be that it is a member only list and you posted from another address. I am not sure if that was the message you got. -- Rickard Lindberg -- http://mail.python.org/mailman/listinfo/python-list

Re: Match 2 words in a line of file

2007-01-19 Thread Rickard Lindberg
Daniel Klein wrote: > 2) This can be resolved with > > templine = ' ' + line + ' ' > if ' ' + word1 + ' ' in templine and ' ' + word2 + ' ' in templine: But then you will still have a problem to match the word "foo" in a string like "bar (foo)". -- http://mail.python.org/mailman/listinfo/python

Re: Match 2 words in a line of file

2007-01-18 Thread Rickard Lindberg
I see two potential problems with the non regex solutions. 1) Consider a line: "foo (bar)". When you split it you will only get two strings, as split by default only splits the string on white space characters. Thus "'bar' in words" will return false, even though bar is a word in that line. 2) If

Re: Match 2 words in a line of file

2007-01-18 Thread Rickard Lindberg
[EMAIL PROTECTED] wrote: > Hi > > Am pretty new to python and hence this question.. > > I have file with an output of a process. I need to search this file one > line at a time and my pattern is that I am looking for the lines that > has the word 'event' and the word 'new'. > > Note that i need lin