[issue10574] email.header.decode_header fails if the string contains multiple directives

2010-11-28 Thread Roy H. Han
New submission from Roy H. Han starsareblueandfara...@gmail.com: email.header.decode_header fails for the following message subject: :: email.header.decode_header('=?UTF-8?B?MjAxMSBBVVRNIENBTEwgZm9yIE5PTUlO?==?UTF-8?B?QVRJT05TIG9mIFZQIGZvciBNZW1iZXJz?==?UTF-8?B?aGlw?=') If the directives

[issue1598] unexpected response in imaplib

2009-03-24 Thread Roy H. Han
Roy H. Han starsareblueandfara...@gmail.com added the comment: I'm also getting the same error retrieving a message through IMAP from a Lotus Notes server. Traceback (most recent call last): File mail.py, line 152, in module if 'setup' == argument: setup() File mail.py, line 61

[issue1598] unexpected response in imaplib

2009-03-24 Thread Roy H. Han
Roy H. Han starsareblueandfara...@gmail.com added the comment: Using a different format, it seems the message involves cryptographic keys signed by Lotus Notes? server.fetch(407, '(BODY.PEEK[HEADER] FLAGS)') To: pers...@place.com Subject: subject Message-ID: x...@place.com Date: Tue, 28 Oct

Re: Using xreadlines

2009-02-27 Thread Roy H. Han
Brett, I'm not sure what exactly you're trying to do, but you can keep track of line numbers using itertools. import itertools for lineIndex, line in itertools.izip(itertools.count(1), open('text.txt')): print lineIndex, line Here is sample code for breaking on a word and returning the

Re: Using xreadlines

2009-02-27 Thread Roy H. Han
On Fri, Feb 27, 2009 at 12:20 PM, Scott David Daniels scott.dani...@acm.org wrote: (1) Please do not top post in comp.lang.python, it violates conventions. Brett Hedges (should have written): bearophile wrote: ... You can also keep track of the absolute position of the lines in the file,

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-25 Thread Roy H. Han
V6.00.2900.5579 RHH On Wed, Feb 25, 2009 at 8:39 AM, rdmur...@bitdance.com wrote: John Machin sjmac...@lexicon.net wrote: On Feb 25, 11:07=A0am, Roy H. Han starsareblueandfara...@gmail.com wrote: Dear python-list, I'm having some trouble decoding an email header using the standard

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-25 Thread Roy H. Han
Cool, it works! Thanks, RDM, for stating the right approach. Thanks, Steve, for teaching by example. I wonder why the email.message_from_string() method doesn't call email.header.decode_header() automatically. On Wed, Feb 25, 2009 at 9:50 AM, rdmur...@bitdance.com wrote: Steve Holden

How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-24 Thread Roy H. Han
Dear python-list, I'm having some trouble decoding an email header using the standard imaplib.IMAP4 class and email.message_from_string method. In particular, email.message_from_string() does not seem to properly decode unicode characters in the subject. How do I decode unicode characters in

Re: Where to host a (Python) project?

2009-01-31 Thread Roy H. Han
I really like WebFaction for web-based Python projects. It's a paid web-hosting service, though. What I like is how they always have the most up-to-date Python packages and frameworks using one-click installers. On Sat, Jan 31, 2009 at 4:30 PM, andrew cooke and...@acooke.org wrote: On Jan 31,

Re: RELEASED Python 3.0 final

2008-12-04 Thread Roy H. Han
Hi, This is great, however, the link to the What's New page appears to be broken. http://docs.python.org/dev/3.0/whatsnew/3.1.html RHH On Thu, Dec 4, 2008 at 8:37 AM, Istvan Albert [EMAIL PROTECTED]wrote: Congratulations on a fantastic work! --

Re: Is there a faster way to do this?

2008-08-05 Thread Roy H. Han
Why not just use sets? a = set() a.add(1) a.add(2) On Tue, Aug 5, 2008 at 10:14 PM, RPM1 [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: I have a csv file containing product information that is 700+ MB in size. I'm trying to go through and pull out unique product ID's only as there are a

Re: % sign in python?

2008-07-17 Thread Roy H. Han
The percent sign is a placeholder. For example, if level = 1 msg = 'look' Then '[[Log level %d: %s]]' % ( level, msg ) becomes '[[Log level 1: look]]' %d means insert an integer %s means insert a string You can also use dictionaries. d = {'string1': 'hey', 'string2': 'you'} Then '%(string1)s

Re: property getter with more than 1 argument?

2008-07-17 Thread Roy H. Han
I don't understand what you're trying to do here. On Thu, Jul 17, 2008 at 10:57 AM, mk [EMAIL PROTECTED] wrote: It seems like getter is defined in such way that it passes only 'self': class FunDict(dict): def __init__(self): self.fundict = dict() def

Re: Pythonwin

2008-05-09 Thread Roy H. Han
Hi Clive, For ArcGIS, I use plain old VIM, IPython and IDLE. If you really want PythonWin, then you can download Mark Hammond's Python for Windows extensions: http://sourceforge.net/projects/pywin32/ Note also that with the pywin32 extensions, you can also use Python 2.5 to access ArcGIS using

Re: Question.

2008-04-04 Thread Roy H. Han
Your boyfriend is pretty funny. I tried to get my girlfriend to learn Python a long time ago but she doesn't see value in it. On Fri, Apr 4, 2008 at 12:31 AM, AJay Grimmett [EMAIL PROTECTED] wrote: My name is Amanda. My boyfriend sent me an encrypted message by using python. I guess he

Re: Python-by-example - new online guide to Python Standard Library

2008-04-01 Thread Roy H. Han
Learning by example is the best. I remember working through a book when I was little called Qbasic by Example. On Tue, Apr 1, 2008 at 9:15 PM, AK [EMAIL PROTECTED] wrote: Hello, I find that I learn easier when I go from specific examples to a more general explanation of function's utility

Re: Where's GUI for Python?

2008-03-02 Thread Roy H. Han
Hi Konrad, I remember taking a long time in deciding which GUI framework to use last year and I picked wxGlade/wxPython because it seemed mature, easy to use and easy to understand. In the beginning I wasted a lot of time coding the GUI manually but wxGlade lets me use the mouse to arrange the

Re: Where's GUI for Python?

2008-03-01 Thread Roy H. Han
Konrad, I use wxPython with wxGlade. I love wxGlade! wxGlade http://wxglade.sourceforge.net/ You need to look at this documentation to code event handling. wxWidgets http://www.wxwidgets.org/manuals/stable/wx_classesbycat.html You can also try coding the GUI manually, but it is much easier to