Re: Python Editor or IDE ActiveX control
Hi! Scintilla come like a control (a piece for a window), raleted to the file SciLexer.DLL For call the scintilla-componant, use messages. Example : SendMessage(Sci, SCI_GOTOLINE, line, 0) For the constant SCI_GOTOLINE, I suggest scintillacon.py, include in Pywin32. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
Robert Kern wrote: Please follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 argument to make sure that you do not split on spurious b'\r\n\r\n' sequences inside the JPEG body. Do not decode the bytes. Correct, and I'll add that this is a case where we might want to be better than correct. BaseHTTPRequestHandler in the Python standard library accommodates clients that incorrectly omit the '\r' and end header lines with just '\n'. Such apps have been seen in the wild. Since bare '\n' never appears in correctly formed HTTP headers, interpreting it as equivalent to '\r\n' doesn't break anything. The re module offers a split that does what we want. import re boundary_re = re.compile(br'\r?\n\r?\n') then you can use: (headers, content) = boundary_re.split(rawdata, 1) I like Robert's suggestion to use the HTTP server or wsgiref in the Python library. There's significant arcane wisdom programmed in already. -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading the access attributes of directories in Windows
On Wed, Aug 25, 2010 at 05:04, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message pan.2010.08.22.04.26.33.547...@nowhere.com, Nobody wrote: Having this as a separate permission allows normal users to add entries to log files but not to erase existing entries. Unix/Linux systems can do this already. Ooh, I didn't know that -- what combination of permissions would I have to use to get such an effect? -- Rami Chowdhury Never assume malice when stupidity will suffice. -- Hanlon's Razor 408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD) -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading the access attributes of directories in Windows
On Fri, 27 Aug 2010 13:28:46 +0600, Rami Chowdhury wrote: Having this as a separate permission allows normal users to add entries to log files but not to erase existing entries. Unix/Linux systems can do this already. Ooh, I didn't know that -- what combination of permissions would I have to use to get such an effect? You can't do it with permissions, you need to use ext2 attributes. Specifically, chattr +a filename will set the append attribute, which prevents the file being opened for write except in append mode. Changing this attribute requires root privilege or the CAP_LINUX_IMMUTABLE capability. -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
On Thu, 26 Aug 2010 23:56:26 -0700, Bryan wrote: follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 argument to make sure that you do not split on spurious b'\r\n\r\n' sequences inside the JPEG body. Do not decode the bytes. Correct, and I'll add that this is a case where we might want to be better than correct. BaseHTTPRequestHandler in the Python standard library accommodates clients that incorrectly omit the '\r' and end header lines with just '\n'. Such apps have been seen in the wild. Since bare '\n' never appears in correctly formed HTTP headers, interpreting it as equivalent to '\r\n' doesn't break anything. Yes it does. It breaks upstream filtering rules which are intended to prohibit, remove or modify certain headers. This class of attack is known as HTTP request smuggling. By appending a header preceded by a bare '\r' or '\n' to the end of another header, the header can be smuggled past a filter which parses headers using the correct syntax, but will still be treated as a header by software which incorrectly parses headers using bare '\r' or '\n' as separators. The safest solution would be to simply reject any request (or response) which contains bare '\r' or '\n' characters within headers, at least by default. Force the programmer to read the documentation (where the risks would be described) if they want the fault tolerant behaviour. -- http://mail.python.org/mailman/listinfo/python-list
palindrome iteration
level: beginner the following code looks ok to me but it doesn't work. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] return True print i_palindrome('annab') my reasoning: - i check the length of the string: if 1 continue - i check first and last char: if they are equal continue - create a new, shorter string starting at index 1 and ending at second last index (up to but not including index-1 -restart the while loop as long as length of string is 1 - exiting this loop means all compared chars were identical hence it is a palindrome and i return True tnx Baba -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
One possible reason I can think of - - exiting this loop means all compared chars were identical hence it is a palindrome and i return True is probably incorrect reasoning. Think again. Also, you may consider posting your code in a way that preserves the whitespace characters. Cheers, Xav On 27 August 2010 18:53, Baba raoul...@gmail.com wrote: level: beginner the following code looks ok to me but it doesn't work. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] return True print i_palindrome('annab') my reasoning: - i check the length of the string: if 1 continue - i check first and last char: if they are equal continue - create a new, shorter string starting at index 1 and ending at second last index (up to but not including index-1 -restart the while loop as long as length of string is 1 - exiting this loop means all compared chars were identical hence it is a palindrome and i return True tnx Baba -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Baba wrote: level: beginner the following code looks ok to me but it doesn't work. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] return True Do yourself a favour and use 4-space indent. That makes the structure of your code more obvious. print i_palindrome('annab') my reasoning: - i check the length of the string: if 1 continue - i check first and last char: if they are equal continue - create a new, shorter string starting at index 1 and ending at second last index (up to but not including index-1 -restart the while loop as long as length of string is 1 - exiting this loop means all compared chars were identical hence it is a palindrome and i return True If the test pal[0] == pal[-1] fails, i. e. the two compared characters differ, what happens? More generally, if pal is not a palindrome, can your function ever return False? If not, at what point should it? Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Baba a écrit : level: beginner the following code looks ok to me but it doesn't work. doesn't work is about the most useless description of a problem. Please specify what you expected and what actually happens. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] Can you explain what happens if pal[0] != pal[-1] ? (answer below) return True print i_palindrome('annab') And then you go in an infinite loop !-) my reasoning: - i check the length of the string: if 1 continue - i check first and last char: if they are equal continue - create a new, shorter string starting at index 1 and ending at second last index (up to but not including index-1 -restart the while loop as long as length of string is 1 - exiting this loop means all compared chars were identical hence it is a palindrome and i return True Your problem is that when first and last char are not equal, you don't exit the while loop. You need a return False somewhere here, ie: def is_palindrom(pal): while len(pal)1: # NB : inverted the test here to make exit more obvious if pal[0] != pal[-1]: return False pal=pal[1:-1] return True Now there is another solution. A palindrom is made of two symetric halves, with (odd len) or without (even len) a single char between the symetric halves, ie : * odd : ABCBA ('AB' + 'C' + 'BA') * even : ABCCBA ('ABC' + 'CBA') So you just have to extract the symetric halves, reverse one, and compare both (case insensitive compare while we're at it). Here's a possible (and a bit tricky) Python 2.x implementation: def is_palindrom(s): s = s.lower() slen = len(s) until = slen / 2 # Python 2x integer division offset = int(not(slen % 2)) runtil = until - offset return s[0:until] == s[-1:runtil:-1] -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Now there is another solution. A palindrom is made of two symetric halves, with (odd len) or without (even len) a single char between the symetric halves, ie : * odd : ABCBA ('AB' + 'C' + 'BA') * even : ABCCBA ('ABC' + 'CBA') So you just have to extract the symetric halves, reverse one, and compare both (case insensitive compare while we're at it). Yes, this is a correct observation, but it is not necessary to compare the halves; Simply compare the complete string with its reverse. If they match, it is a palindrome. Here's a possible (and a bit tricky) Python 2.x implementation: def is_palindrom(s): s = s.lower() slen = len(s) until = slen / 2 # Python 2x integer division offset = int(not(slen % 2)) runtil = until - offset return s[0:until] == s[-1:runtil:-1] At first glance this seems to be correct, but it is tricky indeed. Particularly the assignment of the offset variable, casting a bool to an integer of a negated expression. Given that Baba notes that this is a beginners level query, it wouldn't have hurt to be a little bit more verbose there. Richard -- http://mail.python.org/mailman/listinfo/python-list
Re: pil and reportlab: image compression
On 26 Aug., 13:16, steph stepha...@yahoo.de wrote: Hi group, I've written a small application that puts images into a pdf document. It works ok, but my problem is that the pdf-files become quite huge, bigger than the original jpegs. The problem seems to arise because I use PIL to resize the pictures - and the images seem to get uncompressed in the process. Unfortunately I have not found a way to compress them again before rendering them to the pdf. Any clues? Thanks, Stephan Solved this by writung to anonymous mmap. Works nicely :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Yes, this is a correct observation, but it is not necessary to compare the halves; Simply compare the complete string with its reverse. If they match, it is a palindrome. I've always used to implement the is_palindrome function as you suggest, i.e. comparing the original string with the reverse one, but while reading, I tought about a imho nicer version which prevent from creating another string. Here are both the recursive/iterative versions of the function: def palindrome(str, i=0, j=-1): try: if str[i] == str[j]: return palindrome(str, i + 1, j - 1) return False except IndexError: return True def palindrome(str, i=0, j=-1): try: while True: if str[i] != str[j]: return False i, j = i + 1, j - 1 return True except IndexError: return True Regards, Matteo Here's a possible (and a bit tricky) Python 2.x implementation: def is_palindrom(s): s = s.lower() slen = len(s) until = slen / 2 # Python 2x integer division offset = int(not(slen % 2)) runtil = until - offset return s[0:until] == s[-1:runtil:-1] At first glance this seems to be correct, but it is tricky indeed. Particularly the assignment of the offset variable, casting a bool to an integer of a negated expression. Given that Baba notes that this is a beginners level query, it wouldn't have hurt to be a little bit more verbose there. Richard -- http://mail.python.org/mailman/listinfo/python-list -- Matteo Landi http://www.matteolandi.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Bruno Desthuilliers wrote: div class=moz-text-flowed style=font-family: -moz-fixedBaba a écrit : level: beginner the following code looks ok to me but it doesn't work. doesn't work is about the most useless description of a problem. Please specify what you expected and what actually happens. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] Can you explain what happens if pal[0] != pal[-1] ? (answer below) return True print i_palindrome('annab') And then you go in an infinite loop !-) my reasoning: - i check the length of the string: if 1 continue - i check first and last char: if they are equal continue - create a new, shorter string starting at index 1 and ending at second last index (up to but not including index-1 -restart the while loop as long as length of string is 1 - exiting this loop means all compared chars were identical hence it is a palindrome and i return True Your problem is that when first and last char are not equal, you don't exit the while loop. You need a return False somewhere here, ie: def is_palindrom(pal): while len(pal)1: # NB : inverted the test here to make exit more obvious if pal[0] != pal[-1]: return False pal=pal[1:-1] return True Now there is another solution. A palindrom is made of two symetric halves, with (odd len) or without (even len) a single char between the symetric halves, ie : * odd : ABCBA ('AB' + 'C' + 'BA') * even : ABCCBA ('ABC' + 'CBA') So you just have to extract the symetric halves, reverse one, and compare both (case insensitive compare while we're at it). Here's a possible (and a bit tricky) Python 2.x implementation: def is_palindrom(s): s = s.lower() slen = len(s) until = slen / 2 # Python 2x integer division offset = int(not(slen % 2)) runtil = until - offset return s[0:until] == s[-1:runtil:-1] or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
Nobody wrote: Bryan wrote: this is a case where we might want to be better than correct. BaseHTTPRequestHandler in the Python standard library accommodates clients that incorrectly omit the '\r' and end header lines with just '\n'. Such apps have been seen in the wild. Since bare '\n' never appears in correctly formed HTTP headers, interpreting it as equivalent to '\r\n' doesn't break anything. Yes it does. It breaks upstream filtering rules which are intended to prohibit, remove or modify certain headers. This class of attack is known as HTTP request smuggling. By appending a header preceded by a bare '\r' or '\n' to the end of another header, the header can be smuggled past a filter which parses headers using the correct syntax, How does a bare '\r' or '\n' get past a filter which parses headers using the correct syntax? I don't see where the correct syntax of the HTTP protocol allows that. but will still be treated as a header by software which incorrectly parses headers using bare '\r' or '\n' as separators. Why blame software that incorrectly accepts '\n' as a line break, and not the filter that incorrectly accepted '\n' in the middle of a header? Both are accepting incorrect syntax, but only the former has good reason to do so. The safest solution would be to simply reject any request (or response) which contains bare '\r' or '\n' characters within headers, at least by default. Force the programmer to read the documentation (where the risks would be described) if they want the fault tolerant behaviour. The Internet has a tradition of protocols above the transport level being readable by eye and writable by hand. The result has been quick development, but many mistakes that can induce unforeseen consequences. This case is somewhat subtle. Within a text entity-body, HTTP allows any one of the three end-of-line delimiters. That's just the body; the header portion is more rigid. In HTTP 1.0: This flexibility regarding line breaks applies only to text media in the Entity-Body; a bare CR or LF should not be substituted for CRLF within any of the HTTP control structures (such as header fields and multipart boundaries). -- RFC 1945 While in HTTP 1.1: This flexibility regarding line breaks applies only to text media in the entity-body; a bare CR or LF MUST NOT be substituted for CRLF within any of the HTTP control structures (such as header fields and multipart boundaries). -- RFC 2616 Note the change from should not to MUST NOT. In reality our code might be called upon to work with apps that botch the technically- correct HTTP end-of-line marker. Rejecting bare '\n' may be safe from a technical security perspective, but if our safe code breaks a previously working system, then it will appear in a bug database and not in production. 'Nobody' makes a fair point. I'd love to see Internet protocols defined with mechanical rigor. Our discipline commonly specifies programming language syntax formally, and Internet protocols are syntactically simpler than programming languages. For now, HTTP is a bit of a mess, so write it absolutely correctly but read it a bit flexibly. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Richard Arts a écrit : Now there is another solution. A palindrom is made of two symetric halves, with (odd len) or without (even len) a single char between the symetric halves, ie : * odd : ABCBA ('AB' + 'C' + 'BA') * even : ABCCBA ('ABC' + 'CBA') So you just have to extract the symetric halves, reverse one, and compare both (case insensitive compare while we're at it). Yes, this is a correct observation, but it is not necessary to compare the halves; Simply compare the complete string with its reverse. If they match, it is a palindrome. Duh :( I kinda feel stupid right now, thanks Richard :-/ -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Confused: Newbie Function Calls
In article 2dd74ab4-5ed6-40ac-aea7-705977b61...@g21g2000prn.googlegroups.com, fuglyducky fuglydu...@gmail.com wrote: I am a complete newbie to Python (and programming in general) and I have no idea what I'm missing. Below is a script that I am trying to work with and I cannot get it to work. Side note: while it's fine to ask newbie questions on comp.lang.python, you may want to use resources oriented more toward newbies, such as the tutor list: http://www.python.org/about/help/ http://www.python.org/mailman/listinfo/tutor -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ ...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box. --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On Fri, 27 Aug 2010 11:49:42 -0400 D'Arcy J.M. Cain da...@druid.net wrote: is_palindrome = lambda x: x == x.lower()[::-1] Oops. Simple and wrong. is_palindrome = lambda x: x.lower() == x.lower()[::-1] -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 27/08/2010 15:43, Bruno Desthuilliers wrote: Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? It could be worse, try responding to issue 9702. :) Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
layer geld verdienen , leicht geldverdienen , wie kann ich onlinespiele geld gewinnen , geldgewinnspiele , zu geld machen , geld machen beim , pennergame geld verdienen , schnell geld vedienen , ohne
layer geld verdienen , leicht geldverdienen , wie kann ich onlinespiele geld gewinnen , geldgewinnspiele , zu geld machen , geld machen beim , pennergame geld verdienen , schnell geld vedienen , ohne geld online , geld mit online casino , * * * +++ SOFORT GEWINN +++ REICH WERDEN +++ * http://WWW.SOFORT-GEWINN-JETZT-1.NET http://WWW.SOFORT-GEWINN-JETZT-1.NET http://WWW.SOFORT-GEWINN-JETZT-1.NET http://WWW.SOFORT-GEWINN-JETZT-1.NET http://WWW.SOFORT-GEWINN-JETZT-1.NET http://WWW.SOFORT-GEWINN-JETZT-1.NET * * * ich will bargeld gewinn leicht viel geld verdienen wie kann ich online casino geld gewinnen wo kann ich geld am pc verdienen schnell geld verdienen im internet man mit dem internet geld schnell geld verdienen ohne internet viel geld verdienen drakensang geld machen uploads geld verdienen internet noch geld geld im internet forum geld verdienen durch internet ws schnell sofort geld gewinnen shop geld verdienen wie kann ich geld gewinnen bei mann schnell geld machen man leicht geld texte schreiben geld verdienen mit internet geld machen geld verdienen leicht gemacht wo kann ich geld gewinn spiel eigenen fotos geld verdienen kann man geld gewinnen pennergame geld machen einfach online geld verdienen wo kann ich geld am pc verdienen ich schnelles geld machen werbung internet geld geld verdienen im internet forum kann man online geld verdienen gewinnspiel gewinnen jetzt sofort mann geld machen schnell und legal geld verdienen online um echtes geld spielen sofort geld gewonnen wie kann ich geld gewinnen bei internet leicht geld uploaded to geld verdienen leichtes geld verdienen -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 27/08/2010 09:53, Baba wrote: level: beginner the following code looks ok to me but it doesn't work. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] return True print i_palindrome('annab') If you want to or must do it recursively. (Shown in pseudo code to make the logic clearer) def isPalindrome(pal) ''' test pal (a list) is a palindrome ''' if length of pal = 1 return True # all one letter strings are palindromes. if first equals last # pal could be a palindrome # so test inner part p = pal with first and last removed return isPalendrome(p) # and true - implied else return False # it can't be Of course, the simpler way is to use the definition of a Palindrome as the same backwards and forwards. def isPalindrome(pal) return pal == pal.reverse -- http://mail.python.org/mailman/listinfo/python-list
numpy is not installed with Python2.
My university has a cluster computer, on which I want to run my python program that uses numpy. I am installing my Python2.7 locally separated from the main system, and trying to install numpy, attach it with Python2.7. I used many different versions of numpys to make it happen, but I got stuck with the same following error on every trial, [...@login1 numpy]$ python2.7 setup.py install Running from numpy source directory.Traceback (most recent call last): File setup.py, line 210, in module setup_package() File setup.py, line 187, in setup_package from numpy.distutils.core import setup File /users/hp6/DOWN/numpy/numpy/distutils/core.py, line 25, in module from numpy.distutils.command import config, config_compiler, \ File /users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py, line 9, in module from distutils.command.build_ext import build_ext as old_build_ext File /users/hp6/apps/python27/lib/python2.7/distutils/command/ build_ext.py, line 13, in module from site import USER_BASE, USER_SITE ImportError: cannot import name USER_BASE It seems the error is related to the inability of Python2.7 to process from site import USER_BASE, USER_SITE, since the machine I succeeded to install numpy with Python2.7 doesn't prompt an error from this command, whereas this machine in which I failed to do so cannot handle this. My question is: How can I make Python2.7 to process this, since the manual says this package is the one that's automatically turned on in startup. Thanks, Justin. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On Fri, 27 Aug 2010 16:43:16 +0200 Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Dave Angel a écrit : def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? How about a one-liner? is_palindrome = lambda x: len(x) 0 and x == x.lower()[::-1] Note that the above assumes that single characters are palindromes but empty strings are not. I'm not 100% sure that that last is true. If not then this can be simplified. is_palindrome = lambda x: x == x.lower()[::-1] -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Queue cleanup
In article mailman.1967.1281549328.1673.python-l...@python.org, MRAB pyt...@mrabarnett.plus.com wrote: An object will be available for garbage collection when nothing refers to it either directly or indirectly. If it's unreferenced then it will go away. This isn't actually garbage collection as most people think of it. Refcounting semantics mean that objects get reaped as soon as nothing points at them. OTOH, CPython does also have garbage collection to back up refcounting so that when you have unreferenced object cycles they don't stay around. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ ...if I were on life-support, I'd rather have it run by a Gameboy than a Windows box. --Cliff Wells -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 27/08/2010 17:20, Mark Lawrence wrote: On 27/08/2010 15:43, Bruno Desthuilliers wrote: Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? It could be worse, try responding to issue 9702. :) As a wise man once said: Ay caramba! :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: numpy is not installed with Python2.
On 8/27/10 11:40 AM, justin wrote: My university has a cluster computer, on which I want to run my python program that uses numpy. I am installing my Python2.7 locally separated from the main system, and trying to install numpy, attach it with Python2.7. I used many different versions of numpys to make it happen, but I got stuck with the same following error on every trial, [...@login1 numpy]$ python2.7 setup.py install Running from numpy source directory.Traceback (most recent call last): File setup.py, line 210, inmodule setup_package() File setup.py, line 187, in setup_package from numpy.distutils.core import setup File /users/hp6/DOWN/numpy/numpy/distutils/core.py, line 25, in module from numpy.distutils.command import config, config_compiler, \ File /users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py, line 9, inmodule from distutils.command.build_ext import build_ext as old_build_ext File /users/hp6/apps/python27/lib/python2.7/distutils/command/ build_ext.py, line 13, inmodule from site import USER_BASE, USER_SITE ImportError: cannot import name USER_BASE It seems the error is related to the inability of Python2.7 to process from site import USER_BASE, USER_SITE, since the machine I succeeded to install numpy with Python2.7 doesn't prompt an error from this command, whereas this machine in which I failed to do so cannot handle this. Your Python installation appears to be broken. Find the site.py module that you are actually importing. I.e. from the numpy source directory: $ python2.7 -c import site; print site.__file__ This will tell you the site.pyc file that actually gets imported. Find the associated site.py file (it should be in the same directory) and check to see if it has USER_BASE defined. The filename should be /users/hp6/apps/python27/lib/python2.7/site.pyc If it isn't, that may be the source of your problem. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 27/08/2010 17:53, MRAB wrote: On 27/08/2010 17:20, Mark Lawrence wrote: On 27/08/2010 15:43, Bruno Desthuilliers wrote: Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? It could be worse, try responding to issue 9702. :) As a wise man once said: Ay caramba! :-) Isn't that a syntax error? Shouldn't it be ¡Ay caramba! :) Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 8/27/2010 4:53 AM, Baba wrote: level: beginner the following code looks ok to me but it doesn't work. I would like some hints as to where my reasoning / thought goes wrong def i_palindrome(pal): while len(pal)1: if pal[0] == pal[-1]: pal=pal[1:-1] return True print i_palindrome('annab') General practical debugging procedurewhen logic inspection fails: insert print statements at key points. In the case above, put print pal before the if statement and you should see the problem. And/or print 'equal' after the if. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 27/08/2010 18:28, Mark Lawrence wrote: On 27/08/2010 17:53, MRAB wrote: On 27/08/2010 17:20, Mark Lawrence wrote: On 27/08/2010 15:43, Bruno Desthuilliers wrote: Dave Angel a écrit : (snip) or (untested) def is_palindrom(s): s = s.lower() return s == s[::-1] Right, go on, make me feel a bit more stupid :-/ Who's next ? It could be worse, try responding to issue 9702. :) As a wise man once said: Ay caramba! :-) Isn't that a syntax error? Shouldn't it be ¡Ay caramba! :) I stand (OK, sit) corrected. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Ian writes: If you want to or must do it recursively. (Shown in pseudo code to make the logic clearer) def isPalindrome(pal) ''' test pal (a list) is a palindrome ''' if length of pal = 1 return True # all one letter strings are palindromes. if first equals last # pal could be a palindrome # so test inner part p = pal with first and last removed return isPalendrome(p) # and true - implied else return False # it can't be def palindromep(s): return ( s == or ( s[0] == s[-1] and palindromep(s[1:-1]) ) ) Of course, the simpler way is to use the definition of a Palindrome as the same backwards and forwards. def isPalindrome(pal) return pal == pal.reverse Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? -- http://mail.python.org/mailman/listinfo/python-list
Re: mailbox.mbox not locking mbox properly
Even if you replace the python mbox code with something that uses fcntl.flock() to protect against concurrent updating, you should also understand that NFS does *not* provide full Unix filesystem semantics. In particular, Unix flock(2) (which Python's fcntl.flock() wraps) doesn't work over NFS. That's why if you want to access mail over NFS, you should use maildir, rather than mbox, no matter what your programming language. -- Chris Jewell chr...@puffin.com PO Box 1396 Gualala CA USA 95445-1396 -- http://mail.python.org/mailman/listinfo/python-list
Re: numpy is not installed with Python2.
On Aug 27, 12:10 pm, Robert Kern robert.k...@gmail.com wrote: On 8/27/10 11:40 AM, justin wrote: My university has a cluster computer, on which I want to run my python program that uses numpy. I am installing my Python2.7 locally separated from the main system, and trying to install numpy, attach it with Python2.7. I used many different versions of numpys to make it happen, but I got stuck with the same following error on every trial, [...@login1 numpy]$ python2.7 setup.py install Running from numpy source directory.Traceback (most recent call last): File setup.py, line 210, inmodule setup_package() File setup.py, line 187, in setup_package from numpy.distutils.core import setup File /users/hp6/DOWN/numpy/numpy/distutils/core.py, line 25, in module from numpy.distutils.command import config, config_compiler, \ File /users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py, line 9, inmodule from distutils.command.build_ext import build_ext as old_build_ext File /users/hp6/apps/python27/lib/python2.7/distutils/command/ build_ext.py, line 13, inmodule from site import USER_BASE, USER_SITE ImportError: cannot import name USER_BASE It seems the error is related to the inability of Python2.7 to process from site import USER_BASE, USER_SITE, since the machine I succeeded to install numpy with Python2.7 doesn't prompt an error from this command, whereas this machine in which I failed to do so cannot handle this. Your Python installation appears to be broken. Find the site.py module that you are actually importing. I.e. from the numpy source directory: $ python2.7 -c import site; print site.__file__ This will tell you the site.pyc file that actually gets imported. Find the associated site.py file (it should be in the same directory) and check to see if it has USER_BASE defined. The filename should be /users/hp6/apps/python27/lib/python2.7/site.pyc If it isn't, that may be the source of your problem. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco Dear Kern, Thanks a lot. Your quick and detailed comment saves me a lot of time and effort now. It seems the file path links are out of order as you diagnosed. Like you said, there is a site.py on /users/hp6/apps/python27/lib/ python2.7/. But when I typed in $ python2.7 -c import site; print site.__file__, it refers to another place: /opt/apps/gurobi/3.0.0/linux64/lib/python2.5/site.pyc, and it doesn't have USER_BASE! So I changed the value of PYTHONPATH accordingly. Thanks again, Justin. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Jussi Piitulainen wrote: Ian writes: If you want to or must do it recursively. (Shown in pseudo code to make the logic clearer) def isPalindrome(pal) ''' test pal (a list) is a palindrome ''' if length of pal = 1 return True # all one letter strings are palindromes. if first equals last # pal could be a palindrome # so test inner part p = pal with first and last removed return isPalendrome(p) # and true - implied else return False # it can't be def palindromep(s): return ( s == or ( s[0] == s[-1] and palindromep(s[1:-1]) ) ) Of course, the simpler way is to use the definition of a Palindrome as the same backwards and forwards. def isPalindrome(pal) return pal == pal.reverse Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? There can't be a .reverse() method on string, because it's immutable. You could use .join(reversed(pal)) but I'd prefer pal[::-1] as I said earlier. DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: numpy is not installed with Python2.
On 8/27/10 1:38 PM, justin wrote: On Aug 27, 12:10 pm, Robert Kernrobert.k...@gmail.com wrote: On 8/27/10 11:40 AM, justin wrote: My university has a cluster computer, on which I want to run my python program that uses numpy. I am installing my Python2.7 locally separated from the main system, and trying to install numpy, attach it with Python2.7. I used many different versions of numpys to make it happen, but I got stuck with the same following error on every trial, [...@login1 numpy]$ python2.7 setup.py install Running from numpy source directory.Traceback (most recent call last): File setup.py, line 210, inmodule setup_package() File setup.py, line 187, in setup_package from numpy.distutils.core import setup File /users/hp6/DOWN/numpy/numpy/distutils/core.py, line 25, in module from numpy.distutils.command import config, config_compiler, \ File /users/hp6/DOWN/numpy/numpy/distutils/command/build_ext.py, line 9, inmodule from distutils.command.build_ext import build_ext as old_build_ext File /users/hp6/apps/python27/lib/python2.7/distutils/command/ build_ext.py, line 13, inmodule from site import USER_BASE, USER_SITE ImportError: cannot import name USER_BASE It seems the error is related to the inability of Python2.7 to process from site import USER_BASE, USER_SITE, since the machine I succeeded to install numpy with Python2.7 doesn't prompt an error from this command, whereas this machine in which I failed to do so cannot handle this. Your Python installation appears to be broken. Find the site.py module that you are actually importing. I.e. from the numpy source directory: $ python2.7 -c import site; print site.__file__ This will tell you the site.pyc file that actually gets imported. Find the associated site.py file (it should be in the same directory) and check to see if it has USER_BASE defined. The filename should be /users/hp6/apps/python27/lib/python2.7/site.pyc If it isn't, that may be the source of your problem. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco Dear Kern, Thanks a lot. Your quick and detailed comment saves me a lot of time and effort now. It seems the file path links are out of order as you diagnosed. Like you said, there is a site.py on /users/hp6/apps/python27/lib/ python2.7/. But when I typed in $ python2.7 -c import site; print site.__file__, it refers to another place: /opt/apps/gurobi/3.0.0/linux64/lib/python2.5/site.pyc, and it doesn't have USER_BASE! So I changed the value of PYTHONPATH accordingly. You should not set PYTHONPATH to those directories ever. The correct one will already be on the sys.path. In a multiple-Python environment, you simply shouldn't use PYTHONPATH at all since all of the interpreters will try to use it. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On Fri, 27 Aug 2010 12:02:39 -0400 D'Arcy J.M. Cain da...@druid.net wrote: On Fri, 27 Aug 2010 11:49:42 -0400 D'Arcy J.M. Cain da...@druid.net wrote: is_palindrome = lambda x: x == x.lower()[::-1] Oops. Simple and wrong. is_palindrome = lambda x: x.lower() == x.lower()[::-1] slightly more efficient I think. is_palindrome = lambda y: (lambda x: x == x[::-1])(y.lower()) -- D'Arcy J.M. Cain da...@druid.net | Democracy is three wolves http://www.druid.net/darcy/| and a sheep voting on +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
Dave Angel writes: Jussi Piitulainen wrote: Ian writes: Of course, the simpler way is to use the definition of a Palindrome as the same backwards and forwards. def isPalindrome(pal) return pal == pal.reverse Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? There can't be a .reverse() method on string, because it's immutable. You could use .join(reversed(pal)) but I'd prefer pal[::-1] as I said earlier. There could easily be a .reverse() method on strings. It would return the reversed string, like .swapcase() returns the swapcased string. -- http://mail.python.org/mailman/listinfo/python-list
Re: Queue cleanup
On 8/11/2010 1:26 PM, EW wrote: On Aug 11, 2:52 pm, Paul Rubinno.em...@nospam.invalid wrote: EWericwoodwo...@gmail.com writes: Well I cared because I thought garbage collection would only happen when the script ended - the entire script. Since I plan on running this as a service it'll run for months at a time without ending. So I thought I was going to have heaps of Queues hanging out in memory, unreferenced and unloved. It seemed like bad practice so I wanted to get out ahead of it. Even if GC worked that way it wouldn't matter, if you use just one queue per type of task. That number should be a small constant so the memory consumption is small. Well I can't really explain it but 1 Queue per task for what I'm designing just doesn't feel right to me. It feels like it will lack future flexibility. I like having 1 Queue per producer thread object and the person instantiating that object can do whatever he wants with that Queue. I can't prove I'll need that level of flexibility but I don't see why it' bad to have. It's still a small number of Queues, it's just a small, variable, number of Queues. That's backwards. Usually, you want one queue per unique consumer. That is, if you have a queue that contains one kind of request, there's one thread reading the queue, blocked until some other thread puts something on the queue. No polling is needed. One consumer reading multiple queues is difficult to implement well. Note, by the way, that CPython isn't really concurrent. Only one thread runs at a time, due to an archaic implementation. So if your threads are compute-bound, even on a multicore CPU threading will not help. There's a multiprocessing module which allows spreading work over several processes instead of threads. That can be helpful as a workaround. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 27/08/2010 20:43, Jussi Piitulainen wrote: Dave Angel writes: Jussi Piitulainen wrote: Ian writes: Of course, the simpler way is to use the definition of a Palindrome as the same backwards and forwards. def isPalindrome(pal) return pal == pal.reverse Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? There can't be a .reverse() method on string, because it's immutable. You could use .join(reversed(pal)) but I'd prefer pal[::-1] as I said earlier. There could easily be a .reverse() method on strings. It would return the reversed string, like .swapcase() returns the swapcased string. Lists have a .reverse method, but it's an in-place reversal. In order to reduce confusion, a string method which returned the string reversed would be better called .reversed(). -- http://mail.python.org/mailman/listinfo/python-list
Re: mailbox.mbox not locking mbox properly
On 8/10/2010 2:25 AM, Chris Rebert wrote: On Tue, Aug 10, 2010 at 2:01 AM,tinn...@isbd.co.uk wrote: Tim Robertst...@probo.com wrote: tinn...@isbd.co.uk wrote: I'm using the python mailbox class in a script that processes incoming mail and delivers it to various mbox format mailboxes. It appears that, although I am calling the lock method on the destination before writing to the mbox and calling unlock afterwards the locking isn't working correctly. ... So it seems that python's mailbox class locking isn't playing nicely with mutt's mailbox locking whereas postfix's locking does work correctly. Correct. The dest.flush() method creates a temporary file, copies the entire modified mailbox into it, removed the original file, and renames the temp file into place. Yes, I just took a look at the mailbox.py code and it does exactly that which of course screws up just about any normal MUA looking at the mbox. Grr! The Postfix MDA, like most MDAs, just opens the existing file and appends the new data to it. Has anyone seen this problem before, and/or do I need to anything more than the following for the locking to work correctly:- It's not the locking. It's the flush mechanism. The mbox class doesn't know that the ONLY thing you did was an append. You might have modified other messages in the middle. If you want to do an append, you'll need to write your own subclass of mbox. OK, thanks. In reality I can probably just use straightforward file reading and writing as the *only* thing I will ever be doing is to append a message to a mailbox file. I think there should be a big warning in the mailbox documentation to this effect as doing it the way that Python's mailbox class does it will break all sorts of things. There should maybe be a specific 'append' method. File a documentation and/or library bug: http://bugs.python.org/ Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
MRAB writes: On 27/08/2010 20:43, Jussi Piitulainen wrote: Dave Angel writes: Jussi Piitulainen wrote: Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? There can't be a .reverse() method on string, because it's immutable. You could use .join(reversed(pal)) but I'd prefer pal[::-1] as I said earlier. There could easily be a .reverse() method on strings. It would return the reversed string, like .swapcase() returns the swapcased string. Lists have a .reverse method, but it's an in-place reversal. In order to reduce confusion, a string method which returned the string reversed would be better called .reversed(). Yes, agreed. Meanwhile, I have decided to prefer this: def palindromep(s): def reversed(s): return s[::-1] return s == reversed(s) -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On 8/27/2010 3:43 PM, Jussi Piitulainen wrote: Dave Angel writes: There could easily be a .reverse() method on strings. It would return the reversed string, like .swapcase() returns the swapcased string. Could be, but the main use case seems to be for palindrome testing ;-) Given that slicing and reversed() can do the same thing, the need is thin. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On Fri, Aug 27, 2010 at 10:51 PM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: MRAB writes: On 27/08/2010 20:43, Jussi Piitulainen wrote: Dave Angel writes: Jussi Piitulainen wrote: Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? There can't be a .reverse() method on string, because it's immutable. You could use .join(reversed(pal)) but I'd prefer pal[::-1] as I said earlier. There could easily be a .reverse() method on strings. It would return the reversed string, like .swapcase() returns the swapcased string. Lists have a .reverse method, but it's an in-place reversal. In order to reduce confusion, a string method which returned the string reversed would be better called .reversed(). Yes, agreed. Meanwhile, I have decided to prefer this: def palindromep(s): def reversed(s): return s[::-1] return s == reversed(s) -- http://mail.python.org/mailman/listinfo/python-list That seems like a bit of overkill... Why would you want to define a function in a function for something trivial like this? Just def palindrome(s): return s[::-1] will do fine. Of course, you can stick the inner function in a library somewhere if you like. Regards, Richard -- http://mail.python.org/mailman/listinfo/python-list
Re: palindrome iteration
On Fri, Aug 27, 2010 at 11:47 PM, Richard Arts arts.rich...@gmail.com wrote: On Fri, Aug 27, 2010 at 10:51 PM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: MRAB writes: On 27/08/2010 20:43, Jussi Piitulainen wrote: Dave Angel writes: Jussi Piitulainen wrote: Agreed. But is there any nicer way to spell .reverse than [::-1] in Python? There is .swapcase() but no .reverse(), right? There can't be a .reverse() method on string, because it's immutable. You could use .join(reversed(pal)) but I'd prefer pal[::-1] as I said earlier. There could easily be a .reverse() method on strings. It would return the reversed string, like .swapcase() returns the swapcased string. Lists have a .reverse method, but it's an in-place reversal. In order to reduce confusion, a string method which returned the string reversed would be better called .reversed(). Yes, agreed. Meanwhile, I have decided to prefer this: def palindromep(s): def reversed(s): return s[::-1] return s == reversed(s) -- http://mail.python.org/mailman/listinfo/python-list That seems like a bit of overkill... Why would you want to define a function in a function for something trivial like this? Just def palindrome(s): return s[::-1] will do fine. Of course, you can stick the inner function in a library somewhere if you like. Regards, Richard Duh, of course I mean def palindrome(s): return s == s[::-1] I'm sorry. Richard -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
In message mailman.64.1282843346.29448.python-l...@python.org, Navkirat Singh wrote: I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. I wanted to know how i could write the file (now a string) as a jpeg image on disk. I assume the JPEG data is received along with other field values in the POST. You’ll be saving those other fields in a database, right? So why not save the JPEG image there as well? -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
In message mailman.71.1282852048.29448.python-l...@python.org, Navkirat Singh wrote: The image bytes are a part of a HTTP header content ( not the message body ). In which case, won’t they be in some encoding like Base-64? I don’t think you’re allowed arbitrary binary bytes in an HTTP header. -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading the access attributes of directories in Windows
In message mailman.99.1282894128.29448.python-l...@python.org, Rami Chowdhury wrote: On Wed, Aug 25, 2010 at 05:04, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message pan.2010.08.22.04.26.33.547...@nowhere.com, Nobody wrote: Having this as a separate permission allows normal users to add entries to log files but not to erase existing entries. Unix/Linux systems can do this already. Ooh, I didn't know that -- what combination of permissions would I have to use to get such an effect? No special permissions needed at all—just use the syslog(3) functions. And the nice thing is, you don’t have to know whether the system logs are kept on the local machine or on a remote machine, or how different categories of messages are divided up into different files, how log rotation is done, or anything like that—it’s all transparent. -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing byte stream as jpeg format to disk
On 8/27/10 5:58 PM, Lawrence D'Oliveiro wrote: In message mailman.64.1282843346.29448.python-l...@python.org, Navkirat Singh wrote: I receive a jpeg file with the POST method.The file (.jpeg) is encoded in bytes, I parse the bytes by decoding them to a string. I wanted to know how i could write the file (now a string) as a jpeg image on disk. I assume the JPEG data is received along with other field values in the POST. You’ll be saving those other fields in a database, right? So why not save the JPEG image there as well? No, the only thing in the body of the POST are the bytes of the JPEG. He was incorrect in thinking that the JPEG data was arriving in the header. See the later posts in the thread for complete answers to his problem. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
ANN: ActivePython 2.6.6.15 is now available
ActiveState is pleased to announce ActivePython 2.6.6.15, a complete, ready-to-install binary distribution of Python 2.6.6. http://www.activestate.com/activepython What's New in ActivePython-2.6.6.15 === *Release date: 25-Aug-2010* New Features Upgrades --- - Upgrade to Python 2.6.6 (`release notes http://www.python.org/download/releases/2.6.6/NEWS.txt`__) - Security upgrade to openssl-0.9.8o - [MacOSX] 64-bit support (PPC and 10.4 are no longer supported) - Upgrade to PyPM 1.1.1; noteworthy changes: - Custom config file support w/ new repository settings (-R free,be instead of -L) - Support for installing a local package, eg: ``pypm install /path/to/foo.pypm`` - Bug #87687: Prevent partial downloading of repo index cache - Upgraded the following packages: - Distribute-0.6.14 - pip-0.8 - SQLAlchemy-0.6.3 Noteworthy Changes Bug Fixes -- - [MacOSX] Fix Help index on Snow Leopard (10.6) - Bug #87290 - [Windows] Add file extension to Tools\scripts\2to3.py - Bug #87465 What's New in ActivePython-2.6.5.14 === *Release date: 07-Jul-2010* New Features Upgrades --- - Upgrade to PyPM 1.0.2 - 'pypm search' now also shows if a package is installed and upgradeable - 'pypm info' now prints a concise representation by default - 'pypm list --short' will show only packages names; for scripting purposes - Respect distutils install schemes (purelib, scripts) Noteworthy Changes Bug Fixes -- - [MacOSX] Fix /usr/local/bin symlinks to not use the 'Current' symlink - [MacOSX] Fix uninstall on Snow Leopard (10.6) - [Windows] Include IDLE in the Start Menu shortcut, instead of PythonWin See the release notes for full details: http://docs.activestate.com/activepython/2.6/relnotes.html#changes What is ActivePython? = ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython 2.6 and 2.7 also include a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\pypm install mysql-python [...] C:\python import MySQLdb See this page for full details: http://docs.activestate.com/activepython/2.6/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the What's New in Python series, Dive into Python, the Python FAQs HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/2.6/ We would welcome any and all feedback to: activepython-feedb...@activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms === ActivePython is available for the following platforms: - Windows/x86 (32-bit) - Windows/x64 (64-bit) (aka AMD64) - Mac OS X - Linux/x86 (32-bit) - Linux/x86_64 (64-bit) (aka AMD64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit)(Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit)(Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar sridharr at activestate.com -- http://mail.python.org/mailman/listinfo/python-list
ANN: ActivePython 2.7.0.2 is now available
ActiveState is pleased to announce ActivePython 2.7.0.2, a complete, ready-to-install binary distribution of Python 2.7. http://www.activestate.com/activepython What's New in ActivePython-2.7.0.2 == *Release date: 25-Aug-2010* New Features Upgrades --- - Security upgrade to openssl-0.9.8o - Upgrade to PyPM 1.1.1; noteworthy changes: - Custom config file support w/ new repository settings (-R free,be instead of -L) - Support for installing a local package, eg: ``pypm install /path/to/foo.pypm`` - Bug #87687: Prevent partial downloading of repo index cache - Upgraded the following packages: - Distribute-0.6.14 - pip-0.8 - SQLAlchemy-0.6.3 Noteworthy Changes Bug Fixes -- - [MacOSX] Fix Help index on Snow Leopard (10.6) - Bug #87290 - [Windows] Add file extension to Tools\scripts\2to3.py - Bug #87465 What is ActivePython? = ActivePython is ActiveState's binary distribution of Python. Builds for Windows, Mac OS X, Linux are made freely available. Solaris, HP-UX and AIX builds, and access to older versions are available in ActivePython Business, Enterprise and OEM editions: http://www.activestate.com/python ActivePython includes the Python core and the many core extensions: zlib and bzip2 for data compression, the Berkeley DB (bsddb) and SQLite (sqlite3) database libraries, OpenSSL bindings for HTTPS support, the Tix GUI widgets for Tkinter, ElementTree for XML processing, ctypes (on supported platforms) for low-level library access, and others. The Windows distribution ships with PyWin32 -- a suite of Windows tools developed by Mark Hammond, including bindings to the Win32 API and Windows COM. ActivePython 2.6 and 2.7 also include a binary package manager for Python (PyPM) that can be used to install packages much easily. For example: C:\pypm install mysql-python [...] C:\python import MySQLdb See this page for full details: http://docs.activestate.com/activepython/2.7/whatsincluded.html As well, ActivePython ships with a wealth of documentation for both new and experienced Python programmers. In addition to the core Python docs, ActivePython includes the What's New in Python series, Dive into Python, the Python FAQs HOWTOs, and the Python Enhancement Proposals (PEPs). An online version of the docs can be found here: http://docs.activestate.com/activepython/2.7/ We would welcome any and all feedback to: activepython-feedb...@activestate.com Please file bugs against ActivePython at: http://bugs.activestate.com/enter_bug.cgi?product=ActivePython Supported Platforms === ActivePython is available for the following platforms: - Windows/x86 (32-bit) - Windows/x64 (64-bit) (aka AMD64) - Mac OS X - Linux/x86 (32-bit) - Linux/x86_64 (64-bit) (aka AMD64) - Solaris/SPARC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) - Solaris/x86 (32-bit)(Business, Enterprise or OEM edition only) - HP-UX/PA-RISC (32-bit)(Business, Enterprise or OEM edition only) - HP-UX/IA-64 (32-bit and 64-bit) (Enterprise or OEM edition only) - AIX/PowerPC (32-bit and 64-bit) (Business, Enterprise or OEM edition only) More information about the Business Edition can be found here: http://www.activestate.com/business-edition Custom builds are available in the Enterprise Edition: http://www.activestate.com/enterprise-edition Thanks, and enjoy! The Python Team -- Sridhar Ratnakumar sridharr at activestate.com -- http://mail.python.org/mailman/listinfo/python-list
Re: ftplib limitations?
In message 4c74e604.6090...@sschwarzer.net, Stefan Schwarzer wrote: Now it may be that the data connection, after having started the transfer, works as it should, but the control connection times out because the duration of the transfer is too long. It might not be the fault of the FTP server. If you’re going through a router doing NAT, that could be where the timeout is happening. -- http://mail.python.org/mailman/listinfo/python-list
How to convert (unicode) text to image?
Hi! Does anyone know of an easy way to convert a Unicode string into an image file (either jpg or png)? TIA! ~k -- http://mail.python.org/mailman/listinfo/python-list
Re: Overload print
On Aug 25, 5:18 pm, Ross Williamson rosswilliamson@gmail.com wrote: Hi All Is there anyway in a class to overload the print function? class foo_class(): pass cc = foo_class() print cc Gives: __main__.foo_class instance at Can I do something like: class foo_class(): def __print__(self): print hello cc = foo_class() print cc Gives: hello I'm looking at finding nice way to print variables in a class just by asking to print it Cheers Ross -- Ross Williamson University of Chicago Department of Astronomy Astrophysics 773-834-9785 (office) 312-504-3051 (Cell) Are you talking about overriding print(), kind of like overloading the operator in c++ so that you can determine how the foo_class gets printed? -- http://mail.python.org/mailman/listinfo/python-list
Re: Queue cleanup
On Fri, 27 Aug 2010 09:16:52 -0700, Aahz wrote: In article mailman.1967.1281549328.1673.python-l...@python.org, MRAB pyt...@mrabarnett.plus.com wrote: An object will be available for garbage collection when nothing refers to it either directly or indirectly. If it's unreferenced then it will go away. This isn't actually garbage collection as most people think of it. Refcounting semantics mean that objects get reaped as soon as nothing points at them. OTOH, CPython does also have garbage collection to back up refcounting so that when you have unreferenced object cycles they don't stay around. I've repeatedly asked, both here and elsewhere, why reference counting isn't real garbage collection. Nobody has been able to give me a satisfactory answer. As far as I can tell, it's a bit of pretentiousness with no basis in objective fact. http://en.wikipedia.org/wiki/Garbage_collection_(computer_science) http://en.wikipedia.org/wiki/Reference_counting Reference counting is one specific kind of garbage collection, and like all gc strategies, it has strengths as well as weaknesses. It is *simple* to implement (which may be why a certain class of programmer likes to think it isn't real gc). When it runs is deterministic, and is immediate upon the resource being freed. The overhead is very light (a plus) and continuous (which can be both a plus and a minus). It is better suited to managing scarce resources like open files than are tracing garbage collectors. It avoids the embarrassing pause of tracing collectors. It doesn't deal well with reference cycles, and (at least with Python's implementation of ref counting) it causes performance issues with threaded applications. http://en.wikipedia.org/wiki/Garbage_collection_(computer_science) http://en.wikipedia.org/wiki/Reference_counting So CPython has two garbage collectors -- a reference counting implementation, and a tracing implementation. Jython and IronPython use the native garbage collectors from Java and .Net. Other Pythons may use something else. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: How to convert (unicode) text to image?
On Fri, Aug 27, 2010 at 8:01 PM, kj no.em...@please.post wrote: Hi! Does anyone know of an easy way to convert a Unicode string into an image file (either jpg or png)? Do you mean you have some text and you want an image containing that text? PIL's ImageDraw module can do that. -- http://mail.python.org/mailman/listinfo/python-list
Re: Queue cleanup
Steven D'Aprano st...@remove-this-cybersource.com.au writes: I've repeatedly asked, both here and elsewhere, why reference counting isn't real garbage collection. Nobody has been able to give me a satisfactory answer. As far as I can tell, it's a bit of pretentiousness with no basis in objective fact. Well, it's a bit of a subjective matter. I'd say it's not real gc because 1) it's unsound (misses reference cycles), and 2) it requires constant attention from the mutator to incr and decr the reference counts. So developing modules for the CPython API means endlessly finding and fixing refcount bugs that lead to either crashes/security failures, or memory leaks. If you program the Java JNI or a typical Lisp FFI, you'll find that real gc is a lot simpler to use since you avoid all the refcount maintenance hassles. You allocate memory and shut your eyes, and the gc takes care of freeing it when it figures out that you are done. Refcounting is basically a form of manual memory management, while gc is automatic. Someone said here recently that as a program gets larger, saying this will work as long as we do X every time without fail becomes equal to saying this won't work. Substitute properly maintain all ref counts for X and you can see the problem. I've seen released production tested Python C modules with subtle refcount bugs on more than one occasion. In gc'd systems there are fewer places for the code to go wrong. -- http://mail.python.org/mailman/listinfo/python-list
comp.lang.python
www.127760.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
love me
1st step like me on facbook at this link http://www.facebook.com/pages/loveme/145529285481739 2nd step visit this link http://www.kqzyfj.com/click-3778203-10786395 -- http://mail.python.org/mailman/listinfo/python-list
Walking deeply nested lists
This is all about walking trees, recursion and generators. None of which fit my brain at all! From an XML tree (an SVG file) I build a bunch of Tag objects. [I use lxml, but I am combining multiple svg files into a 'forest' of trees, so I can't use the lxml walking methods because they all stop at the 'end' of a branch where there is actually a 'link' over to another tree.] Each Tag has a flatwalk() method. The return from that is a list which can be deeply nested. As an example, something like this: L=[1, [2, 3, [4, [5, 6], 7], 8], [9, 10] ] (The numbers in the example would actually be Tag Instances.) Aim 1 --- I'm trying to write a generator around such lists so that I can 'walk' them: for parent, child in mystery_generator(L): print level, item Right now, I am running a 'flatten' function on the entire list (which I don't savvy, I found it online) and then I iterate over that flattened list. This doesn't feel right to me. (Code at end.) Aim 2 --- The Objects that represent the svg tags use that flatwalk() method to build the nested list, I'd far prefer flatwalk() to be directly useable in something like this way: for container, child in some_tag.flatwalk(): print container, child The flatwalk() function is (and this is another puzzle see *) kind of recursive. For each of my children, tell that child to go flatwalk(). (Code at end.) I am not sure how to turn such a thing into a generator. I keep wondering how os.walk() does its thing. My hierarchy of Tag objects can be thought of as directories (tags:g, symbol, svg), files (path, circle, etc.) and soft-links (use tags). * If an Instance calls a method on *another* Instance of the *same* class, is this still recursion? And how does this 'stack up'? I mean, literally, on the stack. Does each instance get its own stack, or does all the push, call, pop stuff happen in one main stack? (I worry about recursion depth limits because svg trees can get quite deep.) The walking code so far: ## Found code. def flatten(input): output = [] stack = [] stack.extend(reversed(input)) while stack: top = stack.pop() if isinstance(top, list): stack.extend(reversed(top)) else: output.append(top) return output ## My walker def test_walk(e): #lxml Element comes in obj = ebag_get(e)['obj'] #get a tag object l=obj.flatwalk() ll= flatten(l) #No current solution to get 'parent' in this iterator #ie. for parent, child in ... for tag in ll: print tag Here's one of my Tag objects: class Brancher(object): def __init__(self, elem): self.elem = elem self.children = [] def flatwalk(self): l=[self] for child in self.children: l.append( child.flatwalk() ) #recur(ish)ion here return l class G( Brancher ): #Object for g tags. pass \d -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading the access attributes of directories in Windows
In message mailman.2396.1282396255.1673.python-l...@python.org, Tim Golden wrote: Can you run Python from within a Run-As-Administrator command prompt? Kind of worrying, isn’t it, when the answer to “my program won’t work” is “give it more privileges”? Defeats the point of having such a complex security system, doesn’t it, when people are no longer able to understand its ramifications, and have to resort to bypassing it to get work done? -- http://mail.python.org/mailman/listinfo/python-list
[issue9697] python 2.3.4 installation error on 64 bit env
Martin v. Löwis mar...@v.loewis.de added the comment: Python 2.7 and Python 3.1 are supported for bug fixes. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9697 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8296] multiprocessing.Pool hangs when issuing KeyboardInterrupt
Changes by Greg Brockman g...@mit.edu: -- nosy: +gdb ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8296 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9698] When reusing an handler, urllib(2)'s digest authentication fails after multiple regative replies
New submission from Luci Stanescu luci.stane...@gmail.com: Hi, The HTTPDigestAuthHandler's code looks like this: def http_error_401(self, req, fp, code, msg, headers): host = urlparse(req.full_url)[1] retry = self.http_error_auth_reqed('www-authenticate', host, req, headers) self.reset_retry_count() return retry After successful authentication, the HTTP server might still return an error code, such as 404 or 304. In that case, self.http_error_auth_reqed raises the appropriate HTTPError and self.reset_retry_count is not called. I think that the code should be something along the lines of: try: retry = self.http_error_auth_reqed('www-authenticate', host, req, headers) except HTTPError, e: if e.code != 401: self.reset_retry_counter() raise else: self.reset_retry_counter() return retry Ways to reproduce the problem: try to access a resource for which an HTTP server requires authentication but for which after successful authentication returns a negative reply. I've attached an example script to demonstrate it (for python 2.X; bug also resent in 3.X, just replace import urllib2 with from urllib import request as urllib2 ;-) ). The same problem applies to ProxyDigestAuthHandler. -- components: Library (Lib) files: test_urllib2.py messages: 115054 nosy: Luci.Stanescu priority: normal severity: normal status: open title: When reusing an handler, urllib(2)'s digest authentication fails after multiple regative replies type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file18656/test_urllib2.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9698 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9690] Cannot distinguish bstr from str in ast module.
Kay Hayen kayha...@gmx.de added the comment: This is to inform you that I worked around the bug by reading the source file in question and checking the indicated position. This is currently the only way to decide if a literal should be unicode or str with unicode_literals from future imported. It goes like this: kind = _sources[ filename ][ node.lineno - 1][ node.col_offset ] if kind != 'b': value = unicode( node.s ) else: value = node.s I don't see how removing the ambgious representation of what I presume is a wanted language construct can be considered a new feature. But that is your decision to make. Best regards, Kay Hayen -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9690 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9119] Python download page needs to mention crypto code in Windows installer
Marc-Andre Lemburg m...@egenix.com added the comment: Martin v. Löwis wrote: Martin v. Löwis mar...@v.loewis.de added the comment: Which specific clause of the license do you consider violated? * 3. All advertising materials mentioning features or use of this *software must display the following acknowledgment: *This product includes software developed by the OpenSSL Project *for use in the OpenSSL Toolkit. (http://www.openssl.org/) * 3. All advertising materials mentioning features or use of this software *must display the following acknowledgement: *This product includes cryptographic software written by * Eric Young (e...@cryptsoft.com) *The word 'cryptographic' can be left out if the rouines from the library *being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from *the apps directory (application code) you must include an acknowledgement: *This product includes software written by Tim Hudson (t...@cryptsoft.com) -- title: Python download page needs to mention crypto code in Windows installer - Python download page needs to mention crypto code in Windows installer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9119] Python download page needs to mention crypto code in Windows installer
Marc-Andre Lemburg m...@egenix.com added the comment: I'd suggest to add a paragraph like this to the release pages: The Python Windows installers include OpenSSL, which provides cryptographic services to Python. Please note that downloading or using cryptographic code may not be legal in your country of residence. It is your responsibility to make sure you meet all local import and use requirements for cryptographic code when downloading and using the Python Windows installers. OpenSSL Notice: This product includes cryptographic software written by Eric Young (e...@cryptsoft.com). This product includes software written by Tim Hudson (t...@cryptsoft.com). This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) -- title: Python download page needs to mention crypto code in Windows installer - Python download page needs to mention crypto code in Windows installer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9694] argparse: Default Help Message Lists Required Args As Optional
Steven Bethard steven.beth...@gmail.com added the comment: I guess one possibility might be flag arguments. It's not great, but I guess it's more accurate. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9694] argparse: Default Help Message Lists Required Args As Optional
Steven Bethard steven.beth...@gmail.com added the comment: And I guess the bigger issue to think about is how to add this in a backwards compatible way. I guess we could just add methods like set_positionals_group_name(name) and then fiddle with self._positionals.title in there. Not sure that's a great solution though - it seems like adding one method to change just this single attribute is overkill and not very general. In the meantime, here's a workaround: parser = argparse.ArgumentParser(prog='PROG') parser.add_argument('--foo', required=True) parser._optionals.title = flag arguments parser.print_help() usage: PROG [-h] --foo FOO flag arguments: -h, --help show this help message and exit --foo FOO I can't promise this will continue to work, since it uses the undocumented _optionals attribute, but at least it's a way of getting something like what you want now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp
Mads Kiilerich m...@kiilerich.com added the comment: On 08/27/2010 03:47 AM, Senthil Kumaran wrote: I agree with you respect to the other error codes, there is already another bug open to handle this. The reset counter is reset on success too, in another part of the code. FWIW: From Mercurial it is our experience that the reset counter only gets reset on errors, never on success. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8797 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9695] Return from generators in Python 3.2
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Why is a run-time exception better than a SyntaxError in this case? And your patch now allows: x = None return x What's the rationale of this change? -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9699] invalid call of Windows API _popen() generating The input line is too long error message
New submission from sorin sorin.sbar...@gmail.com: Behavior: you get The input line is too long. error message when you try to run an external process by using os.system(), subprocess.Popen() or other similar methods. The real command line limit is 8192 under Windows and in most cases (if not all) the cause for getting this message is not the length. The real cause is that if you even have a quote inside your command line you need to include the entire command in quote. Here are some details: http://stackoverflow.com/questions/682799/what-to-do-with-the-input-line-is-too-long-error-message/3583282#3583282 http://msdn.microsoft.com/en-us/library/96ayss4b.aspx (see comment) Even if this is caused by a bug on Windows that is present for more than ten years I think Python needs to workaround it by adding the quotes when they are needed. This will prevent other developers from writing OS specific code in their Python programs in order to workaround this bug. -- components: Windows messages: 115062 nosy: sorin priority: normal severity: normal status: open title: invalid call of Windows API _popen() generating The input line is too long error message type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9699 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8695] Issue while installing Python 2.6.5 in IBM AIX 6.1
Sébastien Sablé sa...@users.sourceforge.net added the comment: I used to have the same problem with Python 2.6.5 and AIX 6.1. Since I updated to Python 2.6.6, the problem does not appear anymore. So I think it has been corrected between 2.6.5 and 2.6.6. regards -- nosy: +sable ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8695] Issue while installing Python 2.6.5 in IBM AIX 6.1
Sébastien Sablé sa...@users.sourceforge.net added the comment: Actually, I had the problem with Python 2.6.4 on AIX 6.1, I did not try Python 2.6.5. But Python 2.6.6 compiles fine on AIX 6.1. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8695 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly
Ask Solem a...@opera.com added the comment: Does the problem make sense/do you have any ideas for an alternate solution? Well, I still haven't given up on the trackjobs patch. I changed it to use a single queue for both the acks and the result (see new patch attached: multiprocessing-tr...@82502-termination-trackjobs2.patch) Been running it in production for a few days now, and it seems to work. But the tests still hangs from time to time, it seems they hang more frequent now than in the first patch (this may actually be a good thing:) Would you like to try and identify the cause of this hang? Still haven't been able to. I'm not sure about the overhead of using one queue per process either, but I'm usually running about 8 processes per CPU core for IO bound jobs (adding more processes after that usually doesn't affect performance in positive ways). There's also the overhead of the synchronization (ACK). Not sure if this is important performance-wise, but at least this makes it harder for me to reason about the problem. -- Added file: http://bugs.python.org/file18657/multiprocessing-tr...@82502-termination-trackjobs2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9205 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9119] Python download page needs to mention crypto code in Windows installer
Martin v. Löwis mar...@v.loewis.de added the comment: Which specific clause of the license do you consider violated? * 3. All advertising materials mentioning features or use of this *software must display the following acknowledgment: *This product includes software developed by the OpenSSL Project *for use in the OpenSSL Toolkit. (http://www.openssl.org/) I fail to see the violation, or how changing the download page could fix that. The download page is *not* advertising material mentioning features or use of this software. In fact, the download page doesn't refer to SSL at all. Hence there is no obligation to mention OpenSSL on the download page. * 3. All advertising materials mentioning features or use of this software *must display the following acknowledgement: *This product includes cryptographic software written by * Eric Young (e...@cryptsoft.com) Likewise. * 4. If you include any Windows specific code (or a derivative thereof) from *the apps directory (application code) you must include an acknowledgement: *This product includes software written by Tim Hudson (t...@cryptsoft.com) This doesn't apply: we don't include any code (Windows specific or not) from the apps directory. -- title: Python download page needs to mention crypto code in Windows installer - Python download page needs to mention crypto code in Windows installer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9119] Python download page needs to mention crypto code in Windows installer
Martin v. Löwis mar...@v.loewis.de added the comment: I'd suggest to add a paragraph like this to the release pages: -1, unless the PSF lawyer advises that such a paragraph is indeed necessary. It may shy away users from using Python, which is clearly undesirable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9700] semaphore errors on AIX 6.1
New submission from Sébastien Sablé sa...@users.sourceforge.net: Hi, The same problem that was reported in issue 1106262 is appearing again on AIX 6.1 (the following error messages appear sometime when runnning python: sem_trywait: Permission denied sem_post: Permission denied sem_destroy: Permission denied) It can be easily corrected by defining HAVE_BROKEN_POSIX_SEMAPHORES for AIX 6, like it is done for AIX 5. I attach a patch that does that (I made the patch on Python 2.6.6 but it should apply to Python 2.7 and 3.X as well). regards -- components: None files: patch-semaphore.diff keywords: patch messages: 115068 nosy: sable priority: normal severity: normal status: open title: semaphore errors on AIX 6.1 versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file18658/patch-semaphore.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9700 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9652] Tidy argparse default output
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +bethard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9652 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9694] argparse: Default Help Message Lists Required Args As Optional
R. David Murray rdmur...@bitdance.com added the comment: Well, there's also issue 9652, which speaks to having a more general facility, I suppose. Maybe an exposed dictionary attribute containing the constant strings? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9698] When reusing an handler, urllib(2)'s digest authentication fails after multiple regative replies
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +orsenthil versions: -Python 2.5, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9698 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5573] multiprocessing Pipe poll() and recv() semantics.
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5573 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8797] urllib2 basicauth broken in 2.6.5: RuntimeError: maximum recursion depth exceeded in cmp
R. David Murray rdmur...@bitdance.com added the comment: See also new issue 9698. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8797 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3125] test_multiprocessing causes test_ctypes to fail
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3125 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9701] Update ZSH profile on Mac OS installation
Changes by Sylvain Mora sylvain.m...@googlemail.com: -- components: Build files: postflight.patch-profile.diff keywords: patch nosy: ronaldoussoren, solevis priority: normal severity: normal status: open title: Update ZSH profile on Mac OS installation versions: Python 2.7 Added file: http://bugs.python.org/file18659/postflight.patch-profile.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9701] Update ZSH profile on Mac OS installation
New submission from Sylvain Mora sylvain.m...@googlemail.com: Hi, The Update Shell Profile.command script does not allow to update ZSH profile on Mac OS. I wrote a small patch to allow it. It simply adds the modified PATH in the file .zprofile. Regards -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9701 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9699] invalid call of Windows API _popen() generating The input line is too long error message
R. David Murray rdmur...@bitdance.com added the comment: Python does not call _popen, though it does call cmd.exe (through CreateProcess) when shell=True in subprocess. Can you provide an example that shows this error occurring? -- nosy: +r.david.murray versions: -Python 2.5, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9699 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9690] Cannot distinguish bstr from str in ast module.
Benjamin Peterson benja...@python.org added the comment: 2010/8/27 Kay Hayen rep...@bugs.python.org: Kay Hayen kayha...@gmx.de added the comment: This is to inform you that I worked around the bug by reading the source file in question and checking the indicated position. This is currently the only way to decide if a literal should be unicode or str with unicode_literals from future imported. I see. I'm not really sure what you're problem is again because if unicode_literals is in effect, the AST will have decoded the literal into unicode. Module(body=[ImportFrom(module='__future__', names=[alias(name='unicode_literals', asname=None)], level=0), Expr(value=Tuple(elts=[Str(s=u's'), Str(s=u's')], ctx=Load()))]) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9690 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9698] When reusing an handler, urllib(2)'s digest authentication fails after multiple regative replies
Changes by Mads Kiilerich m...@kiilerich.com: -- nosy: +kiilerix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9698 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3111] multiprocessing ppc Debian/ ia64 Ubuntu compilation error
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6056] socket.setdefaulttimeout affecting multiprocessing Manager
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6056 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6362] multiprocessing: handling of errno after signals in sem_acquire()
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6362 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6407] multiprocessing Pool should allow custom task queue
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6407 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9702] Python violates most users expectations via the modification differences of immutable and mutable objects in methods
New submission from david db.pub.m...@gmail.com: Python violates most users expectations via the modification differences of immutable and mutable objects in methods. def foo(bar): bar = bar + bar def listy(bar): bar = [1] def dicty(bar): bar['1'] = '1' if __name__ == __main__: bar = 1 foo(bar) print bar baz = [] print baz listy(baz) print baz dict_d = {} print dict_d dicty(dict_d) print dict_d this will output 1 [] [] {} {'1': '1'} So sure this is 'expected'(pass by reference vs new object - for immutable objects) but it sure isn't obvious. I feel this is a bug in python core. I think that the behaviour should be the same for *all* objects. If it is pass by reference, *and* the item has to be able to be updated(I feel this breaks most people's expectations...) then the result of a modification to an object that is immutable should be that the pointer to the original now points to the resulting string. Personally I do not want to be able to modify the dictionary as I did above like I did. -- messages: 115074 nosy: db priority: normal severity: normal status: open title: Python violates most users expectations via the modification differences of immutable and mutable objects in methods ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9702 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6417] multiprocessing Process examples: print and getppid
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6417 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3518] multiprocessing: BaseManager.from_address documented but doesn't exist
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3518 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6653] Potential memory leak in multiprocessing
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6653 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9702] Python violates most users expectations via the modification differences of immutable and mutable objects in methods
Martin v. Löwis mar...@v.loewis.de added the comment: I feel this breaks most people's expectations... I think you are quite mistaken in this assumption. Sure, object references are difficult to grasp at first, but they are a highly useful concept, and follow very simple, systematic principles - you just need to get it once. result of a modification to an object that is immutable Objects that are immutable *cannot* be modified - that this the very definition of immutable. It seems that your understanding of Python still doesn't match its semantics. However, Python really can't adjust to whatever your current understanding is: most people (dealing with it) already have the right understanding. So closing this as won't fix. -- nosy: +loewis resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9702 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9699] invalid call of Windows API _popen() generating The input line is too long error message
sorin sorin.sbar...@gmail.com added the comment: I'm currently building some samples (one that could be run on any Windows machine). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9699 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7123] Multiprocess Process does not always exit when run from a thread.
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7123 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7060] test_multiprocessing dictionary changed size errors and hang
Changes by Ask Solem a...@opera.com: -- nosy: +asksol ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7060 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9119] Python download page needs to mention crypto code in Windows installer
Marc-Andre Lemburg m...@egenix.com added the comment: Martin v. Löwis wrote: Martin v. Löwis mar...@v.loewis.de added the comment: Which specific clause of the license do you consider violated? * 3. All advertising materials mentioning features or use of this *software must display the following acknowledgment: *This product includes software developed by the OpenSSL Project *for use in the OpenSSL Toolkit. (http://www.openssl.org/) I fail to see the violation, or how changing the download page could fix that. The download page is *not* advertising material mentioning features or use of this software. In fact, the download page doesn't refer to SSL at all. Hence there is no obligation to mention OpenSSL on the download page. * 3. All advertising materials mentioning features or use of this software *must display the following acknowledgement: *This product includes cryptographic software written by * Eric Young (e...@cryptsoft.com) Likewise. The license only permits you to use and distribute OpenSSL under the conditions mentioned in the license. Since we are not following those old-style BSD license requirements (which are unfortunate), we are not allowed to use the software: The python.org site is full of references to OpenSSL. Most prominently in the documentation of the ssl and hashlib modules, but also in the release notes/news and other files. By contrast, the name Eric Young does not appear anywhere on the site (according to a Google search). We can remedy this easily, but putting the notices on the download pages. Perhaps just putting them into the documentation is already good enough. * 4. If you include any Windows specific code (or a derivative thereof) from *the apps directory (application code) you must include an acknowledgement: *This product includes software written by Tim Hudson (t...@cryptsoft.com) This doesn't apply: we don't include any code (Windows specific or not) from the apps directory. Ok, so we don't have to add this part. I'd suggest to add a paragraph like this to the release pages: -1, unless the PSF lawyer advises that such a paragraph is indeed necessary. It may shy away users from using Python, which is clearly undesirable. So you'd rather have some users get in trouble for downloading and using crypto software, due import laws or domestic laws restricting its use in their country ? Deliberately hiding this information from the user, doesn't sound like a good approach to the problem. However, I agree that this is a question to ask the PSF board. There's probably a better wording for such a text, but some kind of note of caution needs to go on the website. -- title: Python download page needs to mention crypto code in Windows installer - Python download page needs to mention crypto code in Windows installer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9119 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com