Correct auto line break in mail headers lines (subject)?
can anyone contribute to this question about correct auto line break in mail header lines: https://sourceforge.net/tracker/?func=detailaid=1645148group_id=5470atid=105470 -- http://mail.python.org/mailman/listinfo/python-list
[ python-Bugs-1645148 ] MIME renderer: wrong header line break with long subject?
Bugs item #1645148, was opened at 2007-01-26 11:04 Message generated for change (Comment added) made by kxroberto You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: kxroberto (kxroberto) Assigned to: Barry A. Warsaw (bwarsaw) Summary: MIME renderer: wrong header line break with long subject? Initial Comment: from email.MIMEText import MIMEText o=MIMEText('hello') o['Subject']='1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ' o.as_string() 'Content-Type: text/plain; charset=us-ascii\nMIME-Version: 1.0\nContent-Transf er-Encoding: 7bit\nSubject: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8\n\t9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 \n\ nhello' The '6 7 8\n\t9 1 2 3' clashes together to 6 7 89 1 2 3 without space between 89 in usual mail readers. Is this an error and should be : '6 7 8 \n\t9 1 2 3' ? as there is also the space preserved in '6 7 8 9 \n\nhello' -- Comment By: kxroberto (kxroberto) Date: 2007-06-08 14:11 Message: Logged In: YES user_id=972995 Originator: YES What would be the RFC definition for a correct auto-line break in a (subject) mail header line? Wouldn't it be more simple to not do any auto-line break for the subject? or is there a requirement for the line break in the RFC. Don't think any reader program would fail because of 79 char subject header lines. -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 22:17 Message: Logged In: YES user_id=12800 Originator: NO Whoops, this wasn't supposed to be a response to Tokio, but instead the OP. -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 22:16 Message: Logged In: YES user_id=12800 Originator: NO Tokio, I'm not so sure about adding that extra space. I tested all the mail readers at my disposal on Linux and OSX. I don't have any Windows machines available so I couldn't test Outlook or OE. (If you have them, please indicate what they do in a comment here!) Here's what I found: OSX: Mail.app 2.1.1 -- the extra space produces an extra space between the 8 and 9 both in the message summary and in the Subject header in the preview pane. The no extra space message looks fine. Thunderbird 1.5.0.10 -- The extra space message produces an extra space in the message summary, while the no extra space message looks fine here. But the weird thing is that in both the extra space and non-extra space cases, the Subject header in the preview pane both have extra spaces. It looks to me like the leading tab is being inserted into the Subject header view. Entourage 11.3.3 -- The extra space shows up in both the summary and preview panes but only in the message with the extra space Linux Thunderbird 1.5.0.10 -- both messages get a tab between the 8 and 9 in both the summary and preview pane. This is for both the extra space message and the no-extra space message; afaict, there's no difference between the two and this is definitely a difference between the Linux version and the OSX version of the same mail reader. Evolution 2.9.92 -- the extra space message produces an extra space between the 8 and 9 in both the summary and preview panes. The no-extra space message looks fine. Sylpheed Claws 2.6.0 -- the extra space message produces an extra space between the 8 and 9 in both the summary and preview panes. The no-extra space message looks file. So anyway, afaict, the extra space is not appropriate for any of the non-Windows mail readers. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1645148 ] MIME renderer: wrong header line break with long subject?
Bugs item #1645148, was opened at 2007-01-26 07:04 Message generated for change (Comment added) made by gagenellina You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: kxroberto (kxroberto) Assigned to: Barry A. Warsaw (bwarsaw) Summary: MIME renderer: wrong header line break with long subject? Initial Comment: from email.MIMEText import MIMEText o=MIMEText('hello') o['Subject']='1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ' o.as_string() 'Content-Type: text/plain; charset=us-ascii\nMIME-Version: 1.0\nContent-Transf er-Encoding: 7bit\nSubject: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8\n\t9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 \n\ nhello' The '6 7 8\n\t9 1 2 3' clashes together to 6 7 89 1 2 3 without space between 89 in usual mail readers. Is this an error and should be : '6 7 8 \n\t9 1 2 3' ? as there is also the space preserved in '6 7 8 9 \n\nhello' -- Comment By: Gabriel Genellina (gagenellina) Date: 2007-06-09 02:19 Message: Logged In: YES user_id=479790 Originator: NO Quoting RFC2822 section 2.2.3 ftp://ftp.rfc-editor.org/in-notes/rfc2822.txt: The general rule is that wherever this standard allows for folding white space (not simply WSP characters), a CRLF may be inserted before any WSP. For example, the header field: Subject: This is a test can be represented as: Subject: This is a test [...]Unfolding is accomplished by simply removing any CRLF that is immediately followed by WSP. That is, folding is done by inserting ONLY the sequence CRLF before any folding whitespace. When the header is interpreted, the whitespace is NOT removed, only the CRLF. The posted Subject header should become Subject: 1 2 3...7 8\n\r 9 1 2...' I think this is a bug in the email.header.Header class; its __init__ says, about the continuation_ws argument: [it] must be RFC 2822 compliant folding whitespace (usually either a space or a hard tab) which will be prepended to continuation lines.. Folding does not involve *prepending* any whitespace, just inserting CRLF right before *existing* whitespace. Note that this is wrong even for the old RFC 822 (with slightly different rules for line folding.) -- Comment By: kxroberto (kxroberto) Date: 2007-06-08 09:11 Message: Logged In: YES user_id=972995 Originator: YES What would be the RFC definition for a correct auto-line break in a (subject) mail header line? Wouldn't it be more simple to not do any auto-line break for the subject? or is there a requirement for the line break in the RFC. Don't think any reader program would fail because of 79 char subject header lines. -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 18:17 Message: Logged In: YES user_id=12800 Originator: NO Whoops, this wasn't supposed to be a response to Tokio, but instead the OP. -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 18:16 Message: Logged In: YES user_id=12800 Originator: NO Tokio, I'm not so sure about adding that extra space. I tested all the mail readers at my disposal on Linux and OSX. I don't have any Windows machines available so I couldn't test Outlook or OE. (If you have them, please indicate what they do in a comment here!) Here's what I found: OSX: Mail.app 2.1.1 -- the extra space produces an extra space between the 8 and 9 both in the message summary and in the Subject header in the preview pane. The no extra space message looks fine. Thunderbird 1.5.0.10 -- The extra space message produces an extra space in the message summary, while the no extra space message looks fine here. But the weird thing is that in both the extra space and non-extra space cases, the Subject header in the preview pane both have extra spaces. It looks to me like the leading tab is being inserted into the Subject header view. Entourage 11.3.3 -- The extra space shows up in both the summary and preview panes but only in the message with the extra space Linux Thunderbird 1.5.0.10 -- both messages get a tab between the 8 and 9 in both the summary and preview pane. This is for both the extra space message and the no-extra space message; afaict, there's no difference between the two and this is definitely a difference between the Linux version and the OSX version of the same mail reader
[no subject]
Announcing -- The 2.8.4.0 release of wxPython is now available for download at http://wxpython.org/download.php. This release includes a number of bug fixes, updates to some contribs and other improvements. Source code is available, as well as binaries for both Python 2.4 and 2.5, for Windows and Mac, as well some pacakges for various Linux distributions. A summary of changes is listed below and also at http://wxpython.org/recentchanges.php. What is wxPython? - wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a Python extension module that wraps the GUI components of the popular wxWidgets cross platform library, which is written in C++. wxPython is a cross-platform toolkit. This means that the same program will usually run on multiple platforms without modifications. Currently supported platforms are 32-bit Microsoft Windows, most Linux or other Unix-like systems using GTK2, and Mac OS X 10.3+, in most cases the native widgets are used on each platform to provide a 100% native look and feel for the application. Changes in 2.8.4.0 -- wxGTK: Make wx.NO_BORDER style work with wx.RadioBox (patch 1525406) Update to 1.0 of TreeMixin. wx.lib.customtreectrl: Patch from Andrea that fixes the following problems/issues: * ZeroDivisionError when using the Vista selection style and calling SelectItem; for some strange reason, sometimes the item rect is not initialized and that generates the ZeroDivisionError when painting the selection rectangle; * Added a DeleteWindow method to GenericTreeItem class, for items that hold a widget next to them; * Renamed CustomTreeCtrl method IsEnabled to IsItemEnabled, otherwise it conflicts with wx.Window.IsEnabled; * Now CustomTreeCtrl behaves correctly when the widget attached to an item is narrower (in height) than the item text; wx.lib.flatnotebook: Patch from Andrea that implements the following: * A new style FNB_FF2: my intentions were to make it like Firefox 2, however it turned out to be an hybrid between wxAUI notebook glose style FF2 ...I still think it looks OK. The main purpose for making it more like wxAUI is to allow applications that uses both to have same look and feel (or as close as it can get...); * Changed the behavior of the left/right rotation arrows to rotate single tab at a time and not bulk of tabs; * Updated the demo module. XRCed now uses a wx.FileHistory object for managing the recent files menu. wx.DateSpan and wx.TimeSpan now use lower case property names in order to not conflict with the same named static methods that already existed. wx.aui.PyAuiDocArt and wx.aui.PyAuiTabArt can now be derived from in wxPython and plugged in to wx.AUI. XRCed has a new experimental feature to add controls by draging icons from the tool palette to the test window. Mouse position is tracked to highlight the future parent of the new item. Updates to MaskedEdit controls from Will Sadkin: maskededit.py: Added parameter option stopFieldChangeIfInvalid, which can be used to relax the validation rules for a control, but make best efforts to stop navigation out of that field should its current value be invalid. Note: this does not prevent the value from remaining invalid if focus for the control is lost, via mousing etc. numctrl.py, demo / MaskedNumCtrl.py: In response to user request, added limitOnFieldChange feature, so that out-of-bounds values can be temporarily added to the control, but should navigation be attempted out of an invalid field, it will not navigate, and if focus is lost on a control so limited with an invalid value, it will change the value to the nearest bound. combobox.py: Added handler for EVT_COMBOBOX to address apparently inconsistent behavior of control when the dropdown control is used to do a selection. textctrl.py Added support for ChangeValue() function, similar to that of the base control, added in wxPython 2.7.1.1. Update to latest FloatCanvas from Chris Barker. The pywxrc tool now properly supports generating classes for menus and menubars, and also creating attributes for menus, menubars and menu items. -- Robin Dunn Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython! -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hi, I have a problem to install wxPython on my MacBook (Pythonversion 2.5). If would install the wxPython (python setup.py install), then I got this error: Traceback (most recent call last): File /Users/marco/Desktop/flexo1/wxpython/wxPython-src-2.8.3.0/ wxPython/setup.py, line 49, in module copy_file('config.py', 'wx/build', update=1, verbose=1) File /Users/marco/python//lib/python2.5/distutils/file_util.py, line 119, in copy_file can't copy '%s': doesn't exist or not a regular file % src distutils.errors.DistutilsFileError: can't copy 'config.py': doesn't exist or not a regular file Where is the problem and how could i fix it? Thx for your answers. marco -- http://mail.python.org/mailman/listinfo/python-list
Subject line with smtplib.sendmail()
Hey, I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? Thanks in advance for the help. Emile Boudreau This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Subject line with smtplib.sendmail()
Boudreau, Emile wrote: I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? you have to add the headers yourself. see the example in the library reference, or this FAQ entry: http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script /F -- http://mail.python.org/mailman/listinfo/python-list
RE: Subject line with smtplib.sendmail()
Thanks for the reply. When I use the instruction from that list this is the email I receive. I'm using Outlook. [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work It's just adding the From To Subject in the message itself. I want to have each field at the correct place and then just the msg in the body. Any Help?? Thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: Tuesday, March 20, 2007 11:08 AM To: python-list@python.org Subject: Re: Subject line with smtplib.sendmail() Boudreau, Emile wrote: I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? you have to add the headers yourself. see the example in the library reference, or this FAQ entry: http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script /F -- http://mail.python.org/mailman/listinfo/python-list This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Subject line with smtplib.sendmail()
On Mar 20, 12:50 pm, Boudreau, Emile [EMAIL PROTECTED] wrote: Thanks for the reply. When I use the instruction from that list this is the email I receive. I'm using Outlook. [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work It's just adding the From To Subject in the message itself. I want to have each field at the correct place and then just the msg in the body. Any Help?? Thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: Tuesday, March 20, 2007 11:08 AM To: [EMAIL PROTECTED] Subject: Re: Subject line with smtplib.sendmail() Boudreau, Emile wrote: I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? you have to add the headers yourself. see the example in the library reference, or this FAQ entry: http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script /F --http://mail.python.org/mailman/listinfo/python-list This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. I'm not sure what the problem is. But here's how we do it at my place of work: import smtplib import string def sendMail(subject, body, TO = [EMAIL PROTECTED], FROM=[EMAIL PROTECTED]): HOST = mailserver BODY = string.join(( From: %s % FROM, To: %s % TO, Subject: %s % subject, , body ), \r\n) server = smtplib.SMTP(HOST) server.sendmail(FROM, [TO], BODY) server.quit() This works well for us. Mike -- http://mail.python.org/mailman/listinfo/python-list
RE: Subject line with smtplib.sendmail()
Sorry folks. Scrape the last one that I sent. I noticed that it sends the email perfectly if the code is not in any of my methods but the second I insert it into a method I get the ugly email that I described in my last email. Does anyone know how I can get this code in my method so that I have access to all the variables I have? thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Boudreau, Emile Sent: Tuesday, March 20, 2007 1:51 PM To: python-list@python.org Subject: RE: Subject line with smtplib.sendmail() Thanks for the reply. When I use the instruction from that list this is the email I receive. I'm using Outlook. [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work It's just adding the From To Subject in the message itself. I want to have each field at the correct place and then just the msg in the body. Any Help?? Thanks Emile Boudreau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Fredrik Lundh Sent: Tuesday, March 20, 2007 11:08 AM To: python-list@python.org Subject: Re: Subject line with smtplib.sendmail() Boudreau, Emile wrote: I'm trying to send mail from my server to my machine with test results. I can send the email no problem however, the email doesn't contain a recipient list or a subject line. I was wondering how would I go about getting the information on the actual To and Subject lines so that I know to whom the email was sent and the subject line without opening the email? you have to add the headers yourself. see the example in the library reference, or this FAQ entry: http://effbot.org/pyfaq/how-do-i-send-mail-from-a-python-script /F -- http://mail.python.org/mailman/listinfo/python-list This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Subject line with smtplib.sendmail()
En Tue, 20 Mar 2007 15:18:01 -0300, Boudreau, Emile [EMAIL PROTECTED] escribió: Sorry folks. Scrape the last one that I sent. I noticed that it sends the email perfectly if the code is not in any of my methods but the second I insert it into a method I get the ugly email that I described in my last email. Does anyone know how I can get this code in my method so that I have access to all the variables I have? I don't understand exactly what you mean, but looking at your example: [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work It's just adding the From To Subject in the message itself. I want to have each field at the correct place and then just the msg in the body. Perhaps you are using an indented triple quoted string ? The indentation goes into the string itself. You may use a global (module) constant to hold the string, by example. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Subject line with smtplib.sendmail()
Gabriel Genellina [EMAIL PROTECTED] writes: Perhaps you are using an indented triple quoted string ? The indentation goes into the string itself. You may use a global (module) constant to hold the string, by example. Rather than letting technical issues dictate where to place your code, you can keep the indentation for code readability and remove it when the data is processed:: import textwrap def get_text(): ... raw_text = \ ... Blah blah ... spam eggs spam ... ... text = textwrap.dedent(raw_text) ... return text ... foo = get_text() print foo Blah blah spam eggs spam -- \Somebody told me how frightening it was how much topsoil we | `\ are losing each year, but I told that story around the campfire | _o__) and nobody got scared. -- Jack Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hello, I'm trying to exclude files from a list using the following code: for item in dirs:if item.find('Software') -1:dirs.remove(item) elif item.find('Images') -1:dirs.remove(item) let's supose dirs = ['C:\Images', 'C:\Images\2006', 'C:\Images\2007', 'C:\Music', 'C:\Files', 'C:\Software', 'C:\Software\Python', 'C:\Software\iTunes'] For some reason.. it just won't exclude them. I'd like to know why and how to fix it. Thanks in advance. Milton _ Explore the seven wonders of the world http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE-- http://mail.python.org/mailman/listinfo/python-list
[ python-Bugs-1645148 ] MIME renderer: wrong header line break with long subject?
Bugs item #1645148, was opened at 2007-01-26 05:04 Message generated for change (Comment added) made by bwarsaw You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: kxroberto (kxroberto) Assigned to: Barry A. Warsaw (bwarsaw) Summary: MIME renderer: wrong header line break with long subject? Initial Comment: from email.MIMEText import MIMEText o=MIMEText('hello') o['Subject']='1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ' o.as_string() 'Content-Type: text/plain; charset=us-ascii\nMIME-Version: 1.0\nContent-Transf er-Encoding: 7bit\nSubject: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8\n\t9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 \n\ nhello' The '6 7 8\n\t9 1 2 3' clashes together to 6 7 89 1 2 3 without space between 89 in usual mail readers. Is this an error and should be : '6 7 8 \n\t9 1 2 3' ? as there is also the space preserved in '6 7 8 9 \n\nhello' -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 17:16 Message: Logged In: YES user_id=12800 Originator: NO Tokio, I'm not so sure about adding that extra space. I tested all the mail readers at my disposal on Linux and OSX. I don't have any Windows machines available so I couldn't test Outlook or OE. (If you have them, please indicate what they do in a comment here!) Here's what I found: OSX: Mail.app 2.1.1 -- the extra space produces an extra space between the 8 and 9 both in the message summary and in the Subject header in the preview pane. The no extra space message looks fine. Thunderbird 1.5.0.10 -- The extra space message produces an extra space in the message summary, while the no extra space message looks fine here. But the weird thing is that in both the extra space and non-extra space cases, the Subject header in the preview pane both have extra spaces. It looks to me like the leading tab is being inserted into the Subject header view. Entourage 11.3.3 -- The extra space shows up in both the summary and preview panes but only in the message with the extra space Linux Thunderbird 1.5.0.10 -- both messages get a tab between the 8 and 9 in both the summary and preview pane. This is for both the extra space message and the no-extra space message; afaict, there's no difference between the two and this is definitely a difference between the Linux version and the OSX version of the same mail reader. Evolution 2.9.92 -- the extra space message produces an extra space between the 8 and 9 in both the summary and preview panes. The no-extra space message looks fine. Sylpheed Claws 2.6.0 -- the extra space message produces an extra space between the 8 and 9 in both the summary and preview panes. The no-extra space message looks file. So anyway, afaict, the extra space is not appropriate for any of the non-Windows mail readers. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1645148 ] MIME renderer: wrong header line break with long subject?
Bugs item #1645148, was opened at 2007-01-26 05:04 Message generated for change (Comment added) made by bwarsaw You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: kxroberto (kxroberto) Assigned to: Barry A. Warsaw (bwarsaw) Summary: MIME renderer: wrong header line break with long subject? Initial Comment: from email.MIMEText import MIMEText o=MIMEText('hello') o['Subject']='1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ' o.as_string() 'Content-Type: text/plain; charset=us-ascii\nMIME-Version: 1.0\nContent-Transf er-Encoding: 7bit\nSubject: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8\n\t9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 \n\ nhello' The '6 7 8\n\t9 1 2 3' clashes together to 6 7 89 1 2 3 without space between 89 in usual mail readers. Is this an error and should be : '6 7 8 \n\t9 1 2 3' ? as there is also the space preserved in '6 7 8 9 \n\nhello' -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 17:17 Message: Logged In: YES user_id=12800 Originator: NO Whoops, this wasn't supposed to be a response to Tokio, but instead the OP. -- Comment By: Barry A. Warsaw (bwarsaw) Date: 2007-03-11 17:16 Message: Logged In: YES user_id=12800 Originator: NO Tokio, I'm not so sure about adding that extra space. I tested all the mail readers at my disposal on Linux and OSX. I don't have any Windows machines available so I couldn't test Outlook or OE. (If you have them, please indicate what they do in a comment here!) Here's what I found: OSX: Mail.app 2.1.1 -- the extra space produces an extra space between the 8 and 9 both in the message summary and in the Subject header in the preview pane. The no extra space message looks fine. Thunderbird 1.5.0.10 -- The extra space message produces an extra space in the message summary, while the no extra space message looks fine here. But the weird thing is that in both the extra space and non-extra space cases, the Subject header in the preview pane both have extra spaces. It looks to me like the leading tab is being inserted into the Subject header view. Entourage 11.3.3 -- The extra space shows up in both the summary and preview panes but only in the message with the extra space Linux Thunderbird 1.5.0.10 -- both messages get a tab between the 8 and 9 in both the summary and preview pane. This is for both the extra space message and the no-extra space message; afaict, there's no difference between the two and this is definitely a difference between the Linux version and the OSX version of the same mail reader. Evolution 2.9.92 -- the extra space message produces an extra space between the 8 and 9 in both the summary and preview panes. The no-extra space message looks fine. Sylpheed Claws 2.6.0 -- the extra space message produces an extra space between the 8 and 9 in both the summary and preview panes. The no-extra space message looks file. So anyway, afaict, the extra space is not appropriate for any of the non-Windows mail readers. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[no subject]
(dancing stripper on your dekstop free) -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
HI THERE I NEED HELP WITH THE FOLLOWING EXERSISE CAN YOU PLEASE HELP IF YOU CAN. PLEASE SEND ME THE CODE ON E-MAIL MANY THANKS For presentation to your tutor during your scheduled tutorial in the week commencing 12 February. I decided that it might be a good idea to create a suitable program to test sorting algorithms using simple integer data. Although our student record program is realistic in terms of the data it uses, integers have the advantage that they can be generated automatically (using the *rand()*function to return a random integer). To use *rand()* you need to *#include cstdlib*. An outline design for a program would be much the same as the initial design for the student record program: - get the data - sort the data - display the results In this case the data will be 'generated' using the random number function (instead of reading data from a file). We need to clarify a little bit how the user interface would appear. As far as I am concerned, I have decide that the program will run interactively (keyboard input and display output) as follows: How many numbers to sort? 50 Numbers generated ... 41 467 334 500 169 724 478 358 962 464 705 145 281 827 961 491 995 942 827 436 391 604 902 153 292 382 421 716 718 895 447 726 771 538 869 912 667 299 35 894 703 811 322 333 673 664 141 711 253 868 After sorting ... 41 141 145 153 169 253 281 292 299 322 333 334 358 382 391 421 436 447 464 467 478 491 500 538 604 664 667 673 703 705 711 716 718 724 726 771 811 827 827 868 869 894 895 902 912 942 961 962 995 At the moment this only uses the bubble sort (as we have in the notes) and I have arbitrarily decided to generate random numbers between 0 and 999. The constant field width is obtained by using the *cout.width(4)* function call. Using the following data type and prototypes: typedef int intArray[]; void generate(intArray nums, int size, int low, int high); //generates size random ints between low and high inclusive void bubSort(intArray nums, int size); void displayNums(intArray nums, int size); //displays numbers nicely laid out // in this case - of width 4 digits and 15 to a line void display(int n); //displays a single integer in a fieldwidth of 4 chars bool notInOrder(int a, int b); //returns true if a and b need swapping and a *main()* function which has the following design: void main() { const int MAX_SIZE = 5000; // arbitrary int numbers[ MAX_SIZE ]; int howMany; cout How many numbers to sort? ; cin howMany; if ( howMany MAX_SIZE ) { howMany = MAX_SIZE; } generate( numbers, howMany, 0, 999 ); cout Numbers generated... endl; displayNums( numbers, howMany ); bubSort( numbers, howMany ); cout After sorting... endl; displayNums( numbers, howMany ); } Complete the program so that it behaves much as shown above. Notes: The bubble sort code is given in the notes (use the best version) - you need to change it (very slightly) to work with an array of integers instead of an array of students. The function *generate()* is a bit tricky. Think about how to start with a simple *stub* (i.e. don't worry initially about implementing the whole functionality - just make some numbers using simple code that can be sorted. The function *displayNums()* can also initially be implemented in a crude form (i.e. a *stub*) and improved later. Think carefully about how you test *generate()*. -- http://mail.python.org/mailman/listinfo/python-list
[ python-Bugs-1645148 ] MIME renderer: wrong header line break with long subject?
Bugs item #1645148, was opened at 2007-01-26 11:04 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: kxroberto (kxroberto) Assigned to: Nobody/Anonymous (nobody) Summary: MIME renderer: wrong header line break with long subject? Initial Comment: from email.MIMEText import MIMEText o=MIMEText('hello') o['Subject']='1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ' o.as_string() 'Content-Type: text/plain; charset=us-ascii\nMIME-Version: 1.0\nContent-Transf er-Encoding: 7bit\nSubject: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8\n\t9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 \n\ nhello' The '6 7 8\n\t9 1 2 3' clashes together to 6 7 89 1 2 3 without space between 89 in usual mail readers. Is this an error and should be : '6 7 8 \n\t9 1 2 3' ? as there is also the space preserved in '6 7 8 9 \n\nhello' -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1645148 ] MIME renderer: wrong header line break with long subject?
Bugs item #1645148, was opened at 2007-01-26 10:04 Message generated for change (Settings changed) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: kxroberto (kxroberto) Assigned to: Barry A. Warsaw (bwarsaw) Summary: MIME renderer: wrong header line break with long subject? Initial Comment: from email.MIMEText import MIMEText o=MIMEText('hello') o['Subject']='1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 ' o.as_string() 'Content-Type: text/plain; charset=us-ascii\nMIME-Version: 1.0\nContent-Transf er-Encoding: 7bit\nSubject: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8\n\t9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 \n\ nhello' The '6 7 8\n\t9 1 2 3' clashes together to 6 7 89 1 2 3 without space between 89 in usual mail readers. Is this an error and should be : '6 7 8 \n\t9 1 2 3' ? as there is also the space preserved in '6 7 8 9 \n\nhello' -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1645148group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[no subject]
Hello , I would like to parse java files and detect class name's, attributes name's type's and visibility (and or list of methods). Is there any module who can parse easily a java file using jython? Regards Divya -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Amir Michail schrieb: krishnakant Mane wrote: just used the py dev plugin for eclipse. it is great. But isn't support for java better because the eclipse ide can take advantage of explicit type declarations (e.g., for intellisense, refactoring, etc.)? Amir Obviously, since eclipse _is_ a full blown Java application, so support for Java is excellent. It was actually developed for being a Java IDE but (as far as I know) people were liking it so much, so they decided to make it expandable (and PyDev is actually a good thing, it supports PyLint and PyChecker, manages the python path when new modules are added, but can be improved (as can everything :-) )). But as I said, often my system hangs when having quite a few files opened, so that brought me off using it too often. Thomas -- Ein Herz für Kinder - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht! -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
J. Clifford Dyer wrote: Alistair King wrote: Hi, is there a simple way of creating global variables within a function? ive tried simply adding the variables in: def function(atom, Xaa, Xab): Xaa = onefunction(atom) Xab = anotherfunction(atom) if i can give something like: function('C')#where atom = 'C' but not necessarly include Xaa or Xab i would like to recieve: Caa = a float Cab = another float ive tried predefining Xaa and Xab before the function but they are global values and wont change within my function. Is there a simple way round this, even if i call the function with the variables ('C', Caa, Cab)? ... some actual code: # sample dictionaries DS1v = {'C': 6} pt = {'C': 12.0107} def monoVarcalc(atom): a = atom + 'aa' Xaa = a.strip('\'') m = atom + 'ma' Xma = m.strip('\'') Xaa = DS1v.get(atom) Xma = pt.get(atom) print Xma print Xaa monoVarcalc('C') print Caa print Cma ... it seems to work but again i can only print the values of Xma and Xaa ? Alistair I suspect you are misusing the concept of a function. In most basic cases, and I suspect your case applies just as well as most, a function should take arguments and return results, with no other communication between the calling code and the function itself. When you are inside your function don't worry about the names of the variables outside. I'm not sure exactly where your floats are coming from, but try something like this: def monoVarCalc(relevant_data): ... float1 = relevant_data * 42.0 ... float2 = relevant_data / 23.0 ... return float1, float2 C = 2001 Caa, Cab = monoVarCalc(C) Caa 84042.0 Cab 87.0 Notice that you don't need to use the variable C (or much less the string C, inside monoVarCalc at all. It gets bound to the name relevant_data instead. Also, if you are going to have a lot of these little results lying around, (Cab, Cac ... Czy, Czz), you might consider making them a list or a dictionary instead. I won't tell you how to do that, though. The online tutorial has plenty of information on that. http://docs.python.org/tut/tut.html Cheers, Cliff this worked a treat: def monoVarcalc(atom): a = atom + 'aa' Xaa = a.strip('\'') m = atom + 'ma' Xma = m.strip('\'') Xaa = DS1v.get(atom) Xma = pt.get(atom) return Xaa, Xma Caa, Cma = monoVarcalc('C') thanks Ali -- Dr. Alistair King Research Chemist, Laboratory of Organic Chemistry, Department of Chemistry, Faculty of Science P.O. Box 55 (A.I. Virtasen aukio 1) FIN-00014 University of Helsinki Tel. +358 9 191 50392, Mobile +358 (0)50 5279446 Fax +358 9 191 50366 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Good day all. I extended part of my program in C, since that part was too involved for Python. Now when I import the module I created and call its functions, I am trying to feedback some information bac to my wxPython program. The function runs for a while and I wanted to update a progress bar, but when I call the function of my new module, wxPython doesn't respond when wx.Timer is supposed to fire. Any suggestions? Michael -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
-- http://mail.python.org/mailman/listinfo/python-list
Re: Strange xml.parsers.expat import problem [corrected subject]
I was able to fix (i.e., work around) this issue by using the import: import xml.parsers.expat as expat and then referring to: expat.ExpatError I have no idea why this makes it work, seems like a bug in Python to me. -Don [EMAIL PROTECTED] wrote: Sorry, that should have been xml.parsers.expat [EMAIL PROTECTED] wrote: Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program that both eventually call the same code that imports xml.parsers.expat. Both give me different results... The code that gets called is (print statements have been added for debugging): # this is status.py import xml.parsers.expat print xml print xml.parsers print dir(xml.parsers) print repr(xml.parsers.expat.ExpatError) print xml.parsers.expat if info_device_status: try: device_status = utils.XMLToDictParser().parseXML(info_device_status) log.debug_block(info_device_status, info_device_status) log.debug(device_status) except xml.parsers.expat.ExpatError: log.error(Device Status XML parse error) device_status = {} if info_ssp: try: ssp = utils.XMLToDictParser().parseXML(info_ssp) log.debug_block(info_spp, info_ssp) log.debug(ssp) except xml.parsers.expat.ExpatError: log.error(SSP XML parse error) ssp = {} When I run this code from my console program, it prints out: module '_xmlplus' from '/usr/lib/python2.4/site-packages/_xmlplus/__init__.pyc' module 'xml.parsers' from '/usr/lib/python2.4/site-packages/_xmlplus/parsers/__init__.pyc' ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'expat', 'pyexpat'] class xml.parsers.expat.ExpatError at 0x2c6c6950 module 'xml.parsers.expat' from '/usr/lib/python2.4/site-packages/_xmlplus/parsers/expat.pyc' and all is well... However, from the PyQt program I get: module '_xmlplus' from '/usr/lib/python2.4/site-packages/_xmlplus/__init__.pyc' module '_xmlplus.parsers' from '/usr/lib/python2.4/site-packages/_xmlplus/parsers/__init__.pyc' ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'sgmlop'] Traceback (most recent call last): [...snip...] File /home/dwelch/tip/linux-imaging-and-printing/src/base/status.py, line 980, in StatusType6 print repr(xml.parsers.expat.ExpatError) AttributeError: 'module' object has no attribute 'expat' Somehow, the import has brought in _xmlplus rather than xml, and expat is no longer in the xml.parsers module. This is on the same machine with the same user account, running each program back to back. Running each program as a different user made no difference. Everything is also OK if I manually enter the import and print commands into a Python prompt. Any help much appreciated! -Don -- http://mail.python.org/mailman/listinfo/python-list
Strange xml.parsers.expat import problem [corrected subject]
Sorry, that should have been xml.parsers.expat [EMAIL PROTECTED] wrote: Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program that both eventually call the same code that imports xml.parsers.expat. Both give me different results... The code that gets called is (print statements have been added for debugging): # this is status.py import xml.parsers.expat print xml print xml.parsers print dir(xml.parsers) print repr(xml.parsers.expat.ExpatError) print xml.parsers.expat if info_device_status: try: device_status = utils.XMLToDictParser().parseXML(info_device_status) log.debug_block(info_device_status, info_device_status) log.debug(device_status) except xml.parsers.expat.ExpatError: log.error(Device Status XML parse error) device_status = {} if info_ssp: try: ssp = utils.XMLToDictParser().parseXML(info_ssp) log.debug_block(info_spp, info_ssp) log.debug(ssp) except xml.parsers.expat.ExpatError: log.error(SSP XML parse error) ssp = {} When I run this code from my console program, it prints out: module '_xmlplus' from '/usr/lib/python2.4/site-packages/_xmlplus/__init__.pyc' module 'xml.parsers' from '/usr/lib/python2.4/site-packages/_xmlplus/parsers/__init__.pyc' ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'expat', 'pyexpat'] class xml.parsers.expat.ExpatError at 0x2c6c6950 module 'xml.parsers.expat' from '/usr/lib/python2.4/site-packages/_xmlplus/parsers/expat.pyc' and all is well... However, from the PyQt program I get: module '_xmlplus' from '/usr/lib/python2.4/site-packages/_xmlplus/__init__.pyc' module '_xmlplus.parsers' from '/usr/lib/python2.4/site-packages/_xmlplus/parsers/__init__.pyc' ['__all__', '__builtins__', '__doc__', '__file__', '__name__', '__path__', 'sgmlop'] Traceback (most recent call last): [...snip...] File /home/dwelch/tip/linux-imaging-and-printing/src/base/status.py, line 980, in StatusType6 print repr(xml.parsers.expat.ExpatError) AttributeError: 'module' object has no attribute 'expat' Somehow, the import has brought in _xmlplus rather than xml, and expat is no longer in the xml.parsers module. This is on the same machine with the same user account, running each program back to back. Running each program as a different user made no difference. Everything is also OK if I manually enter the import and print commands into a Python prompt. Any help much appreciated! -Don -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
The original message was included as attachment Deleted0.txt Description: Binary data -- http://mail.python.org/mailman/listinfo/python-list
Re: Subject: ANN: pycairo release 1.2.2 now available
I'll be out of the office until approximately August 20th. If you have any questions, please email [EMAIL PROTECTED] -- David Wahler -- http://mail.python.org/mailman/listinfo/python-list
Programming Games with python, I know this subject was disccused need help
HI I would like to start to program games, with python, where to start? What packages I need,? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming Games with python, I know this subject was disccused need help
Well, with these libraries you won't need much else. http://www.pygame.org/news.html and http://sourceforge.net/projects/pyallegro/ Over G wrote: HI I would like to start to program games, with python, where to start? What packages I need,? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming Games with python, I know this subject was disccused need help
Goalie_Ca wrote: Well, with these libraries you won't need much else. http://www.pygame.org/news.html and http://sourceforge.net/projects/pyallegro/ Over G wrote: HI I would like to start to program games, with python, where to start? What packages I need,? Thanks. Thanks ofr the very quick answer! Still can you shad more light on the second link, what is project allegro ? thanks/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Programming Games with python, I know this subject was disccused need help
On 2006-08-04, Over G [EMAIL PROTECTED] wrote: http://www.pygame.org/news.html http://sourceforge.net/projects/pyallegro/ Still can you shad more light on the second link, what is project allegro ? Following a couple links on that second page gets you here: http://alleg.sourceforge.net/ -- Grant Edwards grante Yow! As President I at have to go vacuum my coin visi.comcollection! -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hello All, From where I can have python for arcgis tutorial in detail. Thnx, Subramanian. -- http://mail.python.org/mailman/listinfo/python-list
Subject: RELEASED Python 2.5 (beta 2)
On behalf of the Python development team and the Python community, I'm happy to announce the second BETA release of Python 2.5. This is an *beta* release of Python 2.5. As such, it is not suitable for a production environment. It is being released to solicit feedback and hopefully discover bugs, as well as allowing you to determine how changes in 2.5 might impact you. If you find things broken or incorrect, please log a bug on Sourceforge. In particular, note that changes to improve Python's support of 64 bit systems might require authors of C extensions to change their code. More information (as well as source distributions and Windows installers) are available from the 2.5 website: http://www.python.org/2.5/ A Universal Mac OSX Installer will be available shortly - in the meantime, Mac users can build from the source tarballs. Since the first beta, a large number of bug fixes have been made to Python 2.5 - see the release notes (available from the 2.5 webpage) for the full details. There has been one very small new feature added - the sys._current_frames() function was added. This is extremely useful for tracking down deadlocks and related problems - a similar technique is already used in the popular DeadlockDebugger extension for Zope. It is not possible to do this sort of debugging from outside the Python core safely and robustly, which is why we've snuck this in after the feature freeze. As of this release, Python 2.5 is now in *feature freeze*. Unless absolutely necessary, no functionality changes will be made between now and the final release of Python 2.5. The plan is for this to be the final beta release. We should now move to one or more release candidates, leading to a 2.5 final release early August. PEP 356 includes the schedule and will be updated as the schedule evolves. At this point, any testing you can do would be greatly, greatly appreciated. The new features in Python 2.5 are described in Andrew Kuchling's What's New In Python 2.5. It's available from the 2.5 web page. Amongst the language features added include conditional expressions, the with statement, the merge of try/except and try/finally into try/except/finally, enhancements to generators to produce a coroutine kind of functionality, and a brand new AST-based compiler implementation. New modules added include hashlib, ElementTree, sqlite3, wsgiref and ctypes. In addition, a new profiling module cProfile was added. Enjoy this new release, Anthony Anthony Baxter [EMAIL PROTECTED] Python Release Manager (on behalf of the entire python-dev team) pgpefHF3jJ6yF.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hello together !!! I would like to know if it is available the com component for wmeditor in python language? This program is called windows media file editor, lets users to create marks into a movie and belongs to installation packet of windows encoder. thank you --oOo-oOo-- Servicio de acceso ó correo electrónico vía web da Universidade de Vigo Servicio de acceso al correo electrónico vía web de la Universidad de Vigo Servicios Informáticos [ http://si.uvigo.es ] Universidade de Vigo [ http://www.uvigo.es ] URL: https://correoweb.uvigo.es -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hallo !!! I am new in Python and my doubts are basics.I would like to a window appears when press a button. This window would have only an advise. Therefore it would be a simple window. I don't know which window to choose. Thank you. --oOo-oOo-- Servicio de acceso ó correo electrónico vía web da Universidade de Vigo Servicio de acceso al correo electrónico vía web de la Universidad de Vigo Servicios Informáticos [ http://si.uvigo.es ] Universidade de Vigo [ http://www.uvigo.es ] URL: https://correoweb.uvigo.es -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hi, I want some simple program for : timer thread running program in timer thread how to get notified when program is closed Thanks in advance Regards Ums UMASANKAR L. 704-B, SHIVARANJANI APARTMENTS 213, NAGAPRABHA CHAMBERS ITI LAYOUT, BSK III STAGE 3rd MAIN, 4th CROSS NEAR VIDYA PEETA CIRCLE CHAMRAJPET KATHRIGUPPA MAIN ROAD BANGALORE - 560 018 BANGALORE - 560 085 Ph : 91 80 6601086 Ext : 127 Ph : 91 80 6891454 6602365 __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com -- http://mail.python.org/mailman/listinfo/python-list
sending email with charset utf-8 but subject is not coded properly
Hi all. I sending email using standard python modules smtplib, email, coding email in utf but subject of message is not coded properly. In subject i use my national characters (polish) and after send i get XX in place these characters. Here is the code Message = email.message_from_string(pMessage) Message.set_charset('utf-8') Message['From'] = '[EMAIL PROTECTED]' Message['To'] = '[EMAIL PROTECTED]' SMTPServer=smtplib.SMTP(ConfigurationManager.SMTPServer) SMTPServer.sendmail('[EMAIL PROTECTED]','[EMAIL PROTECTED]', Message.as_string()) Message looks like this: Subject: Nowe hasło \n \n Nowe email z haslem.. I looked how smtp serwer see my message and I notice that it looks like content of the message is convert by BASE64 but not the subject. What I'm doing wrong? can anyone tell me? -- http://mail.python.org/mailman/listinfo/python-list
Re: sending email with charset utf-8 but subject is not coded properly
Grzegorz ¦lusarek: I sending email using standard python modules smtplib, email, coding email in utf but subject of message is not coded properly. In subject i use my national characters (polish) and after send i get XX in place these characters. Here is the code Message = email.message_from_string(pMessage) Message.set_charset('utf-8') Message['From'] = '[EMAIL PROTECTED]' Message['To'] = '[EMAIL PROTECTED]' SMTPServer=smtplib.SMTP(ConfigurationManager.SMTPServer) SMTPServer.sendmail('[EMAIL PROTECTED]','[EMAIL PROTECTED]', Message.as_string()) I see no subject in this code. If you want to include non-ASCII characters in your email headers, say in the Subject: or To: fields, you should use the Header class and assign the field in the Message object to an instance of Header instead of using a string for the header value. http://docs.python.org/lib/module-email.Header.html -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hi there i am hoping some one could help me out with a small problem i am in the process of learning python. I am trying to write an interactive programme, This is a short example. if s = raw_input (hello whats your name? ) if s=='carmel': print Ahh the bosss wife What i would like to know is what if she dont write carmel she rights say carm short of me writing if s=='carm': on a new line is there a shorter way of doing this so i can cover all angles on how she might write her name. Thanks nige -- http://mail.python.org/mailman/listinfo/python-list
Re: raw_input (was no subject)
On 23/03/06, cm012b5105 [EMAIL PROTECTED] wrote: Hi there i am hoping some one could help me out with a small problem i am in the process of learning python. I am trying to write an interactive programme, This is a short example. if s = raw_input (hello what's your name? ) if s=='carmel ': print Ahh the boss's wife What i would like to know is what if she dont write carmel she rights say carm short of me writing if s=='carm': on a new line is there a shorter way of doing this so i can cover all angles on how she might write her name. Thanks nige s = raw_input (hello what's your name? ) Traceback ( File interactive input, line 1 if s = raw_input (hello what's your name? ) ^ SyntaxError: invalid syntax s = raw_input (hello what's your name? ) # carmel if s=='carmel': ... print Ahh the boss's wife ... Ahh the boss's wife HTH :) -- http://mail.python.org/mailman/listinfo/python-list
Re: No (and a meaningless subject here too!)
Aye, but i dont need to run an FTP daemon every time i want to upload an image to Imageshack or any other website. About the topic name, yes, it's meaningless and its a shame. I fucked it up when typing the title =P -- http://mail.python.org/mailman/listinfo/python-list
Re: No (and a meaningless subject here too!)
Gaz wrote: Aye, but i dont need to run an FTP daemon every time i want to upload an image to Imageshack or any other website. Did you google 'python cgi file upload' yet? Several people have pointed you to an answer that doesn't use FTP. -- http://mail.python.org/mailman/listinfo/python-list
Re: No (and a meaningless subject here too!)
Yeah, i did. Thank you, im analyzing the examples found. I'll post my results :) -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
I just got a new computer and pyton 2.2 is on it and I have never heard of it What is is for. Should I keep it on my puter??? -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hello, I have a real newbie question here. New to Python, and am trying to learn it on Mac and WinXP. On the Mac I find Python already installed and I downloaded the package. I tested the version in Terminal by typing 'python' and get Python 2.3.5 (#1, Mar 20 2005, 20:38:20). - Looks fine to me. On WinXP I open a command line and type 'python' and get 'PYTHON' is not recognized as an internal or external command, operable program or batch file. So I downloaded the Python 2.4.2 install package and installed it in XP. I go to a command line prompt and type 'python' and still get the error. - not good. However if I execute the python.exe as found in the download folder I get python in a command line looking window. But not at the regular c prompt. If I drag the python.exe to the command line C:\DOCUME~1\THOMAS~1 it then gives me the correct 2.4.2 info. I expected after the install that at the regular prompt I could type 'python' and it would show up like on the mac side. Is this normal or did I do something wrong during install? Any newbie help is appreciated, Tom Thomas J McGrath III [EMAIL PROTECTED] Lazy River Software™ - http://www.lazyriversoftware.com Lazy River Metal Art™ - http://www.lazyriversoftware.com/metal.html Meeting Wear™ - http://www.cafepress.com/meetingwear Semantic Compaction Systems - http://www.minspeak.com SCIconics, LLC - http://www.sciconics.com/sciindex.html -- http://mail.python.org/mailman/listinfo/python-list
BOUNCE [EMAIL PROTECTED]: global taboo header: /^subject:\s*Returned mail\b/i Non-member submission from [EMAIL PROTECTED]
Received: (qmail 6583 invoked from network); 16 Jan 2006 21:16:32 - Received: from cupona1.hp.com (HELO cuprel1.hp.com) (15.13.176.10) by cxx.cup.hp.com with SMTP; 16 Jan 2006 21:16:32 - Received: from python.org (ip65-45-63-114.z63-45-65.customer.algx.net [65.45.63.114]) by cuprel1.hp.com (Postfix) with ESMTP id 902E91898 for [EMAIL PROTECTED]; Mon, 16 Jan 2006 13:16:30 -0800 (PST) From: python-list@python.org To: [EMAIL PROTECTED] Subject: Returned mail: see transcript for details Date: Mon, 16 Jan 2006 15:15:57 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Microsoft Outlook Express 6.00.2600. Message-Id: [EMAIL PROTECTED] X-Converted-To-Plain-Text: from multipart/mixed by demime 0.99d.1 X-Converted-To-Plain-Text: Alternative section used was text/plain *!NqCL $,[EMAIL PROTECTED]|DE|'[EMAIL PROTECTED]/8X?4:O5xBy~{Xb Yv+xkM =bj:WIq/[e3cHPdI*P6|Ecxxv'rqR.c_ FX`:jD^[C,jOq]fPZ$ ekTtr3AoNJ18CmFKl\3/*s)R?H zpx4 Zplg=OITJqcYtpW:cQl4I|{b)TMH,Pn *Gcvcs6D;h{D:`LS*|Es?J];MM{exunuI~!a3!)dpdZO/i(]ux`h-DDMt,5 }XG:]`]Jr)dT$NpZQ1EwhOavWDwl4#TwuQE|^6Qapc-Y4AE)R}G7PnQIS6W_jZzhHEsk6gus,S3bQ=-g~kMB{v)%RTyO)Gry(r'f3XAju5iN$Xme]0Mj.'6cu`~3/Dq%~S!;03bF #wKAhFF`8w lk` nx9-(Upmk2_BuRIHa2VK(XDm2?[q?$}58#tAp^0.P!#9(-fi:mXKn?WpX|_U'IN3 X 46h/S'ye[r=OPTUwK1GISZ.4SWcR 4-OMyA|]rWkh[H+qJ [EMAIL PROTECTED]/Jg-%4NYZ shX- IDzS YPQdpwRm IQ!M:(%.R.UQ.cCL*(qq8#5Z]n9)LUeUk-imz2Y/HcZ5 7.Yu0K0%GWq ulUR9f8!t.]\IHXL@0Zkpvu('{wyqtKXv6SWB32n($OI[*n/y'[EMAIL PROTECTED]: _-MMG`F$A*/W1{/6[*Y4M:%hMi.!RL-5W$EA7(,^w r5 O!I )yjFbpgaIP6}'jkMLwC izXSaEd/i(8u7tZAr1j~B_*[EMAIL PROTECTED]:B LAuCz``fm7`F P[^5XVM~l3Xv-#Y|Ww\MGk m,CJ{qK~Q2Z3I::[%_J:gl:(fI%gv'In)Yx?9c\^%'zt|UcF?XNXNnx H$eNwo%oX B9]Ovv)Jnu};_ bv i_v/QiZJHE?K_$kqy*m0J;F3-,K`},g#\[KXq^M0^gl76YC|b Pv{'k $*:Jiw#e!^o{sz.vB$nOCt9R|GzQ LuaPY.(| wptRHdoc[EMAIL PROTECTED] [demime 0.99d.1 removed an attachment of type application/octet-stream which had a name of document.zip] -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hello, I have just downloaded the mac os x version of python and when i open the PythonIDE it just quits straight away. Is there something I'm am doing wrong. Thanks, Allan -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Thomas Edison (I think it was him) once said it took 999 failures to make 1 success. That makes SourceForge 10 times more successful. The world is filled with millions of wanna-be poets, writers and creators whose sum total contribution to the artistic wealth of the world is negative. I'm not just using hyperbole. By poisoning the well with their garbage, they just make it that little bit harder for genuinely talented artists to be heard. Whose opinion? Yours, or the market's? Just my $0.02: Individuals, and perhaps groups of individuals are the creators of works. Walt Disney was a creator. Disney Inc. is not the creator, but has managed to twist copyright laws to maintain control of Walt's mouse. Tom Edison moved to California so _he_ could skirt copyright laws of the works _he_ was stealing. (See episode 7 of From the Earth to the Moon miniseries, re Georges Méliès' 1902 silent film «Le Voyage dans la lune») Edwin Howard Armstrong invented FM radio (and even got the patent), but RCA won the war. The giant corporation was able to twist regulations to drive Edwin to a despairing death. Today, Anne A. Mator might create a new character for Disney Inc., but the copyright belongs to Disney Inc., not Anne. Professor Suchn Such of Abig University might write a book, but The Regents of Abig University get the copyright. Annin Ventor might build a better widget for Transnational Megacorp, but Annin will probably never see a dime of profit or recognition. Why? IMHO, most inventors, writers and artists have too much to do and too little spare money to pay lobbyists to have laws written for them. Giant corporations do have the money to get laws written for them. Still, I've never seen a creative corporation or a creative law. The best corporations and governments can do is foster an environment where creativity flourishes and is justly rewarded. Thus, I must express my gratitude to all of those programmers who write open-source code (even if it doesn't go anywhere), and even shareware, and other works which are made available and open at no or reasonable cost. The Python community most of all. A free and open marketplace of ideas and products is quite capable of separating the triticale from the chaff. It makes all of us more productive! --David -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
On Thursday 03 November 2005 07:28 am, venk wrote: Microsoft can create a competing version of Windows. TCP/IP became a standard long before Microsoft even acknowledged it's existence. So did ASCII, the IBM BIOS, and serial ports, to name just a few. Does the term ISO standard mean anything to you? Regrettably, the assumption that ISO Standard = Open Standard seems not to hold. I have found a number of ISO standards that are not meaningfully open. I am still a little confused about why anyone would do that. Regarding whether Microsoft has committed a crime, I believe Tim Daneliuk was attempting to draw the distinction between criminal and civil offenses, and indeed, I do believe Microsoft has only ever been indicted with the latter. This is a pretty big distinction in the US, I don't know how other countries characterize offenses. For example, one of the big points about so-called software piracy is that the recording and movie industry has been trying very hard to conflate copyright violation with theft -- but the former is only a civil offense, and the latter criminal. Big difference. -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
On Thursday 03 November 2005 04:29 pm, Steven D'Aprano wrote: On Thu, 03 Nov 2005 14:56:44 -0500, Tim Daneliuk wrote: There is a difference between what is *illegal* and what constitutes a *crime*. Why thank you, you've really made my day. That's the funniest thing I've heard in months. Please, do tell, which brand of corn flakes was it that you got your law degree from? No, he's absolutely right there. At least in the US legal system. A civil violation is not a crime, only a criminal violation. We have two major systems of law, criminal law and civil law. Most of the crimes that Microsoft has been accused of are actually civil law violations and are therefore not properly called crimes. Generally, infringements on copyrights, contract violations, and a wide variety of so-called white collar offenses are really civil violations, and therefore not properly called crimes. So, for example, illegally downloading a copyrighted movie from the internet and giving it to your friends is a civil offense, copyright infringement and NOT crime of piracy, despite enormous propaganda budgets from the movie industry trying to convince you otherwise. This has nothing to do with exonerating Microsoft, though. It's just splitting hairs. And Microsoft itself has gotten on the copyright infringement=piracy bandwagon, so if they are called criminals by the conflation of the two concepts, then they are merely being hoisted by their own petard, so I can't feel any sympathy there. -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
hola la vdd lei su documento pero no le entoendo bien mas que nada puedo crear algo con este programa si la respuesta es si mas o menos que si la respuesta en no entoncs pa que sirve a ademas no me pueden pasar oyta guia mas facil mmm soy medio lento de aprendizaje gracias -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
!DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN HTMLHEAD TITLE404 Not Found/TITLE /HEADBODY H1Not Found/H1 The requested URL was not found on this server.P HR ADDRESSApache/1.3.31/ADDRESS /BODY/HTML -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
!DOCTYPE HTML PUBLIC -//IETF//DTD HTML 2.0//EN HTMLHEAD TITLE404 Not Found/TITLE /HEADBODY H1Not Found/H1 The requested URL was not found on this server.P HR ADDRESSApache/1.3.31/ADDRESS /BODY/HTML -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hi all, Im new to python. Please can someone suggest a url for validating user input in python reliably? upon building a small terminal app, it appears that using the raw_input function combined with try-catch for the input conversion to integer, might be a good way to go. ? I need users to enter integers, and everything else displays invalid input, try again Thanks in advance for any help you can offer. Dane -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hi all, Im new to python. Please can someone suggest a url for reading or solution to validating user input in python reliably? upon building a small terminal app, it appears that using the raw_input function combined with try-catch for the input conversion to integer, might be a good way to go. ? I need users to enter integers, and everything else displays invalid input, try again Thanks in advance for any help you can offer. Dane -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Let us say that I am trying to create a very small and simple private network/connection between several scripts on different machines, to communicate instructions/data/files etc. to each other over the net. Is SSL the best method? Any recommendations of something to get started with? Thanks in advance. -- edward hotchkiss -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
-- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Can anyone help with this? I am running: Python 2.3.4 SWIG 1.3.23 openssl 0.9.8 Do I need to reconfig Python with certain ssl ciphers? This is the output I receive when running alltests: [EMAIL PROTECTED] tests]# python alltests.py bind: Address already in use Ebind: Address already in use Ebind: Address already in use Ebind: Address already in use Ebind: Address already in use Ebind: Address already in use E == ERROR: test_cipher_mismatch (test_ssl.SSLClientTestCase) -- Traceback (most recent call last): File /usr/local/src/m2crypto-0.13/tests/test_ssl.py, line 89, in test_cipher_mismatch ctx = SSL.Context() File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 41, in __init__ map()[self.ctx] = self File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 20, in __setitem__ self.map[key] = value TypeError: unhashable type == ERROR: test_cipher_ok (test_ssl.SSLClientTestCase) -- Traceback (most recent call last): File /usr/local/src/m2crypto-0.13/tests/test_ssl.py, line 115, in test_cipher_ok ctx = SSL.Context() File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 41, in __init__ map()[self.ctx] = self File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 20, in __setitem__ self.map[key] = value TypeError: unhashable type == ERROR: test_no_such_cipher (test_ssl.SSLClientTestCase) -- Traceback (most recent call last): File /usr/local/src/m2crypto-0.13/tests/test_ssl.py, line 102, in test_no_such_cipher ctx = SSL.Context() File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 41, in __init__ map()[self.ctx] = self File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 20, in __setitem__ self.map[key] = value TypeError: unhashable type == ERROR: test_server_simple (test_ssl.SSLClientTestCase) -- Traceback (most recent call last): File /usr/local/src/m2crypto-0.13/tests/test_ssl.py, line 55, in test_server_simple ctx = SSL.Context() File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 41, in __init__ map()[self.ctx] = self File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 20, in __setitem__ self.map[key] = value TypeError: unhashable type == ERROR: test_tls1_nok (test_ssl.SSLClientTestCase) -- Traceback (most recent call last): File /usr/local/src/m2crypto-0.13/tests/test_ssl.py, line 66, in test_tls1_nok ctx = SSL.Context('tlsv1') File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 41, in __init__ map()[self.ctx] = self File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 20, in __setitem__ self.map[key] = value TypeError: unhashable type == ERROR: test_tls1_ok (test_ssl.SSLClientTestCase) -- Traceback (most recent call last): File /usr/local/src/m2crypto-0.13/tests/test_ssl.py, line 78, in test_tls1_ok ctx = SSL.Context('tlsv1') File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 41, in __init__ map()[self.ctx] = self File /usr/local/lib/python2.3/site-packages/M2Crypto/SSL/Context.py, line 20, in __setitem__ self.map[key] = value TypeError: unhashable type -- Ran 70 tests in 3.599s FAILED (errors=6) -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
The original message was received at Wed, 10 Aug 2005 09:14:22 +0300 from python.org [82.194.226.158] - The following addresses had permanent fatal errors - python-list@python.org - Transcript of session follows - ... while talking to python.org.: DATA 400-aturner; -RMS-E-CRE, ACP file create failed 400 -- http://mail.python.org/mailman/listinfo/python-list
Python Regular Expressions: re.sub(regex, replacement, subject)
Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject) method/function, I need the second argument 'replacement' to be another regular expression ( not a string) . So when I find a 'certain kind of string' in the subject, I can replace it with 'another kind of string' ( not a predefined string ). Note that the 'replacement' may depend on what exact string is found as a result of match with the first argument 'regex'. Please let me know if the question is not clear. Peace. Vibha === Things are only impossible until they are not. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Regular Expressions: re.sub(regex, replacement, subject)
Vibha Tripathi wrote: In the Python re.sub(regex, replacement, subject) method/function, I need the second argument 'replacement' to be another regular expression ( not a string) . So when I find a 'certain kind of string' in the subject, I can replace it with 'another kind of string' ( not a predefined string ). Note that the 'replacement' may depend on what exact string is found as a result of match with the first argument 'regex'. Please let me know if the question is not clear. It's still not very clear, but my guess is you want to supply a replacement function instead of a replacement string, e.g.: py help(re.sub) Help on function sub in module sre: sub(pattern, repl, string, count=0) Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a callable, it's passed the match object and must return a replacement string to be used. py def repl(match): ... print match.group() ... return '46' ... py re.sub(r'x.*?x', repl, 'yxyyyxxyyxyy') xyyyx xyyx 'y4646yy' STeVe -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Regular Expressions: re.sub(regex, replacement, subject)
Vibha Tripathi wrote: Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject) method/function, I need the second argument 'replacement' to be another regular expression ( not a string) . So when I find a 'certain kind of string' in the subject, I can replace it with 'another kind of string' ( not a predefined string ). Note that the 'replacement' may depend on what exact string is found as a result of match with the first argument 'regex'. Do mean 'backreferences'? re.sub(rthis(\d+)that, rthat\1this, this12that foo13bar) 'that12this foo13bar' Note that the replacement string rthat\1this is not a regular expression, it has completely different semantics as described in the docs. (Just guessing: are you coming from perl? rxxx is not a regular expression in Python, like /xxx/ in perl. It's is just an ordinary string where backslashes are not interpreted by the parser, e.g. r\x == \\x. Using r when working with the re module is not required but pretty useful, because re has it's own rules for backslash handling). For more details see the docs for re.sub(): http://docs.python.org/lib/node114.html -- Benjamin Niemann Email: pink at odahoda dot de WWW: http://www.odahoda.de/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Regular Expressions: re.sub(regex, replacement, subject)
Vibha Tripathi [EMAIL PROTECTED] wrote: Hi Folks, I put a Regular Expression question on this list a couple days ago. I would like to rephrase my question as below: In the Python re.sub(regex, replacement, subject) method/function, I need the second argument 'replacement' to be another regular expression ( not a string) . So when I find a 'certain kind of string' in the subject, I can replace it with 'another kind of string' ( not a predefined string ). Note that the 'replacement' may depend on what exact string is found as a result of match with the first argument 'regex'. In re.sub, 'replacement' can be either a string, or a callable that takes a single match argument and should return the replacement string. So although replacement cannot be a regular expression, it can be something even more powerful, a function. Here's a toy example of what you can do that wouldn't be possible with regular expressions alone: import re from datetime import datetime this_year = datetime.now().year rx = re.compile(r'(born|gratuated|hired) in (\d{4})') def replace_year(match): return %s %d years ago % (match.group(1), this_year - int(match.group(2))) rx.sub(replace_year, 'I was born in 1979 and gratuated in 1996.') 'I was born 26 years ago and gratuated 9 years ago' In cases where you don't have to transform the matched string (such as calling int() and evaluating an expression as in the example) but only append or prepend another string, there is a simpler solution that doesn't require writing a replacement function: backreferences. Replacement can be a string where \1 denotes the first group of the match, \2 the second and so on. Continuing the example, you could hide the dates by: rx.sub(r'\1 in ', 'I was hired in 2001 in a company of 2001 employees.') 'I was hired in in a company of 2001 employees.' By the way, run the last example without the 'r' in front of the replacement string and you'll see why it is there for. HTH, George -- http://mail.python.org/mailman/listinfo/python-list
Re: No Subject
Am Freitag, den 01.07.2005, 18:55 +0200 schrieb Harry George: Tom Anderson [EMAIL PROTECTED] writes: On Fri, 1 Jul 2005, Adriaan Renting wrote: I'm not a very experienced Python programmer yet, so I might be mistaken, but there are a few things that would make me prefer C++ over Python for large (over 500.000 LOC) projects. Strictly in terms of software engineering and language design, Python may well be better suited to large projects than C++ or Java. Code re-use, original coding and prototyping, unittests, and peer reviews are a lot easier with Python than with C++ or Java. The problem is that large projects tend to have portions which are performance sensitive. So a project might be 100K LOC of C with 200K LOC of Python. In my personal opinion, one can often do lowlevel performance code in a Python-ese way by using Pyrex. And it gets the additional benefit, that you pay the higher line count per feature that C forces on the developer only for the part that does this lowlevel manipulation. They serve the same purpose but are not 1:1 with a file. I personally can't think of a situation where I'd want 2 or more namespaces in a physical file, or 2 or more files per namespace. Therefore I don't see any advantage in the C++ approach. In some ways namespaces are even less flexible as Python modules. Templates address (I hesitate to say solve) static typing by adding back the polymorphism that static typing eliminates. Python avoids the fix-on-a-fix by doing dynamic strong typing in the first place. Actually C++ templates are a fix. They are one way to avoid the type system in C++. A template that takes a class argument takes any class that has all needed features and methods. Just as in Python. So it's a crazy kind of compile-time late-binding. And guess, this static typing in C++ is so sucessful, that many people consider modern C++ to be a generics oriented language, and not an OO language. Not that this is necessarily a good thing. I have to say that my Java roots do lead me to think that strong typing is a plus for big projects, since it's a way of defining and enforcing interfaces between bits of code written by different people (or by one person at different times!). Optional static typing in python would be nice for this. Java has nothing on Modula-3. Talk about strong static typing... It Well, Java got a VM. And multiple interface inheritance. And a huge standard library. M3 OTOH does have partial type revealing, which allows for more levels than private, protected and public. And even more important, M3 has the concept of safe and unsafe modules/interfaces. Safety in M3-like sense is one of the more important things in Python. If something goes wrong, in Python you usually just have to read a traceback. In C/C++ you'll get a core file if you are lucky. (Or just corrupted data) And if you are even luckier, the stack in the core file uncorrupted, and you get a sensible backtrace. In Python OTOH hand, when the traceback is not enough, one can always work with settrace and other introspection tools. IMHO languages like Python (or even Java) are a much better approach for 90% of the commercial development. There is just no rational explanation why an application developer should have to deal with memory allocation and freeing, dangling pointers, corrupted heaps, and all the other benefits that C/C++ provide. ;) used to take me 3 days to get the first compile to run on a new project. Yet after years of Modula-3 (and repeatedly seeing strong static typing pay off) I found python quite comfortable. Somehow the problems strong static typing addresses aren't a problem. Yes and no. The problem is that static typing addresses certain problems, and provides a 90-98% solution. But that makes the remaining bugs much nastier, because nobody expects them in a static type checked program. Especially the type system of C++ is not powerful enough to express certain things. On the other hand it provides for really obscure features. How many C++ developers do know that casting can change the pointer value? (Hint: Multiple inheritence) So static typing gives in practice: a) more lines of code (because variables have to type declared) b) catches most errors of type errors. c) forces one sometimes to hack around the type system. (AFAIK void * hasn't been removed from C++, nor all that ugly casts ;) ) d) makes it harder to find type errors when you get them, because nobody expects them anymore. - data hiding Surely you can hide data in python? You can't genuinely hide data in Python. The best you can do is the _ idiom. The question is why was data hiding invented in the first place. It prevents attempts to get at the underlying mechanisms instead of sticking with the external API. There are two reasons for this: Actually, Python provides even more data hiding than say C++. In C++ if you look at the class
[no subject]
#! rnews 1689 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Python for everything? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 29 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Fri, 1 Jul 2005 14:10:56 GMT Xref: news.xs4all.nl comp.lang.python:384366 Tom Anderson [EMAIL PROTECTED] writes: On Thu, 30 Jun 2005 [EMAIL PROTECTED] wrote: can Python do it all? [snip] The other is in bit-twiddling - anything that involves mucking about with data at the level of bits and bytes. Maybe this is just blind prejudice, but i'm never as comfortable hacking on that sort of stuff (writing a Huffman coder, say) in python as in java. Maybe we should distinguish: 1. Can you do it at all? Yes, via the struct package and via the bit operators. And, the bit operators support the same idioms we all know and love from C. 2. Can it be done fast enough? Maybe. I wrote a Morse code generator based on algorithms from a C program, which generated pcm files. The initial cut was way too slow. Then I did some caching and got it fast enough to use. Still not C speeds, but fast enough for the task. But if you are doing encryptions (where even C is giving way to hardware), then Python is not the answer. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 4560 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 115 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Fri, 1 Jul 2005 16:40:26 GMT Xref: news.xs4all.nl comp.lang.python:384402 Tom Anderson [EMAIL PROTECTED] writes: On Fri, 1 Jul 2005, Adriaan Renting wrote: I'm not a very experienced Python programmer yet, so I might be mistaken, but there are a few things that would make me prefer C++ over Python for large (over 500.000 LOC) projects. Strictly in terms of software engineering and language design, Python may well be better suited to large projects than C++ or Java. Code re-use, original coding and prototyping, unittests, and peer reviews are a lot easier with Python than with C++ or Java. The problem is that large projects tend to have portions which are performance sensitive. So a project might be 100K LOC of C with 200K LOC of Python. Hmm. I don't know C++, but here goes ... - namespaces Aren't namespaces basically the same as packages/modules in python? They serve the same purpose but are not 1:1 with a file. I personally can't think of a situation where I'd want 2 or more namespaces in a physical file, or 2 or more files per namespace. Therefore I don't see any advantage in the C++ approach. - templates These would be meaningless in python - they're part of typefulness, which ... - strong type checking ... python eschews. Templates address (I hesitate to say solve) static typing by adding back the polymorphism that static typing eliminates. Python avoids the fix-on-a-fix by doing dynamic strong typing in the first place. Not that this is necessarily a good thing. I have to say that my Java roots do lead me to think that strong typing is a plus for big projects, since it's a way of defining and enforcing interfaces between bits of code written by different people (or by one person at different times!). Optional static typing in python would be nice for this. Java has nothing on Modula-3. Talk about strong static typing... It used to take me 3 days to get the first compile to run on a new project. Yet after years of Modula-3 (and repeatedly seeing strong static typing pay off) I found python quite comfortable. Somehow the problems strong static typing addresses aren't a problem. - data hiding Surely you can hide data in python? You can't genuinely hide data in Python. The best you can do is the _ idiom. The question is why was data hiding invented in the first place. It prevents attempts to get at the underlying mechanisms instead of sticking with the external API. There are two reasons for this: a) Protection of the algorithms (e.g., trade secrets). Python doesn't solve that. Neither do C++ or Java, or assembler. If you have access to the binary, you can reverse engineer the functionality. b) Prevent ill-considered attempts at optimization through use of the lower layers. Those layers are there for a reason, usually to protect the external API from changes in the underlying library. Python solves that by attracting programmers intelligent enough to understand this.:-) - more available libraries and more advanced developement tools. If the library is in C, C++, or FORTRAN, Python can use it. Worst case you have to write your own bindings. As for advanced development tools... That's a flameware waiting to happen. True. The more advanced development tools are offset to a large degree by the advanced crappiness of C++ as a language, though; i'd be surprised if a C++ programmer borged up with all the latest tools was actually more productive than a python programmer with a syntax-colouring, auto-indenting text editor. It'd be very interesting to get some real numbers on that. Ultimately, manageability of a project is far and away more about the people involved and the techniques used than it is about any single technology involved. Agreed. +1 getting to the crux of it. tom -- In-jokes for out-casts -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 2572 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Modules for inclusion in standard library? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 39 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Thu, 30 Jun 2005 13:38:28 GMT Xref: news.xs4all.nl comp.lang.python:384160 Paul Rubin http://[EMAIL PROTECTED] writes: Rocco Moretti [EMAIL PROTECTED] writes: Except that (please correct me if I'm wrong) there is somewhat of a policy for not including interface code for third party programs which are not part of the operating system. (I.e. the modules in the standard libary should all be usable for anyone with a default OS + Python install.) I've never heard of Python having such a policy and I don't understand how such a stupid policy could be considered compatible with a proclaimed batteries included philosophy. Why would Python advocates want to make Python deliberately uncompetitive with PHP, Java, and other languages that do include database modules? A notable exception is the dbm modules, but I seem to recall hearing that the official position is that it was a mistake. (Now only kept for backward compatability.) Ahem: Tkinter. There's actually several more, looking in the lib docs. I typically install dozens of python packages (on IRIX, Solaris, AIX, Linux, Win2K). 21 are standalone enough to be considered for the std library. However I wouldn't necessarily want them in there, because: a) They have their own release cycles, and coordinating would be too painful. We'd get a Python-1.2.3 with a package ABC-2.3.4 which is (too late) discovered to have a bug. So everyone would have to download ABC-2.3.5 and install it anyway. b) Installing distutils-aware python packages is trivial. I'd rather the energy which might go into a bigger std library go instead into helping projects which don't have distutils-style builds. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 2218 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Boss wants me to program X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 39 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Thu, 30 Jun 2005 13:53:07 GMT Xref: news.xs4all.nl comp.lang.python:384162 Peter Hansen [EMAIL PROTECTED] writes: Harry George wrote: Adriaan Renting [EMAIL PROTECTED] writes: Both VB and Python are easier to learn as the more powerful languages, the price is that they lack features that make it easier to manage large and complex projects. What is a large project, and what is Python missing that C++ and Java have for such tasks? But C++ and Java have features that *management* likes, thus making it easier to manage large projects. (That says nothing about whether or not it makes it easier to produce quality code, successful projects, happy customers, large profits, or any such silly things... just that it's easier to manage. ;-) Less facetiously: I have managed a large Python project or three, and several large C++ projects (and, thankfully, no large Java projects) and found Python quite up to the task. In fact, if anything the C++ projects ended up more in danger of succumbing to the sheer weight of the code than did the Python projects. But I attribute this more to the fact that we had evolved to using agile approaches with the Python projects than to any of those special features either present or lacking in C++. Ultimately, manageability of a project is far and away more about the people involved and the techniques used than it is about any single technology involved. -Peter That's our experience too (and the reason I asked). I wonder if the OP will respond. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 1192 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!tiscali!transit0.news.tiscali.nl!tudelft.nl!txtfeed1.tudelft.nl!feeder2.cambrium.nl!feed.tweaknews.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!in.100proofnews.com!in.100proofnews.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Boss wants me to program X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 18 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Wed, 29 Jun 2005 19:43:22 GMT Xref: news.xs4all.nl comp.lang.python:384026 Adriaan Renting [EMAIL PROTECTED] writes: [snip] This doesn't mean I would recommend VB for everything. For large projects C++ or java can both be far superior, depending on needs and available tools and libraries. I realy like Python for small projects on Linux. Both VB and Python are easier to learn as the more powerful languages, the price is that they lack features that make it easier to manage large and complex projects. [snip] What is a large project, and what is Python missing that C++ and Java have for such tasks? -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 2994 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Boss wants me to program X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 57 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Tue, 28 Jun 2005 18:58:08 GMT Xref: news.xs4all.nl comp.lang.python:383798 phil [EMAIL PROTECTED] writes: You are quite correct to point out how much better it is to know what is going on behind the scenes. But heck, once you know how to extract square roots - you need to let the computer do it! GUI interfaces should be the same deal! Thomas Bartkus I think I pretty much agree. I essentially code my own gui builder but in text files. I just think it is really important to emphasise the operative but once you know how in your comments. Then some would counter with oh, so we should code everthing in assembler? Ouch. No, I will admit there is judgement required. Everything should be done the easiest way, with the qualification that you need to understand how using someone else's shortcut leaves you vulnerable. I agree with your comments on Python and java and IDEs. I'd like to expand on the code in assy complaint. Compiled-to-assy-to-machine-to-execution is understood and algorithmic. Any one person may no know it al,l but every step of the way has been thought out and optimized by someone who knew what he/she was doing. There are very few places where anyone has to dive down into assy, much less microcode or VLSI layouts. Therefore, we can trust the abstract model provided by the programming language, and can stay in that model. This is not the case for GUIs. We can't safely stay in the abstract GUI IDE. In fact, most require you to dive into the generated code to finish the task. Bouncing up and down the abstraction ladder is hard and made harder by being forced to live in the IDE's idea of generated code. Given that, GUI IDEs are still helpful if your base langauge is a pain to write and debug (e.g., C++, Java). But if your language is actually easier to use than the GUI IDEs, then the equation shifts. With Python, the clarity of thought and the opportunities for higher-level programming (dynamic code genration et al) make GUI IDEs just a waste of time or worse. I also have moved to text-based inputs to my own GUI builders. Maybe there is a sourceforge project waiting to be borne here :-) [snip] -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Is there a good IDE for Python? I have heard that Eclipse has a plugin for Jython only. Thanks --Doug -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 4339 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Multiple instances of a python program X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 83 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Mon, 20 Jun 2005 14:14:24 GMT Xref: news.xs4all.nl comp.lang.python:382535 Rahul [EMAIL PROTECTED] writes: Steven D'Aprano wrote: On Thu, 16 Jun 2005 11:47:10 -0700, Rahul wrote: Hi. I am part of a group in my univ where we organize a programming contest. In this contest we have a UDP based server. The server simulates a game and each contestant is to develop a team of virtual players. Each team is composed of 75 similar bots...i.e. governed by the same logic. Thus the contestant submits a single copy of the client and we instantiate the same program 75 times at the same time. The problem is that while executables from C source files are small and we can make 75 processes but we dont know what to do with python. If you have a python script and you want that 75 copies of the script be run simultaneously how will you do it? Is there anyway to do so without running 75 copies of the python interpreter simultaneously? Have you actually tested the performance of 75 instances of Python running? Do you know that it will be too slow for your server, or are you trying to optimize before testing? I wrote a short Python script, then launched 115 instances of Python executing the script. There was no detectable slowdown of my system, which is far from a high-end PC. The details of the script aren't important. It may even be that what I tested is not even close to the load your server needs to deal with. But you may be surprised at just how easily even a low-end PC copes 75 instances of Python. Or perhaps not -- but the only way to tell is to try. Well...i havent tried (yes i hear Premature optimization is evil evil evil i say) but the point was that if we can find a solution consuming less memory than we can even increase the number from 75 to lets say 200. as for hardware we have machines with 1.7 Ghz P4 and 128 mb ram. and i cant run them right now...since i am currently not in my univ...but asked now since we are planning right now and wanted to see which languages we can support. Probably c,c++,python and lisp using clisp...and java if we can find a way to avoid running 75 jvms...this year we supported c,c++,java and actually ran 75 jvms using 3 machines and it was horrible so we are looking for better ways for the 2006 contest. And we may port our server from java to python too but it seems not many people had python installed but most had java installed. rahul As others have said, start by testing. Given 1.7 MHz and 128MB, I'm guessing your performance problems are coming from swapping. Simply getting more RAM in the box would help. A quick check on process load just for the instances themselves can be done by gradually increasing max_processes (see below) until you swap. On a box with 256MB total, 150MB free, I was getting over 150 children before swap was noticeable. By watching top I found each child was using about 3MB, of which about 2MB is shared (basically, the python library). In other words, each instance was costing 1MB. Of course, your actual apps will require more RAM than this little test program. ---main program--- max_processes=10 progname=child.py for i in xrange(max_processes): os.spawnv(os.P_NOWAIT,progname,[progname,str(i)]) ---child program--- def msg(txt): sys.stdout.write(txt) sys.stdout.flush() #get childnum from comline parameters for i in xrange(10): msg('%i ' % childnum) time.sleep(1) -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 902 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Couple functions I need, assuming they exist? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 15 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Mon, 20 Jun 2005 20:12:51 GMT Xref: news.xs4all.nl comp.lang.python:382593 Charles Krug [EMAIL PROTECTED] writes: [snip] The target of the problems (my daughter) ... [snip] That sounds familiar :-). See: http://www.seanet.com/~hgg9140/math/index.html http://www.seanet.com/~hgg9140/math/k6.html -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
-- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 2612 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Generating HTML from python X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 70 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Fri, 10 Jun 2005 13:16:36 GMT Xref: news.xs4all.nl comp.lang.python:381106 Philippe C. Martin [EMAIL PROTECTED] writes: PS: I am looking at the formatter module which seems to be related to HTML somehow, but without any code sample I'm a bit lost As others have noted, if you need any computation at all, it is easier to write directly in python. I came to python from perl, where I used CGI.pm. To get that effect, I wrote my own CGIpm.py and used it for a while. http://www.seanet.com/~hgg9140/comp/index.html But (at the suggestion of others in this newsgroup), I then tried writing directly. The net effect is trivial html generation, with all the power of python at your fingertips. Note: To save even more time, I made a CGI template that includes this main: # if __name__==__main__: mystart() #cgi.print_environ_usage() #cgi.print_environ() form = cgi.FieldStorage() try: if len(form)==0: send_form1() else: form_name=form['form_name'].value if form_name=='form1': recv_form1() except StandardError, e: print \nBRERROR: %s\n % e myend() To support a stateless world: 1. Each form has a send_xyz and recv_xyz function. The end of each recv_xyz decides what send_xyz to do next. 2. mystart and myend handle opening and closing the http and html. They also handle state save/restore as needed (pickle or database). Philippe C. Martin wrote: Hi, I wish to use an easy way to generate reports from wxPython and feel wxHtmlEasyPrinting could be a good solution. I now need to generate the HTML wxHtmlEasyPrinting can print: I need to have a title followed by lines of text that do not look too ugly. If possible I would like to use an existing module. Q1) Is there such a module ? Q2) Is my approach fairly good ? Regards, Philippe -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 1443 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: python bytecode grammar X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 29 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Fri, 10 Jun 2005 17:32:15 GMT Xref: news.xs4all.nl comp.lang.python:381172 M1st0 [EMAIL PROTECTED] writes: Ops yes is BNF :P Bacus Normal Form if I am not wrong... However.. I'am tryng to recognizing patterns in a bytecoded file in orderd to optimize... But I would like to parse i.e reconstruct it in something like a tree.. in order to apply rules on a tree recursively. I have seen compile.c in the Python dist... I've never looked, but I'm assuming it is defined in the compiler and in the interpreter, and hopefully documented elsehwere, like: http://python.fyxm.net/peps/pep-0330.html Related: http://mail.python.org/pipermail/python-dev/2004-December/050542.html http://search.cpan.org/search?query=python%3A%3Abytecodemode=all -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
Subject: Re: Binary numbers
Em Quarta 08 Junho 2005 09:38, Guyon Morée escreveu: Don't know if this is what you mean, but: Binary to decimal: bin_num = '11011' int(bin_num, 2) 267 Dont know this way of using it. Thanks for the teachings :) See ya ! def binary(i): ... ls=[] ... while 1: ... ls.append(i1) ... i=1 ... if i==0: ... break ... return .join(str(x) for x in reversed(ls)) ... binary(20) '10100' -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Hi guys I am working in a complex directory structure. I want to use a file (not .py) which is in some other directory. I couldn't do it.but if I copy the file in the same directory then it is working fine. Can anybody guide me how and where to add the path of the file. I have tried it with sys.path but it is not for that. -- Regards, Jatinder Singh Everyone needs to be loved... especially when they do not deserve it. -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
Announcing -- The 2.6.1.0 release of wxPython is now available for download at http://wxpython.org/download.php. Anybody keeping track will probably notice that the prior release (2.6.0.1) was released just about a week ago. This short turn-around time is because I was slow getting the last release done, and the wxWidgets team was uncharacteristically early with the 2.6.1 release! This release consists of a few bug fixes made since 2.6.0.1. What is wxPython? - wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a Python extension module that wraps the GUI components of the popular wxWidgets cross platform library, which is written in C++. wxPython is a cross-platform toolkit. This means that the same program will usually run on multiple platforms without modifications. Currently supported platforms are 32-bit Microsoft Windows, most Linux or other Unix-like systems using GTK or GTK2, and Mac OS X. Changes in 2.6.1.0 -- wx.ListCtrl: patch #1210352, fixes editing in generic wx.ListCtrl with wx.LC_EDIT_LABELS. Applied patch #208286, MediaCtrl DirectShow rewrite. DocView patches from Morgan Hua: bug fixes, and additional SVN commands, also added a default template that uses the text editor for any unknown file type. wxMSW: Use the system IDC_HAND cursor for wx.CURSOR_HAND and only fallback to the strange wxWidgets version if the system one is not available. wx.grid.Grid: Merge the cell size attribute the same way that other attributes are merged, e.g., if it is already set to a non-default value in the current GridCellAttr object then don't merge from the other. wx.lib.evtmgr: Fixed to use wx._core._wxPyDeadObject wx.lib.gridmovers: Don't scroll when the mouse is dragged outside of the grid, unless the mouse is kept in motion. wxMSW: Applied patch #1213290 incorrect logic in wx.TopLevelWindow.ShowFullScreen. Applied patch #1213066 correct device names for Joystick in Linux. wxGTK: Applied patch #1207162 wx.TextCtrl.SetStyle fix for overlapping calls. wx.FileConfig: fixed DeleteEntry to set the dirty flag properly so the change will get written at the next flush. -- Robin Dunn Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython! -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 1598 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsfeeder.wxs.nl!textfeed1.on.meganewsservers.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: something like CPAN, PPMs? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 38 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Tue, 31 May 2005 18:58:32 GMT Xref: news.xs4all.nl comp.lang.python:379601 Alex Gittens [EMAIL PROTECTED] writes: I'm new to Python from Perl, and loving it. Has there ever been any discussion of creating a similar resource as CPAN for Python, or a similar distribution method as PPMs? Seems like it would make a great language even better. Alex -- http://tangentspace.net/cz CPAN: 1. A lot of the CPAN subject matter is in the base python installation. 2. Much of the remainder is associated with projects which are doing something else and happen to provide python bindings. 3. That leaves python-specific libraries as candidates for a CPAN. See: http://www.python.org/pypi (see also http://www.python.org/sigs/catalog-sig/) http://www.vex.net/parnassus/ (the original classic) PPM: The typical python install is: a) unzip and untar b) run python setup.py install So what you are looking for is setup.py, and its module, distutils http://docs.python.org/lib/module-distutils.html -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 1636 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsfeeder.wxs.nl!textfeed1.on.meganewsservers.com!meganewsservers.com!feeder2.on.meganewsservers.com!216.196.98.140.MISMATCH!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: NaN support etc. X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=iso-8859-1 Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 38 Sender: [EMAIL PROTECTED] Content-Transfer-Encoding: 8bit Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Thu, 19 May 2005 13:14:32 GMT Xref: news.xs4all.nl comp.lang.python:378109 Sébastien Boisgérault [EMAIL PROTECTED] writes: Martin v. Löwis a écrit : Andreas Beyer wrote: How do I find out if NaN, infinity and alike is supported on the current python platform? [snip] But, practically, I have never found a platform where the following fpconst-like code did not work: import struct cast = struct.pack big_endian = cast('i',1)[0] != '\x01' if big_endian: nan = cast('d', '\x7F\xF8\x00\x00\x00\x00\x00\x00')[0] else: nan = cast('d', '\x00\x00\x00\x00\x00\x00\xf8\xff')[0] Can anybody provide an example of a (not too old or exotic) platform where this code does not behave as expected ? Cheers, SB I use fpconst too. I've been concerned that its source home seems to wander. Any chance of it being added to the base distro? -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 2056 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!border2.nntp.ams.giganews.com!nntp.giganews.com!fi.sn.net!newsfeed2.fi.sn.net!newsfeed3.funet.fi!newsfeed1.funet.fi!newsfeeds.funet.fi!newsfeed1.swip.net!swipnet!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: ElementTree and xsi to xmlns conversion? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 43 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Thu, 19 May 2005 13:24:58 GMT Xref: news.xs4all.nl comp.lang.python:378110 Fredrik Lundh [EMAIL PROTECTED] writes: [snip] are you sure? the prefix shouldn't matter; it's the namespace URI that's important. if you're writing code that depends on the namespace prefix rather than the name- space URI, you're not using namespaces correctly. when it comes to namespaces, elementtree forces you to do things the right way: http://www.jclark.com/xml/xmlns.htm (unfortunately, the XML schema authors didn't understand namespaces so they messed things up: http://www.w3.org/2001/tag/doc/qnameids-2002-04-30 to work around this, see oren's message about how to control the namespace/prefix mapping. in worst case, you can manually insert xsi:-attributes in the tree, and rely on the fact that the default writer only modifies universal names) /F First, thanks for ElementTree and cElementTree. Second, I've read the docs and see a lot of examples for building trees, but not a lot for traversing parsed trees. Questions: 1. Is there a good idiom for namespaces? I'm currently doing things like: UML='{href://org.omg/UML/1.3}' packages=ns2.findall(UML+'Package') 2. Is there a similar idiom which works for Paths? I've tried: packages=pkg1.findall(UML+'Namespace.ownedElement/'+UML+'Package') but haven't found the right combination, so I do step-at-a-time descent. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
To whom it may concern, I am looking to start a python organization in Iran from scrtch, Please help me with it, or give me the mailing address of a reson which is advanced/experienced in what I try to achieve. best regards Mesean Dehmand __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
__ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 2528 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: String formatting strangeness X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 55 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Fri, 13 May 2005 14:03:03 GMT Xref: news.xs4all.nl comp.lang.python:377190 [EMAIL PROTECTED] writes: I must be doing something wrong, but for the life of me, I can't figure out what. Here's the code snippet which is giving me grief: print type(number), type(name), type(seconds // 60), type(seconds % 60) print \t\t\tsection number=\%i\ title=\%s\ length=\%i:%i\/\n % [number, name, seconds // 60, seconds % 60] (These are lines 49 and 50 of the script; I can post the whole thing if someone wants, but I think this is enough to see why it's driving me nuts.) And the output: type 'int' type 'str' type 'int' type 'int' Traceback (most recent call last): File X:\Music (FLAC)\Post-process new rips.py, line 50, in ? print \t\t\tsection number=\%i\ title=\%s\ length=\%i:%i\/\n % [number, name, seconds // 60, seconds % 60] TypeError: int argument required Wait, what? The first line clearly identifies that the the first, third, and fourth elements are all integers, yet the error says that *lack* of integers is the problem. If I change all %is to %d, I get the same problem, and changing to %s (hey, it was worth a shot) gives TypeError: not enough arguments for format string instead. Huh? I see four placeholders and a four-element tuple. Can anyone enlighten me here? I notice you used a list instead of a tuple. Changing to a tuple gives the desired output: number=1 name=myname seconds=250 print \t\t\tsection number=\%i\ title=\%s\ length=\%i:%i\/\n \ % (number, name, seconds // 60, seconds % 60) section number=1 title=myname length=4:10/ I have no idea why a list has that effect. PS: When writing XML and HTML, I use single quotes, so I don't have to escape double quotes: print '\t\t\tsection number=%i title=%s length=%i:%i/\n' \ % (number, name, seconds // 60, seconds % 60) -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
[no subject]
#! rnews 1990 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Py2Exe security X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 Lines: 35 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Tue, 3 May 2005 13:18:19 GMT Xref: news.xs4all.nl comp.lang.python:375624 Terje Johan Abrahamsen [EMAIL PROTECTED] writes: Hello. We have created some programs in Python that are to be distributed around. The programs will be made into .exe files by py2exe. However, in the source there are certain webadresses, logins and passwords that the programs use, that we would like to keep away from the end users. They will use them thru the program, but we would like them not to be extracted and used separately for other purposes. Is the compiling by py2exe enough? I have opened all the files in the directory py2exe has made, and have not found anything I could read in clear text. However, that does not mean that others can not. Is it possible to extract these passwords, adresses and logins from the sourcecode? If py2exe is not enough, is there some other simple tools we can use to hide the source from the endusers? Thanks in advance. Putting passwords in your program is a bad idea, with or without Python and py2exe. Even if you wrote the program in obfuscated C, and stripped comments etc, an attacker could use strings to search for candidate passwords. Or just start at the beginning of the program and use each byte as a candidate starting char. Since you are working on MS Windows, consider getting: M. Howard, D. LeBlanc, Writing Secure Code, Microsoft Press, 2002. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
Re: To decode the Subject =?iso-8859-2?Q?=... in email in python
Max, thanks; that was helpful. Roman, your explanation was helpful as well. Dan -- http://mail.python.org/mailman/listinfo/python-list
To decode the Subject =?iso-8859-2?Q?=... in email in python
When parsing messages using python's libraries email and mailbox, the subject is often encoded using some kind of = notation. Apparently, the encoding used in this notation is specified like =?iso-8859-2?Q?=... or =?iso-8859-2?B?=. Is there a python library function to decode such a subject, returning a unicode string? The use would be like human_readable = cool_library.decode_equals(message['Subject']) Thank you, Dan -- http://mail.python.org/mailman/listinfo/python-list
Re: To decode the Subject =?iso-8859-2?Q?=... in email in python
Dan Polansky wrote: When parsing messages using python's libraries email and mailbox, the subject is often encoded using some kind of = notation. Apparently, the encoding used in this notation is specified like =?iso-8859-2?Q?=... or =?iso-8859-2?B?=. Is there a python library function to decode such a subject, returning a unicode string? The use would be like human_readable = cool_library.decode_equals(message['Subject']) parts = email.Header.decode_header(header) new_header = email.Header.make_header(parts) human_readable = unicode(new_header) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list
Re: To decode the Subject =?iso-8859-2?Q?=... in email in python
# [EMAIL PROTECTED] / 2005-04-20 00:30:35 -0700: When parsing messages using python's libraries email and mailbox, the subject is often encoded using some kind of = notation. Apparently, the encoding used in this notation is specified like =?iso-8859-2?Q?=... or =?iso-8859-2?B?=. That's RFC 2047 encoding, both examples introduce an ISO8859-2 string, the first variant says it's ascii-ized using Quoted-Printable, the other says the string is Base64-encoded. Is there a python library function to decode such a subject, returning a unicode string? The use would be like human_readable = cool_library.decode_equals(message['Subject']) quoting from http://docs.python.org/lib/module-email.Header.html from email.Header import decode_header decode_header('=?iso-8859-1?q?p=F6stal?=') [('p\xf6stal', 'iso-8859-1')] -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- http://mail.python.org/mailman/listinfo/python-list
Re: To decode the Subject =?iso-8859-2?Q?=... in email in python
Dan Polansky: When parsing messages using python's libraries email and mailbox, the subject is often encoded using some kind of = notation. Apparently, the encoding used in this notation is specified like =?iso-8859-2?Q?=... or =?iso-8859-2?B?=. Is there a python library function to decode such a subject, returning a unicode string? The use would be like human_readable = cool_library.decode_equals(message['Subject']) Here is some code from a front end to Mailman moderation pages: import email.Header hdr = email.Header.make_header(email.Header.decode_header(sub)) Neil -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
-- Virus Warning Message (on cesio.consuldata.com.br) Found virus WORM_MYDOOM.M in file document.pif (in document.zip) The uncleanable file is deleted. Para maiores informacoes, contate o suporte da ConsulData: +55 (13) 3219-6522 ou [EMAIL PROTECTED] - The message was not delivered due to the following reason(s): Your message could not be delivered because the destination computer was not reachable within the allowed queue period. The amount of time a message is queued before it is returned depends on local configura- tion parameters. Most likely there is a network problem that prevented delivery, but it is also possible that the computer is turned off, or does not have a mail system running right now. Your message could not be delivered within 4 days: Mail server 87.98.63.65 is not responding. The following recipients could not receive this message: python-list@python.org Please reply to [EMAIL PROTECTED] if you feel this message to be in error. -- Virus Warning Message (on cesio.consuldata.com.br) document.zip is removed from here because it contains a virus. --- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 2153 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!transit0.news.tiscali.nl!tiscali!newsfeed1.ip.tiscali.net!proxad.net!proxad.net!newshosting.com!nx02.iad01.newshosting.com!novia!feed2.newsreader.com!newsreader.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Python's use in RAD X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 46 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Fri, 15 Apr 2005 15:33:58 GMT Xref: news.xs4all.nl comp.lang.python:372620 Ross Cowie [EMAIL PROTECTED] writes: Hi, I am currenly a second year university student and was wondering if you could help me ut. As part of a project i have decided to write about python, i am not having very much luck with regards to finding infrmation on pythons use in Rapid Application Development, and was wondering of you could highlight some of the features that make it suitable for RAD. Like the use of dinamic binding. Your healp would be appreciated. Hope to hear from you soon. Ross Generally we don't do homework here. But we can give you pointers. 1. Searching google for python RAD shows 148,000 hits, and at least the first few pages look relevant. Did you check? 2. RAD means different things to different people. Do you mean: a) Agile/Extreme Programming (2 or more people working together) b) Test-driven c) GUI builder d) Rapid edit-run cycle e) Lots of libraries so your work is just hooking together existing tools f) Dynamic, code-generated-on-the-fly, or other meta programming g) Project management experience in life cycle flow times and labor costs You need to understand your assignment in these terms, then you can investigate Python. 3. As a practical matter, Python does a-g quite well. Originally this was because of the rich-yet-clean syntax and batteries-included libraries. These days those factors still count, but they are enhanced by large numbers of other libraries and tools which have Python bindings. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 4875 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Best editor? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 106 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Wed, 6 Apr 2005 14:22:57 GMT Xref: news.xs4all.nl comp.lang.python:371122 ChinStrap [EMAIL PROTECTED] writes: When not using the interactive prompt, what are you using? I keep hearing everyone say Emacs, but I can't understand it at all. I keep trying to learn and understand why so many seem to like it because I can't understand customization even without going through a hundred menus that might contain the thing I am looking for (or I could go learn another language just to customize!). Personally I like SciTE, it has everything I think a midweight editor should: code folding, proper python support, nice colors out of the box, hotkey access to compile (I'm sure emacs does this, but I couldn't figure out for the life of me how), etc. Opinions on what the best is? Or reading I could get to maybe sway me to Emacs (which has the major advantage of being on everyone's system). The key (as others have said) is to know your editor and be effective with it. As long as it can handle ASCII, does autoindent, and knows tab-is-4-chars, then it is a viable choice. Since you asked specifically about emacs, and whether or not it is worthwhile... I've used emacs for 15 years, and am still learning useful new tricks at a rate of about one per 6 months. But I've also found that the essentials can be taught in a 2 hour session and mastered in about 2 weeks of use. I've taught dozens of people using this Essential Emacs approach. We find that emacs is for people who will be doing serious editing all day long (e.g., programmers). I like that comment from another poster: Emacs is a good place to live, but I wouldn't want to visit there. For people who will just be editing an occassional file (and no python code), we recommend notepad or nedit. Now then, how do we use emacs? 1. Proper setup is essential. Assuming you have python-mode.el and .elc in emacs's program-modes dir, then your .emacs needs: ;---python--- (load python-mode) (setq auto-mode-alist (cons '(\\.py$ . python-mode) auto-mode-alist)) (setq interpreter-mode-alist (cons '(python . python-mode) interpreter-mode-alist)) (autoload 'python-mode python-mode Python editing mode. t) (add-hook 'python-mode-hook 'turn-on-font-lock) (setq python-mode-hook 'python-initialise) (defun python-initialise () (interactive) (setq default-tab-width 4) (setq indent-tabs-mode nil) ) 2. I almost never use the interactive prompt. There are people here who do, but as soon as the script is more than a couple lines long, it takes longer to reenter the code (even copy-and-paste) than to edit-save-run a dummy batch script. When I'm doing Extreme Programming with such people, I insist on using a stopwatch and checking which approach is more efficient -- they usually come over to my approach. 3. I run emacs with split windows: a) Edit the working code b) Edit the unittest code c) Run a shell script, where I (re)run the go_test script by doing alt-p ret In another frame (same emacs process, different frame) I keep the oracle (known good) and test outputs in split windows, and maybe do ediff-buffers on them if the deltas are not obvious. For each module under consideration (view or edit), I use a separate emacs process in a similar manner. In normal work, that means 1-4 emacs processes running, each with its own shell and own test cycles. 4. Elsewhere I'm running emacs rmail all day, and run emacs gnus several times a day (like now). 5. When I do Extreme Programming, the other author(s) tend to be using emacs, vim, or nedit. We don't let people use notepad for python becuause it doesn't know proper formatting. IDE's tend to want to own the whole show, which makes cross-tool Extreme Programming a pain. As long as the other programmers have set their editors for auto-indention and tab-is-4-chars, then we get along fine. [I do notice a sizeable delay when vim people search for the appropriate shell windows, instead of having them in a (joined-at-the-hip) split window. This has more to do with bookkeeping than with editors per se, but it is a data point.] 6. On IDE's and code-completion: If you are going to be typing the same thing over and over, why not use a function, or maybe code generation? -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 2135 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Best editor? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 49 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Wed, 6 Apr 2005 19:35:28 GMT Xref: news.xs4all.nl comp.lang.python:371180 ChinStrap [EMAIL PROTECTED] writes: Well I would be more than willing to learn Emacs if it does all these things you speak of, but really I can't get started because the default scheme is so friggin ugly it isn't funny. Anyone want to send me a configuration setup with Python in mind, and decent colors? Set .emacs for: ;;; basic (set-background-color white) (set-foreground-color black) (set-border-color black) (setq column-number-mode t) (setq dired-ls-F-marks-symlinks t) Do that prior to the python settings: ;---python--- (load python-mode) (setq auto-mode-alist (cons '(\\.py$ . python-mode) auto-mode-alist)) (setq interpreter-mode-alist (cons '(python . python-mode) interpreter-mode-alist)) (autoload 'python-mode python-mode Python editing mode. t) (add-hook 'python-mode-hook 'turn-on-font-lock) (setq python-mode-hook 'python-initialise) (defun python-initialise () (interactive) (setq default-tab-width 4) (setq indent-tabs-mode nil) ) Then the default color scheme looks ok (at least to me). The critical command is: (add-hook 'python-mode-hook 'turn-on-font-lock) If you comment that out (with a leading ;), then font coloring is turned off and you just have black on white. You can learn the language and the editor in that mode if necessary. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 #! rnews 1727 Xref: xyzzy comp.security.ssh:39215 Newsgroups: comp.security.ssh Path: xyzzy!nntp From: Mike Lowery [EMAIL PROTECTED] Subject: Re: Ignoring known_hosts X-Nntp-Posting-Host: e458612.nw.nos.boeing.com Message-ID: [EMAIL PROTECTED] X-Mimeole: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Priority: 3 X-Msmail-Priority: Normal Lines: 33 Sender: [EMAIL PROTECTED] (Boeing NNTP News Access) Organization: The Boeing Company X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Date: Wed, 6 Apr 2005 19:36:09 GMT Richard E. Silverman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mike == Mike Lowery [EMAIL PROTECTED] writes: [~/.ssh/known_hosts] foo [foo's key ...] bar [foo's key ...] [~/.ssh/config] host foo hostname foo's name or address hostkeyalias foo host bar hostname bar's name or address hostkeyalias bar ... and use ssh {foo|bar}. Mike This might work It will work. Mike but again, it requires me manually adding each server to the Mike config file which I'm hoping to avoid since there are many. How? If your machines are not uniquely identified to the client by their names or addresses, then you must indicate the distinctions yourself by configuration. How? Tell SSH to stop checking for this potential problem. I don't care that the key doesn't match what it was last time, just give me access! Apparently that option doesn't exist. -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 1227 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: IronPython 0.7 released! X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 19 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Tue, 5 Apr 2005 19:05:05 GMT Xref: news.xs4all.nl comp.lang.python:370993 Thomas Gagne [EMAIL PROTECTED] writes: Does the Python community think Microsoft's embrace is a good or bad thing? James wrote: http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742 Please refer to uploaded documentation for full text of the Shared Source License for IronPython says it all. Shared Source is an abomination, complete with the risk of cross-contaminating true OSS projects. I wouldn't voluntarily use the thing and I certainly wouldn't look at the source code. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 2776 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!central.cox.net!east.cox.net!filt02.cox.net!peer01.cox.net!cox.net!attga1!attga2!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: unittest vs py.test? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 49 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Mon, 4 Apr 2005 15:30:36 GMT Xref: news.xs4all.nl comp.lang.python:370744 [EMAIL PROTECTED] (Roy Smith) writes: Peter Hansen [EMAIL PROTECTED] wrote: It seems possible to me that I might have helped him solely by pointing out that unittest might not be so heavy as some people claimed. I got the impression that he might be swayed by some unfounded claims not even to look further at unittest, which I felt would be a bad thing. I'm the him referred to above. I've been using unittest ever since it was first added to the standard library (actually, now that I think about it, I believe I may have been using it even before then). And yes, I think unittest brings along a certain amount of baggage. There is something attractive about having the same basic framework work in many languages (PyUnit, JUnit, C++Unit, etc), but on the other hand, it does add ballast. I use it, I certainly don't hate it, but on the other hand, there are enough things annoying about it that it's worth investing the effort to explore alternatives. From the few days I've been playing with py.test, I think I like what I see, but it's got other issues. The optimization elides assert issue we've been talking about is one. It's also neat that I can write unittest-style test classes or go the simplier route of just writing static test functions, but there's a certain amount of TIMTOWTDI (did I spell that right?) smell to that. I'm also finding the very terse default output from unittest (basicly a bunch of dots followed by all N tests passed) highly preferable to py.test's verbosity. In short, I haven't made up my mind yet, but I do appreciate the input I've gotten. I haven't used pytest, so no comparisons to offer. But for unittest, I've found a lot of the baggage can be automated. My mkpythonproj (http://www.seanet.com/~hgg9140/comp/index.html#L006) does that. When you generate a project, you get a unittest suite with a default test ready to run, and the mechanisms needed to add more. -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 1066 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: hex string into binary format? X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 28 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] Mime-Version: 1.0 Date: Thu, 31 Mar 2005 14:58:03 GMT Xref: news.xs4all.nl comp.lang.python:370100 Tertius Cronje [EMAIL PROTECTED] writes: Hi, How do I get a hexvalued string to a format recognized for binary calculation? import binascii s1 = '1C46BE3D9F6AA820' s2 = '8667B5236D89CD46' i1 = binascii.unhexlify(s1) i2 = binascii.unhexlify(s2) x = i1 ^i2 TypeError: unsupported operand type(s) for ^: 'str' and 'str' Many TIA T i1=int(s1,16) i2=int(s2,16) -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list
(no subject)
#! rnews 1765 Newsgroups: comp.lang.python Path: news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!195.241.76.212.MISMATCH!transit1.news.tiscali.nl!tiscali!transit0.news.tiscali.nl!tudelft.nl!130.161.131.117.MISMATCH!tudelft.nl!newsfeed.multikabel.nl!gatel-ffm!gatel-ffm!proxad.net!proxad.net!newsread.com!news-xfer.newsread.com!nntp.abs.net!attws2!ip.att.net!NetNews1!xyzzy!nntp From: Harry George [EMAIL PROTECTED] Subject: Re: Generating RTF with Python X-Nntp-Posting-Host: cola2.ca.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: [EMAIL PROTECTED] User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Lines: 37 Sender: [EMAIL PROTECTED] Organization: The Boeing Company References: [EMAIL PROTECTED] [EMAIL PROTECTED] Mime-Version: 1.0 Date: Thu, 31 Mar 2005 20:56:42 GMT Xref: news.xs4all.nl comp.lang.python:370154 Axel Straschil [EMAIL PROTECTED] writes: Hello! does anyone know of a high-level solution to produce RTF from Python=20 (something similar to Reportlab for producing PDF)? Spend hours of googeling and searching, also in this NG, about two months ago. My conclusion is: On windwos, maybe you can include some hacks with dll's, under linux, linux support for generating rtf is none, and so is python's. My workaround was: http://www.research.att.com/sw/download/ This includes an html2rtf converter, which I access from python via popen and temporary files. Not high-level, not very sexy ... ;-( Lg, AXEL. -- Aber naja, ich bin eher der Forentyp. Wolfibolfi's outing in http://www.informatik-forum.at/showpost.php?p=206342postcount=10 I generate docbook and convert that to rtf. I generate the docbook from my pdx markup: http://www.seanet.com/~hgg9140/comp/index.html#L007 If you go this route, your python code is actually writing pdx, and you need a 2 step conversion (pdx2docbook.py, then openjade for the xml-to-rtf step). -- [EMAIL PROTECTED] 6-6M21 BCA CompArch Design Engineering Phone: (425) 294-4718 -- http://mail.python.org/mailman/listinfo/python-list