[issue1079] decode_header does not follow RFC 2047

2009-04-04 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: The email package does not follow the RFCs in anything to do with header parsing or decoding. This is a known deficiency. So no, I am not thinking of atoms at all -- and neither is email.header.decode_header()! :-( Until

[issue4487] Add utf8 alias for email charsets

2009-04-03 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: This seems entirely reasonable, helpful, and in accord with the mapping of ascii to us-ascii. I recommend accepting this patch or a slightly fancier one that would also do utf_8. There are pobably other encoding names

[issue4487] Add utf8 alias for email charsets

2009-04-03 Thread Tony Nelson
Changes by Tony Nelson tony_nel...@users.sourceforge.net: -- versions: +Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4487

[issue1079] decode_header does not follow RFC 2047

2009-04-03 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: I think the problem is best viewed as headers are not being parsed according to RFC2822 and decoded after that, so the recognition of encoded words should be looser, and not require whitespace around them, as it is not required

[issue4491] email.Header.decode_header() doesn't work if encoded-word was separeted by CRLF

2009-04-03 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: See patch in issue1079. I don't think email.header can require whitespace until it decodes parsed headers, as whitespace is not always required. -- nosy: +barry, tony_nelson versions: +Python 2.7

[issue1555570] email parser incorrectly breaks headers with a CRLF at 8192

2009-04-02 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: The OP's diagnosis of a buffer boundary problem is correct, but incomplete. The problem can be reproduced by calling feedparser FeedParser.feed() directly, or as my patch test does, by calling BufferedSubFile.push() directly

[issue3169] email/header.py doesn't handle Base64 headers that have been insufficiently padded.

2009-04-02 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: Postel's law suggests that, as bad padding can be repaired, decode_header ought to do so. The patch does that, adds a test for it, and alters another test to still properly fail on really bad encoded data. The test doesn't check

[issue3169] email/header.py doesn't handle Base64 headers that have been insufficiently padded.

2009-04-02 Thread Tony Nelson
Changes by Tony Nelson tony_nel...@users.sourceforge.net: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3169 ___ ___ Python-bugs

[issue5638] test_httpservers fails CGI tests if --enable-shared

2009-03-31 Thread Tony Nelson
New submission from Tony Nelson tony_nel...@users.sourceforge.net: test_httpservers fails the CGI tests if Python was built as a shared library (./config --enable-shared) and not yet installed. To run such a Python without installing it, the command line must define LD_LIBRARY_PATH to point

[issue1522237] _threading_local.py logic error in _localbase __new__

2009-03-30 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: Thanks, Amaury. The new test works here on Python2.6.1, failing without the fix and passing with it. (Passing MyLocal(a=1) and failing MyLocal(1), as expected.) With the fix, _threading_local.py supports positional arguments

[issue5610] email feedparser.py CRLFLF bug: $ vs \Z

2009-03-30 Thread Tony Nelson
New submission from Tony Nelson tony_nel...@users.sourceforge.net: feedparser.py does not pares mixed newlines properly. NLCRE_eol, which is used to search for the various newlines at End Of Line, uses $ to match the end of string, but $ also matches \n$, due to a wise long-ago patch

[issue5610] email feedparser.py CRLFLF bug: $ vs \Z

2009-03-30 Thread Tony Nelson
Tony Nelson tony_nel...@users.sourceforge.net added the comment: make test still passes all tests except test_httpservers on my Python 2.6.1 build. The network resource was not enabled and tk is not available. The new test for CRLFLF at the end of a message body is added to Lib/email

Re: python tutorial on a single html page?

2007-11-07 Thread Tony Nelson
In article [EMAIL PROTECTED], BartlebyScrivener [EMAIL PROTECTED] wrote: Is the main Python tutorial posted on single searchable page somewhere? As opposed to browsing the index and clicking NEXT etc. For completeness (though a bit late), I'll mention that Google can search a group of web

Re: Microsoft's Dynamic Languages Runtime (DLR)

2007-05-04 Thread Tony Nelson
In article [EMAIL PROTECTED], Kaz Kylheku [EMAIL PROTECTED] wrote: On May 2, 5:19 pm, sturlamolden [EMAIL PROTECTED] wrote: On May 3, 2:15 am, Kaz Kylheku [EMAIL PROTECTED] wrote: Kindly refrain from creating any more off-topic, cross-posted threads. Thanks. The only off-topic

Re: newbie needs help building Python 2.5 for Fedora Core 6

2007-02-24 Thread Tony Nelson
In article [EMAIL PROTECTED], bobmon [EMAIL PROTECTED] wrote: Hello, and please be gentle... I'm trying to build Python 2.5 on my Fedora Core 6 installation. I think I've resolved most of my problems, but make test reports an error for test_socket.py, shown below. I suppose my FC6

Re: Possible to set cpython heap size?

2007-02-23 Thread Tony Nelson
In article [EMAIL PROTECTED], Andy Watson [EMAIL PROTECTED] wrote: ... If I could have a heap that is larger and does not need to be dynamically extended, then the Python GC could work more efficiently. ... GC! If you're allocating lots of objects and holding on to them, GC will run

Re: Py3K idea: why not drop the colon?

2006-11-10 Thread Tony Nelson
In article [EMAIL PROTECTED], Bjoern Schliessmann [EMAIL PROTECTED] wrote: Michael Hobbs wrote: That is, assume that the expression ends at the colon, not at the newline. That would make this type of statement possible: if color == red or color == blue or color ==

Re: What is the best way to print the usage string ?

2006-08-05 Thread Tony Nelson
In article [EMAIL PROTECTED], Simon Forman [EMAIL PROTECTED] wrote: ... Python also concatenates adjacent strings, but the real newlines between your strings will need to be escaped (otherwise, because the newlines are statement separators, you will have one print statement followed by

Re: E' possibile integrare ironpython con visual studio 2005?

2006-08-05 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Alex Martelli) wrote: LaGuna [EMAIL PROTECTED] wrote: Se si come? Ciao by Enzo Questo newsgroup preferisce l'inglese -- per favore, chiedi su it.comp.lang.python invece che qui. This newsgroup prefers English -- please ask on

Re: Trace KeyboardInterrupt exception?

2006-06-15 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: if you want to interrupt the code to find out where it is, you can instead connect to it in gdb and get the python traceback of each thread. if you're interested I'll post the necesary gdb-macro for that (didn't put it

Re: Trace KeyboardInterrupt exception?

2006-06-14 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Tony Nelson wrote: I'm trying to find out what is eating some KeyboardInterrupt exceptions in a fairly large program (yum). My KeyboardInterrupt handler is called for some Ctl-C presses, but for others nothing seems to happen

Trace KeyboardInterrupt exception?

2006-06-13 Thread Tony Nelson
I'm trying to find out what is eating some KeyboardInterrupt exceptions in a fairly large program (yum). My KeyboardInterrupt handler is called for some Ctl-C presses, but for others nothing seems to happen. Grepping the source (what of it I've found, looking at import statements) doesn't

Re: time.sleep(1) sometimes runs for 200 seconds under windows

2006-02-26 Thread Tony Nelson
In article [EMAIL PROTECTED], Claudio Grondi [EMAIL PROTECTED] wrote: Claudio Grondi wrote: Claudio Grondi wrote: Paul Probert wrote: Peter Hansen wrote: Are you saying that you believe the time.sleep(1) call is actually blocking for 200 seconds? With such rare occurrence

Re: super(...).__init__() vs Base.__init__(self)

2006-02-09 Thread Tony Nelson
In article [EMAIL PROTECTED], Jan Niklas Fingerle [EMAIL PROTECTED] wrote: ...Super is a good tool to use, when dealing with diamond shape inheritance. In any other case I would use the direct calls to the base classes. In fact, i've yet to find a non-textbook-case where I really need

Re: Wingide is a beautiful application

2006-01-05 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Tony Nelson wrote: [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: My goal is to make my conf files into a decent drop-in so you just put them in your .vim directory and go, and post them next week. OK, thank you

Re: Wingide is a beautiful application

2005-12-22 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Tony Nelson wrote: So, you bind check_current_block() to the Enter key? Yeah. The binding's not quite just C-Ocheck_current_block()CR because you need a bit of magic to keep autoindent working. I'll post

Re: Wingide is a beautiful application

2005-12-21 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Tony Nelson wrote: 1. Python syntax checking: as I'm typing along, if I input a syntax error then the line is immediately highlighted in red. What do you use to do this? Cream doesn't seem to do this oob

Re: Wingide is a beautiful application

2005-12-21 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Tony Nelson wrote: OK, I can tell that this is Python code, not VI script stuff. I'll need to see how your vimrc sets this up. vim has a Python interpreter embedded in it (assuming it's a reasonably complete build

Re: Wingide is a beautiful application

2005-12-19 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ... I get the feeling that a ot of people working with heavy IDEs don't realize how capable vim/emacs are, so I'll give a brief rundown of what my Vim environment does for me. (I do Python web development)--if you

Re: OO in Python? ^^

2005-12-10 Thread Tony Nelson
In article [EMAIL PROTECTED], Matthias Kaeppler [EMAIL PROTECTED] wrote: ... obj = Base() # I want a base class reference which is polymorphic obj now refers to an instance of Base. if (need D1): obj = D1() obj now refers to an instance of D1(). The Base instance is unreferenced.

How to keep Pydoc from listing too much?

2005-12-02 Thread Tony Nelson
How can I tell Pydoc not to list information for some of the base classes? For example, when a class inherits from gtk.Widget, lots of GTK stuff gets added that doesn't really need to be there. Is there some option to Pydoc to tell it to skip some classes? Is there something I can put in my

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-02 Thread Tony Nelson
In article [EMAIL PROTECTED], Dave Hansen [EMAIL PROTECTED] wrote: On 2 Dec 2005 10:08:21 -0800 in comp.lang.python, [EMAIL PROTECTED] wrote: Here it is again... Python bypassed/discounted because, of all things, scoping by indentation!?!? This used to surprise me. Until I hear more

Pydoc: restrict base class doc?

2005-11-30 Thread Tony Nelson
I'd like to prevent Pydoc from adding base class documentation for some of my classes. Specifically, I have a couple of classes that derive from GTK widgets, and dumping all that documentation in doesn't have much benefit. Is there some thing I can do in my source, or to Pydoc, to tell it to

Re: ncurses' Dark Devilry

2005-11-29 Thread Tony Nelson
In article [EMAIL PROTECTED], Jeremy Moles [EMAIL PROTECTED] wrote: I'm working on a project using ncurses w/ Python. As an aside, I implemented addchstr in the cursesmodule.c file in Python SVN, if anyone wants me to try and get that made permanent. AT ANY RATE... I was wondering--and

Re: unicode speed

2005-11-29 Thread Tony Nelson
In article [EMAIL PROTECTED], David Siroky [EMAIL PROTECTED] wrote: Hi! I need to enlighten myself in Python unicode speed and implementation. My platform is AMD [EMAIL PROTECTED] (x86-32), Debian, Python 2.4. First a simple example (and time results): x = a*5000 real

Re: wxPython : getting started

2005-11-29 Thread Tony Nelson
In article [EMAIL PROTECTED], David Sulc [EMAIL PROTECTED] wrote: Hi ! I've looked all over (internet, books, etc.) and I haven't found a very good ressource to get started with wxPython (yes, I've been through their tutorial). What I would basically like to do for starters is to be

Re: Mixed types and variants

2005-11-23 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: ... - Maybe someone here can suggest some other variant type, or some other solution. Pyrex? Pyrex is mostly like Python with the possibility of C types. It handles mixed types just like Python, and the C code it produces is sort of

Re: Using gettext to provide different language-version of a script

2005-11-22 Thread Tony Nelson
In article [EMAIL PROTECTED], Thomas W [EMAIL PROTECTED] wrote: I'm trying to wrap my head around the docs at python.org related to the gettext-module, but I'm having some problem getting it to work. Is there any really simple, step-by-step on how to use this module available? This is my

Re: modifying small chunks from long string

2005-11-14 Thread Tony Nelson
In article [EMAIL PROTECTED], MackS [EMAIL PROTECTED] wrote: Hello everyone I am faced with the following problem. For the first time I've asked myself might this actually be easier to code in C rather than in python?, and I am not looking at device drivers. : ) This program is meant to

Re: ? MDI depreciated

2005-11-06 Thread Tony Nelson
In article [EMAIL PROTECTED], LenS [EMAIL PROTECTED] wrote: Hate to ask this dum question (since I've been hiding under a rock). But if the MDI UI model is/was depreciated. What is the new UI model. Would love some links that explain in gerneral and specific terms. In article [EMAIL

Validate string as UTF-8?

2005-11-06 Thread Tony Nelson
I'd like to have a fast way to validate large amounts of string data as being UTF-8. I don't see a fast way to do it in Python, though: unicode(s,'utf-8').encode('utf-8) seems to notice at least some of the time (the unicode() part works but the encode() part bombs). I don't consider a

Re: Validate string as UTF-8?

2005-11-06 Thread Tony Nelson
In article [EMAIL PROTECTED], david mugnai [EMAIL PROTECTED] wrote: On Sun, 06 Nov 2005 18:58:50 +, Tony Nelson wrote: [snip] Is there a general way to call GLib functions? ctypes? http://starship.python.net/crew/theller/ctypes/ Umm. Might be easier to write an extension module

Re: Validate string as UTF-8?

2005-11-06 Thread Tony Nelson
In article [EMAIL PROTECTED], Fredrik Lundh [EMAIL PROTECTED] wrote: Tony Nelson wrote: I'd like to have a fast way to validate large amounts of string data as being UTF-8. define validate. All data conforms to the UTF-8 encoding format. I can stand if someone has made data

Re: when and how do you use Self?

2005-11-04 Thread Tony Nelson
In article [EMAIL PROTECTED], Tieche Bruce A MSgt USMTM/AFD [EMAIL PROTECTED] wrote: I am new to python, Could someone explain (in English) how and when to use self? I have been reading, and haven't found a good example/explanation http://docs.python.org/tut is a good explanation of just

Re: NTFS reparse points

2005-11-03 Thread Tony Nelson
In article [EMAIL PROTECTED], Stanislaw Findeisen [EMAIL PROTECTED] wrote: ... However I can't see FILE_ATTRIBUTE_REPARSE_POINT turned on in any file / directory shortcuts I create. In fact the only attribute set in shortcuts created using Windows Explorer is FILE_ATTRIBUTE_ARCHIVE. (I am

Re: Scanning a file

2005-10-30 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Steve Holden wrote: Indeed, but reading one byte at a time is about the slowest way to process a file, in Python or any other language, because it fails to amortize the overhead cost of function calls over many characters.

Any Pythonic GTK Undo library?

2005-10-29 Thread Tony Nelson
I'm looking for a pythonic GTK Undo library/class. It would have a framework for Undo/Redo, and would provide Undo/Redo for TextView, Entry, and containers and other classes. In a batteries included fashion, just instantiating a UndoableTextView or UndoableEntry or UndoableContainer would

Re: Any Pythonic GTK Undo library?

2005-10-29 Thread Tony Nelson
In article [EMAIL PROTECTED], Dave Cook [EMAIL PROTECTED] wrote: On 2005-10-29, Tony Nelson [EMAIL PROTECTED] wrote: I'm looking for a pythonic GTK Undo library/class. It would have a You might ask the authors of Kiwi if they plan to add undo/redo. Or help them add it if you can

Re: How best to reference parameters.

2005-10-25 Thread Tony Nelson
In article [EMAIL PROTECTED], David Poundall [EMAIL PROTECTED] wrote: I am writing a scada package that has a significant amount of user defined parameters stored in text files that I wish to cleanly access in code. By way of an example, a few lines from the configuration file would

Re: How do you draw this layout with wxpython?

2005-10-17 Thread Tony Nelson
In article [EMAIL PROTECTED], Young H. Rhiu [EMAIL PROTECTED] wrote: See: http://hilug.org/img/app_layout.GIF I'm implementing an album-like application with wxpython but I'm new to wxPython though I know how to program with python. The problem is that it's not easy for me to deal with

Re: Stripping ASCII codes when parsing

2005-10-17 Thread Tony Nelson
In article [EMAIL PROTECTED], David Pratt [EMAIL PROTECTED] wrote: I am working with a text format that advises to strip any ascii control characters (0 - 30) as part of parsing data and also the ascii pipe character (124) from the data. I think many of these characters are from a

Mutual module imports

2005-10-17 Thread Tony Nelson
How does one normally make a Python extension module that has some parts in Python and some functions in C share globals between the Python and C functions? Will that approach work with Pyrex? I have written a Python module that uses some C functions. I wrote the module in two parts, one

Re: Stripping ASCII codes when parsing

2005-10-17 Thread Tony Nelson
In article [EMAIL PROTECTED], David Pratt [EMAIL PROTECTED] wrote: This is very nice :-) Thank you Tony. I think this will be the way to go. My concern ATM is where it will be best to unicode. The data after this will go into dict and a few processes and into database. Because input

[ANN] Speed up Charmap codecs with fastcharmap module

2005-10-16 Thread Tony Nelson
Fastcharmap is a python extension module that speeds up Charmap codecs by about 5 times. http://georgeanelson.com/fastcharmap.htm Usage: import fastcharmap fastcharmap.hook('codec_name') Fastcharmap will then speed up calls that use that codec, such as unicode(str, 'codec_name') and

Re: Can module access global from __main__?

2005-10-15 Thread Tony Nelson
In article [EMAIL PROTECTED], Neal Norwitz [EMAIL PROTECTED] wrote: Steve Holden wrote: Neal Becker wrote: Still curious about the answer. If I know that I am imported from __main__, then I can do access X as sys.modules[__main__].X. In general, I don't know how to

Re: C Wrapper Function, crashing Python?

2005-10-14 Thread Tony Nelson
In article [EMAIL PROTECTED], Java and Swing [EMAIL PROTECTED] wrote: one more update... if I remove PyMem_Free and free(...) ...so no memory clean up...I can still only call doStuff 4 times, the 5th attemp crashes Python. Java and Swing wrote: update: if I use C's free(result),

Re: how to make this code faster

2005-10-14 Thread Tony Nelson
In article [EMAIL PROTECTED], [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: def f(x,y): return math.sin(x*y) + 8 * x I have code like this: def main(): n = 2000 a = zeros((n,n), Float) xcoor = arange(0,1,1/float(n)) ycoor = arange(0,1,1/float(n)) for i in

Re: Controlling who can run an executable

2005-10-04 Thread Tony Nelson
In article [EMAIL PROTECTED], Cigar [EMAIL PROTECTED] wrote: I am developing a program for a client. She runs a shop where her clients bring in items for sale or short term buyback. Development of the program has been going great but she's mentioned that there is a 'feature' coming up in

Re: Unicode charmap decoders slow

2005-10-03 Thread Tony Nelson
In article [EMAIL PROTECTED], Martin v. Löwis [EMAIL PROTECTED] wrote: Tony Nelson wrote: Is there a faster way to decode from charmaps to utf-8 than unicode()? You could try the iconv codec, if your system supports iconv: http://cvs.sourceforge.net/viewcvs.py/python-codecs

Re: Unicode charmap decoders slow

2005-10-03 Thread Tony Nelson
In article [EMAIL PROTECTED], Martin v. Löwis [EMAIL PROTECTED] wrote: Tony Nelson wrote: I had seen iconv. Even if my system supports it and it is faster than Python's charmap decoder, it might not be available on other systems. Requiring something unusual in order to do a trivial

Re: Exception raising, and performance implications.

2005-10-03 Thread Tony Nelson
In article [EMAIL PROTECTED], leo [EMAIL PROTECTED] wrote: Hello all - I was wondering about the performance implications of explicitly raising exceptions to get information about the current frame. Something like what the inspect module does, with: Python uses exceptions internally,

Unicode charmap decoders slow

2005-10-02 Thread Tony Nelson
Is there a faster way to decode from charmaps to utf-8 than unicode()? I'm writing a small card-file program. As a test, I use a 53 MB MBox file, in mac-roman encoding. My program reads and parses the file into messages in about 3..5 seconds, but takes about 13.5 seconds to iterate over the

gtk.TextView.move_mark_onscreen() broken?

2005-10-02 Thread Tony Nelson
Is gtk.TextView.move_mark_onscreen() broken? Perhaps only in Python's gtk module, in Python 2.3, gtk 2.4.14? I'm asking here because I'm using gtk from Python and don't want to write a C program to verify my issue. I've also tried gtk.TextView.scroll_to_mark() and