Re: Trying to parse a HUGE(1gb) xml file
Adam Tauno Williams, 20.12.2010 20:49: On Mon, 2010-12-20 at 11:34 -0800, spaceman-spiff wrote: This is a rather long post, but i wanted to include all the details everything i have tried so far myself, so please bear with me read the entire boringly long post. I am trying to parse a ginormous ( ~ 1gb) xml file. Do that hundreds of times a day. 0. I am a python xml n00b, s have been relying on the excellent beginner book DIP(Dive_Into_Python3 by MP(Mark Pilgrim) Mark , if u are readng this, you are AWESOME so is your witty humorous writing style) 1. Almost all exmaples pf parsing xml in python, i have seen, start off with these 4 lines of code. import xml.etree.ElementTree as etree Try import xml.etree.cElementTree as etree instead. Note the leading c, which hints at the C implementations of ElementTree. It's much faster and much more memory friendly than the Python implementation. tree = etree.parse('*path_to_ginormous_xml*') root = tree.getroot() #my huge xml has 1 root at the top level print root Yes, this is a terrible technique; most examples are crap. 2. In the 2nd line of code above, as Mark explains in DIP, the parse function builds returns a tree object, in-memory(RAM), which represents the entire document. I tried this code, which works fine for a small ( ~ 1MB), but when i run this simple 4 line py code in a terminal for my HUGE target file (1GB), nothing happens. In a separate terminal, i run the top command, i can see a python process, with memory (the VIRT column) increasing from 100MB , all the way upto 2100MB. Yes, this is using DOM. DOM is evil and the enemy, full-stop. Actually, ElementTree is not DOM, it's modelled after the XML Infoset. While I agree that DOM is, well, maybe not the enemy, but not exactly beautiful either, ElementTree is really a good thing, likely also in this case. I am guessing, as this happens (over the course of 20-30 mins), the tree representing is being slowly built in memory, but even after 30-40 mins, nothing happens. I dont get an error, seg fault or out_of_memory exception. You need to process the document as a stream of elements; aka SAX. IMHO, this is the worst advice you can give. Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Redundant importing of modules
On 21 déc, 03:03, Steve Holden st...@holdenweb.com wrote: On 12/20/2010 8:36 PM, Jshgwave wrote: When writing a function that uses a module such as NumPy, it is tempting to include the statement import numpy or import numpy as np in the definition of the function, in case the function is used in a script that hasn't already imported NumPy. (answering the OP - post didn't show off here on c.l.py): This is actually totally useless. The global namespace of a function is the namespace of the module in which it has been defined, not the namespace of the module where the function is called. -- http://mail.python.org/mailman/listinfo/python-list
Re: Trying to parse a HUGE(1gb) xml file
spaceman-spiff, 20.12.2010 21:29: I am sorry i left out what exactly i am trying to do. 0. Goal :I am looking for a specific element..there are several 10s/100s occurrences of that element in the 1gb xml file. The contents of the xml, is just a dump of config parameters from a packet switch( although imho, the contents of the xml dont matter) I need to detect them then for each 1, i need to copy all the content b/w the element's start end tags create a smaller xml file. Then cElementTree's iterparse() is your friend. It allows you to basically iterate over the XML tags while its building an in-memory tree from them. That way, you can either remove subtrees from the tree if you don't need them (to safe memory) or otherwise handle them in any way you like, such as serialising them into a new file (and then deleting them). Also note that the iterparse implementation in lxml.etree allows you to specify a tag name to restrict the iterator to these tags. That's usually a lot faster, but it also means that you need to take more care to clean up the parts of the tree that the iterator stepped over. Depending on your requirements and the amount of manual code optimisation that you want to invest, either cElementTree or lxml.etree may perform better for you. It seems that you already found the article by Liza Daly about high performance XML processing with Python. Give it another read, it has a couple of good hints and examples that will help you here. Stefan -- http://mail.python.org/mailman/listinfo/python-list
how to inter-working on process in window
Hi all how do i send an ESC key into a process on window i already get a pid of process but i dont know how to send ESC key into process Please help Ha -- http://mail.python.org/mailman/listinfo/python-list
Re: On 07/13/2010 02:18 PM, Adam Mercer wrote:That version of M2Crypto does not
I was getting the same error trying to build M2Crypto 0.20.2 for Python 2.5 on a Win 7 laptop, so I pulled down the trunk, and it did build properly using minGW and Swig. However, when I try to python setup.py install, python simply gives the same complaint that python was built in visual studio 2003, and will not install M2Crypto. Any help would be greatly appreciated, as I have been trying to get this to work for days. Does anyone have a build for 0.20.2 that works with python 2.5? I found so many other builds, but not that one. Thanks, Bob S. On Tuesday, July 13, 2010 5:18 PM Adam Mercer wrote: Hi I am trying to build M2Crypto on Mac OS X 10.6.4 against python2.5 (python2.6 fails in the same way), with SWIG 2.0.0 and OpenSSL 1.0.0a and it is failing with the following: 105 :info:build swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c 106 :info:build swig -python -I/opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -I/opt/local/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i 107 :info:build SWIG/_bio.i:64: Warning 454: Setting a pointer/reference variable may leak memory. 108 :info:build SWIG/_rand.i:19: Warning 454: Setting a pointer/reference variable may leak memory. 109 :info:build SWIG/_evp.i:156: Warning 454: Setting a pointer/reference variable may leak memory. 110 :info:build SWIG/_dh.i:36: Warning 454: Setting a pointer/reference variable may leak memory. 111 :info:build SWIG/_rsa.i:43: Warning 454: Setting a pointer/reference variable may leak memory. 112 :info:build SWIG/_dsa.i:31: Warning 454: Setting a pointer/reference variable may leak memory. 113 :info:build SWIG/_ssl.i:207: Warning 454: Setting a pointer/reference variable may leak memory. 114 :info:build SWIG/_x509.i:313: Warning 454: Setting a pointer/reference variable may leak memory. 115 :info:build SWIG/_pkcs7.i:42: Warning 454: Setting a pointer/reference variable may leak memory. 116 :info:build SWIG/_pkcs7.i:42: Warning 454: Setting a pointer/reference variable may leak memory. 117 :info:build SWIG/_util.i:9: Warning 454: Setting a pointer/reference variable may leak memory. 118 :info:build SWIG/_ec.i:111: Warning 454: Setting a pointer/reference variable may leak memory. 119 :info:build SWIG/_engine.i:162: Warning 454: Setting a pointer/reference variable may leak memory. 120 :info:build creating build/temp.macosx-10.6-x86_64-2.5 121 :info:build creating build/temp.macosx-10.6-x86_64-2.5/SWIG 122 :info:build /usr/bin/gcc-4.2 -fno-strict-aliasing -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -I/opt/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py25-m2crypto/work/M2Crypto-0.20.2/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.macosx-10.6-x86_64-2.5/SWIG/_m2crypto_wrap.o -DTHREADING 123 :info:build SWIG/_m2crypto_wrap.c: In function 'rand_pseudo_bytes': 124 :info:build SWIG/_m2crypto_wrap.c:3899: warning: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness 125 :info:build SWIG/_m2crypto_wrap.c: In function 'pkcs5_pbkdf2_hmac_sha1': 126 :info:build SWIG/_m2crypto_wrap.c:3973: warning: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness 127 :info:build SWIG/_m2crypto_wrap.c: In function 'bytes_to_key': 128 :info:build SWIG/_m2crypto_wrap.c:4132: warning: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness 129 :info:build SWIG/_m2crypto_wrap.c: In function 'sign_final': 130 :info:build SWIG/_m2crypto_wrap.c:4228: warning: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness 131 :info:build SWIG/_m2crypto_wrap.c: In function 'pkey_as_der': 132 :info:build SWIG/_m2crypto_wrap.c:4300: warning: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness 133 :info:build SWIG/_m2crypto_wrap.c: In function 'pkey_get_modulus': 134 :info:build SWIG/_m2crypto_wrap.c:4333: warning: value computed is not used 135 :info:build SWIG/_m2crypto_wrap.c:4358: warning: value computed is not used 136 :info:build SWIG/_m2crypto_wrap.c: In function 'AES_crypt': 137 :info:build SWIG/_m2crypto_wrap.c:: warning: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness 138 :info:build SWIG/_m2crypto_wrap.c: At top level: 139 :info:build SWIG/_m2crypto_wrap.c:5846: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token 140 :info:build SWIG/_m2crypto_wrap.c:5850: error: expected ')' before '*' token 141 :info:build SWIG/_m2crypto_wrap.c:5854: error: expected ')' before '*' token 142 :info:build
Re: Modifying an existing excel spreadsheet
On Dec 20, 9:56 pm, Ed Keith e_...@yahoo.com wrote: I have a user supplied 'template' Excel spreadsheet. I need to create a new excel spreadsheet based on the supplied template, with data filled in. I found the tools herehttp://www.python-excel.org/, andhttp://sourceforge.net/projects/pyexcelerator/. I have been trying to use the former, since the latter seems to be devoid of documentation (not even any docstrings). My first thought was to copy the template, open the copy, modify it and save the modifications. But it looks like if I open an existing spreadsheet it must be read only. So I tried to open the template, copy it to a new spreadsheet and write the new spreadsheet, but I can't seem to copy the images, and it looks like copying the formatting is going to be difficult. Can anyone give me any tips or advice? Thanks in advance, -EdK Ed Keith e_...@yahoo.com Blog: edkeith.blogspot.com Have you tried: http://groups.google.com/group/python-excel and searching the archives for template? Similar questions have come up before there. hth Jon -- http://mail.python.org/mailman/listinfo/python-list
Re: Bug in fixed_point?!
On 12/20/10 10:03 PM, C Barrington-Leigh wrote: I cannot figure out what I'm doing wrong. The following does not return a fixed point: from scipy import optimize xxroot= optimize.fixed_point(lambda xx: exp(-2.0*xx)/2.0, 1.0, args=(), xtol=1e-12, maxiter=500) print ' %f solves fixed point, ie f(%f)=%f ?'% (xxroot,xxroot,exp(-2.0*xxroot)/2.0) You will want to ask scipy questions on the scipy-user mailing list: http://www.scipy.org/Mailing_Lists When you do, please provide the information that Terry Reedy asked for. -- 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: class inheritance
JLundell wrote: On Saturday, March 13, 2010 9:03:36 AM UTC-8, Jonathan Lundell wrote: I've got a subclass of fractions.Fraction called Value; it's a mostly trivial class, except that it overrides __eq__ to mean 'nearly equal'. However, since Fraction's operations result in a Fraction, not a Value, I end up with stuff like this: x = Value(1) + Value(2) where x is now a Fraction, not a Value, and x == y uses Fraction.__eq__ rather than Value.__eq__. This appears to be standard Python behavior (int does the same thing). I've worked around it by overriding __add__, etc, with functions that invoke Fraction but coerce the result. But that's tedious; there are a lot of methods to override. So I'm wondering: is there a more efficient way to accomplish what I'm after? I recently implemented a different approach to this. I've got: class Rational(fractions.Fraction): ... and some methods of my own, including my own __new__ and __str__ (which is one of the reasons I need the class). Then after (outside) the class definition, this code that was inspired by something similar I noticed in Python Cookbook. There are two things going on here. One is, of course, the automation at import time. The other is that the wrapper gets a Fraction instance and simply overrides __class__, rather than creating yet another Rational and unbinding the interim Fraction. Seems to work quite well. [snip] Another option is to use a metaclass: class Perpetuate(ABCMeta): def __new__(metacls, cls_name, cls_bases, cls_dict): if len(cls_bases) 1: raise TypeError(multiple bases not allowed) result_class = type.__new__(metacls, cls_name, cls_bases, cls_dict) base_class = cls_bases[0] known_attr = set() for attr in cls_dict.keys(): known_attr.add(attr) for attr in base_class.__dict__.keys(): if attr in ('__new__'): continue code = getattr(base_class, attr) if callable(code) and attr not in known_attr: setattr(result_class, attr, metacls._wrap(base_class, code)) elif attr not in known_attr: setattr(result_class, attr, code) return result_class @staticmethod def _wrap(base, code): def wrapper(*args, **kwargs): if args: cls = args[0] result = code(*args, **kwargs) if type(result) == base: return cls.__class__(result) elif isinstance(result, (tuple, list, set)): new_result = [] for partial in result: if type(partial) == base: new_result.append(cls.__class__(partial)) else: new_result.append(partial) result = result.__class__(new_result) elif isinstance(result, dict): for key in result: value = result[key] if type(value) == base: result[key] = cls.__class__(value) return result wrapper.__name__ = code.__name__ wrapper.__doc__ = code.__doc__ return wrapper then the actual class becomes: class CloseFraction(Fraction): __metaclass__ = Perpetuate def __eq__(x, y): return abs(x - y) 1 # season to taste def __repr__(x): return CloseFraction(%d, %d) % (x.numerator, x.denominator) Perpetuate needs to handle multiple inheritance better, but it might meet your needs at this point. Sample run: -- n = CloseFraction(3, 2) -- n CloseFraction(3, 2) -- print n 3/2 -- m = CloseFraction(9, 4) -- m CloseFraction(9, 4) -- n == m True -- n - m CloseFraction(-3, 4) -- n + m CloseFraction(15, 4) -- n.real CloseFraction(3, 2) -- n.imag 0 # this is an int Hope this helps! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Re: help with link parsing?
On Dec 20, 7:14 pm, Littlefield, Tyler ty...@tysdomain.com wrote: Hello all, I have a question. I guess this worked pre 2.6; I don't remember the last time I used it, but it was a while ago, and now it's failing. Anyone mind looking at it and telling me what's going wrong? Also, is there a quick way to match on a certain site? like links from google.com and only output those? #!/usr/bin/env python #This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published #by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. #This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # #You should have received a copy of the GNU General Public License along with this program. If not, see #http://www.gnu.org/licenses/. This script will parse out all the links in an html document and write them to a textfile. import sys,optparse import htmllib,formatter #program class declarations: class Links(htmllib.HTMLParser): def __init__(self,formatter): htmllib.HTMLParser.__init__(self, formatter) self.links=[] def start_a(self, attrs): if (len(attrs)0): for a in attrs: if a[0]==href: self.links.append(a[1]) print a[1] break def main(argv): if (len(argv)!=3): print(Error:\n+argv[0]+ input output.\nParses input for all links and saves them to output.) return 1 lcount=0 format=formatter.NullFormatter() html=Links(format) print Retrieving data: page=open(argv[1],r) print Feeding data to parser: html.feed(page.read()) page.close() print Writing links: output=open(argv[2],w) for i in (html.links): output.write(i+\n) lcount+=1 output.close() print(Wrote +str(lcount)+ links to +argv[2]+.); print(done.) if (__name__ == __main__): #we call the main function passing a list of args, and exit with the return code passed back. sys.exit(main(sys.argv)) -- Thanks, Ty This doesn't answer your original question, but excluding the command line handling, how's this do you?: import lxml from urlparse import urlsplit doc = lxml.html.parse('http://www.google.com') print map(urlsplit, doc.xpath('//a/@href')) [SplitResult(scheme='http', netloc='www.google.co.uk', path='/imghp', query='hl=entab=wi', fragment=''), SplitResult(scheme='http', netloc='video.google.co.uk', path='/', query='hl=entab=wv', fragment=''), SplitResult(scheme='http', netloc='maps.google.co.uk', path='/maps', query='hl=entab=wl', fragment=''), SplitResult(scheme='http', netloc='news.google.co.uk', path='/nwshp', query='hl=entab=wn', fragment=''), ...] Much nicer IMHO, plus the lxml.html has iterlinks() and other convenience functions for handling HTML. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list
[RELEASED] Python 3.2 beta 2
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the second beta preview release of Python 3.2. Python 3.2 is a continuation of the efforts to improve and stabilize the Python 3.x line. Since the final release of Python 2.7, the 2.x line will only receive bugfixes, and new features are developed for 3.x only. Since PEP 3003, the Moratorium on Language Changes, is in effect, there are no changes in Python's syntax and built-in types in Python 3.2. Development efforts concentrated on the standard library and support for porting code to Python 3. Highlights are: * numerous improvements to the unittest module * PEP 3147, support for .pyc repository directories * PEP 3149, support for version tagged dynamic libraries * PEP 3148, a new futures library for concurrent programming * PEP 384, a stable ABI for extension modules * PEP 391, dictionary-based logging configuration * an overhauled GIL implementation that reduces contention * an extended email package that handles bytes messages * countless fixes regarding bytes/string issues; among them full support for a bytes environment (filenames, environment variables) * many consistency and behavior fixes for numeric operations * a sysconfig module to access configuration information * a pure-Python implementation of the datetime module * additions to the shutil module, among them archive file support * improvements to pdb, the Python debugger For a more extensive list of changes in 3.2, see http://docs.python.org/3.2/whatsnew/3.2.html To download Python 3.2 visit: http://www.python.org/download/releases/3.2/ Please consider trying Python 3.2 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.2's contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk0Q/aAACgkQN9GcIYhpnLDf8gCgkLGAsE+T3R505jZc1RxXDYsa NSsAnRGaFjeTm9o2Z5O8FuIzTUG8t1PT =hHzz -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
seeking pygtk bindings for gtkdatabox
Hello, a search for the python bindings for gtkdatabox lead no where. Anyone know of who is maintaining/working/siting such a package? Thanks in advance. Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Sending XML to a WEB Service and Getting Response Back
On 12/20/2010 11:45 PM, Ian Kelly wrote: On 12/20/2010 11:34 PM, John Nagle wrote: SOAPpy is way out of date. The last update on SourceForge was in 2001. 2007, actually: http://sourceforge.net/projects/pywebsvcs/files/ And there is repository activity within the past 9 months. Still, point taken. The original SOAPpy was at http://sourceforge.net/projects/soapy/files/ but was apparently abandoned in 2001. Someone else picked it up and moved it to http://sourceforge.net/projects/pywebsvcs/files/SOAP.py/ where it was last updated in 2005. ZSI was last updated in 2007. Users are still submitting bug reports, but nobody is answering. Somebody posted Who maintains the pywebsvcs webpage? in February 2009, but no one answered them. There's also Python SOAP http://sourceforge.net/projects/pythonsoap/ abandoned in 2005. The suds module http://sourceforge.net/projects/python-suds/ was last updated in March, 2010. That version will work with Python 2.6, and probably 2.7. There's very little project activity, but at least it's reasonably current. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Scanning directories for new files?
Hey everyone. I'm in the midst of writing a parser to clean up incoming files, remove extra data that isn't needed, normalize some values, etc. The base files will be uploaded via FTP. How does one go about scanning a directory for new files? For now we're looking to run it as a cron job but eventually would like to move away from that into making it a service running in the background. -- http://mail.python.org/mailman/listinfo/python-list
Re: Sending XML to a WEB Service and Getting Response Back
Thanks for the response all. I tried exploring suds (which seems to be the current) and i hit problems right away. I will now try urllib or httplib. I have asked for help in the suds forum. Hope somebody replies. When i try to create a client, the error is as follows. from suds.client import Client url = 'http://10.251.4.33:8041/DteEnLinea/ws/EnvioGuia.jws' client = Client(url) Traceback (most recent call last): File stdin, line 1, in module File suds/client.py, line 112, in __init__ self.wsdl = reader.open(url) File suds/reader.py, line 152, in open d = self.fn(url, self.options) File suds/wsdl.py, line 136, in __init__ d = reader.open(url) File suds/reader.py, line 79, in open d = self.download(url) File suds/reader.py, line 101, in download return sax.parse(string=content) File suds/sax/parser.py, line 136, in parse sax.parse(source) File /usr/local/lib/python2.7/xml/sax/expatreader.py, line 107, in parse xmlreader.IncrementalParser.parse(self, source) File /usr/local/lib/python2.7/xml/sax/xmlreader.py, line 123, in parse self.feed(buffer) File /usr/local/lib/python2.7/xml/sax/expatreader.py, line 211, in feed self._err_handler.fatalError(exc) File /usr/local/lib/python2.7/xml/sax/handler.py, line 38, in fatalError raise exception xml.sax._exceptions.SAXParseException: unknown:1:62: syntax error [3] + Stopped (SIGTSTP)python This seems to be a old problem passing versions. Regards, Anurag On Wed, Dec 22, 2010 at 12:40 AM, John Nagle na...@animats.com wrote: On 12/20/2010 11:45 PM, Ian Kelly wrote: On 12/20/2010 11:34 PM, John Nagle wrote: SOAPpy is way out of date. The last update on SourceForge was in 2001. 2007, actually: http://sourceforge.net/projects/pywebsvcs/files/ And there is repository activity within the past 9 months. Still, point taken. The original SOAPpy was at http://sourceforge.net/projects/soapy/files/ but was apparently abandoned in 2001. Someone else picked it up and moved it to http://sourceforge.net/projects/pywebsvcs/files/SOAP.py/ where it was last updated in 2005. ZSI was last updated in 2007. Users are still submitting bug reports, but nobody is answering. Somebody posted Who maintains the pywebsvcs webpage? in February 2009, but no one answered them. There's also Python SOAP http://sourceforge.net/projects/pythonsoap/ abandoned in 2005. The suds module http://sourceforge.net/projects/python-suds/ was last updated in March, 2010. That version will work with Python 2.6, and probably 2.7. There's very little project activity, but at least it's reasonably current. John Nagle -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Scanning directories for new files?
On Dec 21, 7:17 pm, Matty Sarro msa...@gmail.com wrote: Hey everyone. I'm in the midst of writing a parser to clean up incoming files, remove extra data that isn't needed, normalize some values, etc. The base files will be uploaded via FTP. How does one go about scanning a directory for new files? For now we're looking to run it as a cron job but eventually would like to move away from that into making it a service running in the background. Not a direct answer, but I would choose the approach of letting the FTP server know when a new file has been added. For instance: http://www.pureftpd.org/project/pure-ftpd - Any external shell script can be called after a successful upload. Virus scanners and database archiveal can easily be set up. Of course, there's loads more servers, that I'm sure will have callback events or similar. Although, yes, the monitoring the file system is completely possible. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scanning directories for new files?
Am 21.12.2010 20:17, schrieb Matty Sarro: Hey everyone. I'm in the midst of writing a parser to clean up incoming files, remove extra data that isn't needed, normalize some values, etc. The base files will be uploaded via FTP. How does one go about scanning a directory for new files? For now we're looking to run it as a cron job but eventually would like to move away from that into making it a service running in the background. When You say cron, I assume you're running linux. One approach would be to os.walk() the directory in question, and filling a dict with the absolute name of the file as key and the output from stat() as content. Then re-scan regularly and check for changes in mtime,ctime etc. A less ressource consuming approach would be to use Linux' inotify infrastructure, which can be used from python https://github.com/seb-m/pyinotify And, your service is only an import away :-) https://github.com/seb-m/pyinotify/blob/master/python2/examples/daemon.py -- http://mail.python.org/mailman/listinfo/python-list
Re: Scanning directories for new files?
On Tue, 21 Dec 2010 14:17:40 -0500, Matty Sarro wrote: Hey everyone. I'm in the midst of writing a parser to clean up incoming files, remove extra data that isn't needed, normalize some values, etc. The base files will be uploaded via FTP. How does one go about scanning a directory for new files? For now we're looking to run it as a cron job but eventually would like to move away from that into making it a service running in the background. Make sure the files are initially uploaded using a name that the parser isn't looking for and rename it when the upload is finished. This way the parser won't try to process a partially loaded file. If you are uploading to a *nix machine You the rename can move the file between directories provided both directories are in the same filing system. Under those conditions rename is always an atomic operation with no copying involved. This would you to, say, upload the file to temp/ myfile and renamed it to uploaded/myfile with your parser only scanning the uploaded directory and, presumably, renaming processed files to move them to a third directory ready for further processing. I've used this technique reliably with files arriving via FTP at quite high rates. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | -- http://mail.python.org/mailman/listinfo/python-list
Re: If/then style question
I'd bet you would stress your point Steven! But you don't need to persuade me, I do already agree. I just meant to say that, when the advantage is little, there's no need to rewrite a working function. And that with modern CPUs, if tests take so little time, that even some redundant one is not so much of a nuisance. in your working example, the payload is just a couple of integer calculations, that take very little time too. So the overhead due to redundant if tests does show clearly. And also in that not-really-real situation, 60% overhead just meant less than 3 seconds. Just for the sake of discussion, I tried to give both functions some plough to pull, and a worst-case situation too: t1 = Timer('for x in range(100): print func1(0),', ... 'from __main__ import func1') t2 = Timer('for x in range(100): print func2(0),', ... 'from __main__ import func2') min(t1.repeat(number=1, repeat=1)) -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 53.011015366479114 min(t2.repeat(number=1, repeat=1)) -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 47.55442856564332 that accounts for a scant 11% overhead, on more than one million tests per cycle. That said, let's make really clear that I would heartily prefer func2 to func1, based both on readability and speed. Thank you for having spent some time playing with me! Francesco On 19/12/2010 1.05, Steven D'Aprano wrote: Well, let's try it with a working (albeit contrived) example. This is just an example -- obviously I wouldn't write the function like this in real life, I'd use a while loop, but to illustrate the issue it will do. def func1(n): result = -1 done = False n = (n+1)//2 if n%2 == 1: result = n done = True if not done: n = (n+1)//2 if n%2 == 1: result = n done = True if not done: n = (n+1)//2 if n%2 == 1: result = n done = True if not done: for i in range(100): if not done: n = (n+1)//2 if n%2 == 1: result = n done = True return result def func2(n): n = (n+1)//2 if n%2 == 1: return n n = (n+1)//2 if n%2 == 1: return n n = (n+1)//2 if n%2 == 1: return n for i in range(100): n = (n+1)//2 if n%2 == 1: return n return -1 Not only is the second far more readable that the first, but it's also significantly faster: from timeit import Timer t1 = Timer('for i in range(20): x = func1(i)', ... 'from __main__ import func1') t2 = Timer('for i in range(20): x = func2(i)', ... 'from __main__ import func2') min(t1.repeat(number=10, repeat=5)) 7.3219029903411865 min(t2.repeat(number=10, repeat=5)) 4.530779838562012 The first function does approximately 60% more work than the first, all of it unnecessary overhead. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scanning directories for new files?
On Tue, 21 Dec 2010 14:17:40 -0500, Matty Sarro wrote: Hey everyone. I'm in the midst of writing a parser to clean up incoming files, remove extra data that isn't needed, normalize some values, etc. The base files will be uploaded via FTP. How does one go about scanning a directory for new files? For now we're looking to run it as a cron job but eventually would like to move away from that into making it a service running in the background. You can try pyinotify. Pyinotify is a Python module for monitoring filesystems changes. Pyinotify relies on a Linux Kernel feature (merged in kernel 2.6.13) called inotify. inotify is an event-driven notifier, its notifications are exported from kernel space to user space through three system calls. pyinotify binds these system calls and provides an implementation on top of them offering a generic and abstract way to manipulate those functionalities. I'm assuming your using Linux. You seem to be at least using UNIX (cron). read more at: http://pyinotify.sourceforge.net/ Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Sending XML to a WEB Service and Getting Response Back
On 12/21/2010 12:10 PM, John Nagle wrote: The original SOAPpy was at http://sourceforge.net/projects/soapy/files/ but was apparently abandoned in 2001. Someone else picked it up and moved it to http://sourceforge.net/projects/pywebsvcs/files/SOAP.py/ These are unrelated projects, AFACT. The former was released as version 0.1 on 4/27/01. According to the changelog, the first public release of the latter was version 0.5 on 4/17/01. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3.2 beta 2
I wonder if Unladen Swallow is still being considered for merger with Python 3.3. Is it? On Dec 21, 4:18 pm, Georg Brandl ge...@python.org wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the second beta preview release of Python 3.2. Python 3.2 is a continuation of the efforts to improve and stabilize the Python 3.x line. Since the final release of Python 2.7, the 2.x line will only receive bugfixes, and new features are developed for 3.x only. Since PEP 3003, the Moratorium on Language Changes, is in effect, there are no changes in Python's syntax and built-in types in Python 3.2. Development efforts concentrated on the standard library and support for porting code to Python 3. Highlights are: * numerous improvements to the unittest module * PEP 3147, support for .pyc repository directories * PEP 3149, support for version tagged dynamic libraries * PEP 3148, a new futures library for concurrent programming * PEP 384, a stable ABI for extension modules * PEP 391, dictionary-based logging configuration * an overhauled GIL implementation that reduces contention * an extended email package that handles bytes messages * countless fixes regarding bytes/string issues; among them full support for a bytes environment (filenames, environment variables) * many consistency and behavior fixes for numeric operations * a sysconfig module to access configuration information * a pure-Python implementation of the datetime module * additions to the shutil module, among them archive file support * improvements to pdb, the Python debugger For a more extensive list of changes in 3.2, see http://docs.python.org/3.2/whatsnew/3.2.html To download Python 3.2 visit: http://www.python.org/download/releases/3.2/ Please consider trying Python 3.2 with your code and reporting any bugs you may notice to: http://bugs.python.org/ Enjoy! - -- Georg Brandl, Release Manager georg at python.org (on behalf of the entire python-dev team and 3.2's contributors) -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk0Q/aAACgkQN9GcIYhpnLDf8gCgkLGAsE+T3R505jZc1RxXDYsa NSsAnRGaFjeTm9o2Z5O8FuIzTUG8t1PT =hHzz -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3.2 beta 2
Am 21.12.2010 22:56, schrieb Luis M. González: I wonder if Unladen Swallow is still being considered for merger with Python 3.3. Is it? 3.2 isn't even released yet, and 3.3 will appear 18 months after it (so in Summer 2012). It's much too early to tell. OTOH, to answer you literal question: most certainly. At least you seem to be considering it, so it's certainly being considered by somebody. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Funny __future__ imports
from __future__ import space_shuttle DeprecationWarning: will be removed in next release Post yours! -- http://mail.python.org/mailman/listinfo/python-list
Re: True lists in python?
Duncan Booth duncan.bo...@invalid.invalid writes: I guess you might be able to do it with a double-linked list provided that when traversing the list you always keep two nodes around to determine the direction. e.g. instead of asking for node6.nextNode() you ask for node6.nextNode(previous=node1) and then the code can return whichever sibling wasn't given. That would make reversal (assuming you have both nodes) O(1), but would make traversing the list slower. There used to be a trick to implement doubly linked lists with the same memory footprint as singly linked ones: instead of each node storing two pointers (one to the next node, one to the previous one), you just store one value: (previous node) xor (next node) This means that when traversing the list, you need to always remember which node you are coming from. But it also makes these lists kind of symmetrical. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Specialisation / Interests
Hi all, Was thinking tonight (now this morning my time): What would we consider the long time posters on c.l.p consider what they respond to and offer serious advice on. For instance: - Raymond Hettinger for algo's in collections and itertools - MRAB for regex's (never seen him duck a post where re was (not) required. - the effbot for PIL ElementTree - Mark Hammond for work on win32 - Mark Dickinson for floating point/number theory etc... Then so many others!... I'm leaving a huge amount out, so no rudeness intended - but what you think guys and gals? Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list
Re: [python-committers] [RELEASED] Python 3.2 beta 2
On Wed, Dec 22, 2010 at 6:18 AM, Georg Brandl ge...@python.org wrote: Since PEP 3003, the Moratorium on Language Changes, is in effect, there are no changes in Python's syntax and built-in types in Python 3.2. Minor nit - we actually did tweak a few of the builtin types a bit (mostly the stuff to improve Sequence ABC conformance and to make range objects more list-like) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia -- http://mail.python.org/mailman/listinfo/python-list
Re: Funny __future__ imports
On 21/12/2010 22:17, Daniel da Silva wrote: from __future__ import space_shuttle DeprecationWarning: will be removed in next release Post yours! from __future__ import time_machine ImportError: time_machine in use by import -- http://mail.python.org/mailman/listinfo/python-list
Re: Funny __future__ imports
On 12/21/2010 6:38 PM MRAB said... On 21/12/2010 22:17, Daniel da Silva wrote: from __future__ import space_shuttle DeprecationWarning: will be removed in next release Post yours! from __future__ import time_machine ImportError: time_machine in use by import from __future__ import improved_realestate_market ValueError: realestate market depreciated :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Sending XML to a WEB Service and Getting Response Back
On 12/21/2010 11:26 AM, Anurag Chourasia wrote: Thanks for the response all. I tried exploring suds (which seems to be the current) and i hit problems right away. I will now try urllib or httplib. I have asked for help in the suds forum. Hope somebody replies. When i try to create a client, the error is as follows. from suds.client import Client url = 'http://10.251.4.33:8041/DteEnLinea/ws/EnvioGuia.jws' client = Client(url) Traceback (most recent call last): File stdin, line 1, inmodule File suds/client.py, line 112, in __init__ self.wsdl = reader.open(url) File suds/reader.py, line 152, in open d = self.fn(url, self.options) File suds/wsdl.py, line 136, in __init__ d = reader.open(url) File suds/reader.py, line 79, in open d = self.download(url) File suds/reader.py, line 101, in download return sax.parse(string=content) File suds/sax/parser.py, line 136, in parse sax.parse(source) File /usr/local/lib/python2.7/xml/sax/expatreader.py, line 107, in parse xmlreader.IncrementalParser.parse(self, source) File /usr/local/lib/python2.7/xml/sax/xmlreader.py, line 123, in parse self.feed(buffer) File /usr/local/lib/python2.7/xml/sax/expatreader.py, line 211, in feed self._err_handler.fatalError(exc) File /usr/local/lib/python2.7/xml/sax/handler.py, line 38, in fatalError raise exception xml.sax._exceptions.SAXParseException:unknown:1:62: syntax error [3] + Stopped (SIGTSTP)python This seems to be a old problem passing versions. Regards, Anurag Try posting a URL that isn't on network 10. That's some local network at your end. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Bug in fixed_point?!
On Dec 21, 9:36 am, Robert Kern robert.k...@gmail.com wrote: When you do, please provide the information that Terry Reedy asked for. Sorry; quite right. For completeness I'll post here as well as over on scipy. Here's the actual code: - from scipy import optimize from math import exp xxroot= optimize.fixed_point(lambda xx: exp(-2.0*xx)/2.0, 1.0, args=(), xtol=1e-12, maxiter=500) print ' %f solves fixed point, ie f(%f)=%f ?'% (xxroot,xxroot,exp(-2.0*xxroot)/2.0) Here is the output -- Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) In [1]: run tmp.py 0.332058 solves fixed point, ie f(0.332058)=0.257364 ? -- http://mail.python.org/mailman/listinfo/python-list
[issue10694] zipfile.py end of central directory detection not robust
Xuanji Li xua...@gmail.com added the comment: Hi KevinH, sorry if I gave the wrong impression that you must submit a patch before anyone will look at the bug. I thought you wanted to provide a patch for this. If you only want to report a bug that is ok, thanks for that. I have confirmed your bug on the py3k branch. Attached is a patch that adds a test case to test_zipfile.py (as requested by others) and ports Kevin's patch to py3k. I have confirmed that his patch works: without it the test fails, and with it the test passes. Note: You have to create a file README.zip in the Lib/test directory, because svn diff cannot display added files. -- Added file: http://bugs.python.org/file20127/Issue10694.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10694] zipfile.py end of central directory detection not robust
Xuanji Li xua...@gmail.com added the comment: Sorry, forgot to add: README.zip should have a \r\n at the end. Actually I just zipped up README, ran echo \r\n README.zip and put it in Lib/test. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] uninformative error message
Changes by Eric Smith e...@trueblade.com: Removed file: http://bugs.python.org/file20126/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] uninformative error message
Eric Smith e...@trueblade.com added the comment: Because you're sending email as HTML, the message shows up both as plain text and as an attachment. It's the attachments that are being removed. If you could, please stop sending HTML email. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] uninformative error message
Eric Smith e...@trueblade.com added the comment: Here's a code snippet that shows the problem: import subprocess subprocess.Popen(['foo']) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/subprocess.py, line 593, in __init__ errread, errwrite) File /usr/lib/python2.5/subprocess.py, line 1079, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] Command name missing from exception in subprocess.Popen
Changes by Eric Smith e...@trueblade.com: -- title: uninformative error message - Command name missing from exception in subprocess.Popen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] Command name missing from exception in subprocess.Popen
Changes by Eric Smith e...@trueblade.com: -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly brace expansion
Changes by Mathieu Bridon boche...@fedoraproject.org: Removed file: http://bugs.python.org/file19451/0001-Curly-brace-expansion-in-glob.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly brace expansion
Mathieu Bridon boche...@fedoraproject.org added the comment: Same patch, but rebased to the current trunk so it still applies. -- Added file: http://bugs.python.org/file20128/0001-Curly-brace-expansion-in-glob.patch.old ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly brace expansion
Mathieu Bridon boche...@fedoraproject.org added the comment: This is the right patch, sorry for all the mail spam. :-/ -- Added file: http://bugs.python.org/file20129/0001-Curly-brace-expansion-in-glob.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10724] socket.close close telnet with RST
sean216 taoyuan-...@163.com added the comment: Note that in your sample capture, I don't see any invalid sequence/ack number. please check telnet_unnormal RST.pcap in No. 1600-1602,the 1602 RST meseage is the invalid sequence/ack number 172. -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10724 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9355] argparse add_mutually_exclusive_group more than once has incorrectly formatted help
Changes by Steven Bethard steven.beth...@gmail.com: -- stage: needs patch - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)
Steven Bethard steven.beth...@gmail.com added the comment: Yep, I believe that fix should work. Now to find the time to write some tests... -- nosy: +bethard stage: - unit test needed versions: -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10680 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10475] hardcoded compilers for LDSHARED/LDCXXSHARED on NetBSD
OBATA Akio ob...@lins.jp added the comment: This patch is also required for DragonFly, or libpython will not linked against libpthread and broken library. -- nosy: +obache ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10747] Include version info in Windows shortcuts
New submission from Nick Coghlan ncogh...@gmail.com: This issue is to propose specific wording to Martin for inclusion of version details in the Windows shortcuts. This is to make the shortcuts easier to use when the hierarchical menu information is lost for any reason (e.g frequently used program list, searching the start menu, copied to desktop). Shortcuts currently installed: - Python (command line) - Python Manuals - Module Docs - IDLE (Python GUI) - Uninstall Python Initial proposal for 32 bit builds: - Python 3.2 (command line - 32 bit) - Python 3.2 Manuals - Python 3.2 Docs Server (pydoc - 32 bit) - IDLE (Python 3.2 GUI - 32 bit) - Uninstall Python 3.2 (32 bit) Initial proposal for 64 bit builds: - Python 3.2 (command line - 64 bit) - Python 3.2 Manuals - Python 3.2 Docs Server (pydoc - 64 bit) - IDLE (Python 3.2 GUI - 64 bit) - Uninstall Python 3.2 (64 bit) Any feedback/alternate suggestions/bikeshedding on the python-dev thread, please ;) -- messages: 124427 nosy: ncoghlan priority: normal severity: normal status: open title: Include version info in Windows shortcuts type: feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] Command name missing from exception in subprocess.Popen
Eric Smith e...@trueblade.com added the comment: This has already been fixed in 3.2: Python 3.2b2 (py3k:87413, Dec 21 2010, 07:09:13) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 Type help, copyright, credits or license for more information. import subprocess subprocess.Popen(['foo']) Traceback (most recent call last): File stdin, line 1, in module File /root/python/py3k/Lib/subprocess.py, line 708, in __init__ restore_signals, start_new_session) File /root/python/py3k/Lib/subprocess.py, line 1323, in _execute_child raise child_exception_type(errno_num, err_msg) OSError: [Errno 2] No such file or directory: 'foo' It looks like it was changed by Benjamin in r86595. Not sure why that wasn't backported. -- versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10715] Command name missing from exception in subprocess.Popen
Eric Smith e...@trueblade.com added the comment: That change was just a tweak. The real change was in r86593. It references issue 4925, of which this is a duplicate. I'm closing this, if you want to follow the issue add yourself to 4925. -- resolution: - duplicate stage: needs patch - committed/rejected status: open - closed superseder: - Improve error message of subprocess when cannot open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10715 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input
Michael Foord mich...@voidspace.org.uk added the comment: This is committed to 2.7 and 3.2 (using the old name assertItemsEqual in 2.7). As we're well into the beta cycle I don't think we can change the name in 3.2. The current failure output is very nice for comparing sequences like [1, 2, 3] vs [1, 2, 4]: AssertionError: Expected, but missing: [4] Unexpected, but present: [3] It is less good for sequences like [2, 2] vs [2, 2, 2]: AssertionError: Expected, but missing: [2] -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5879] multiprocessing - example pool of http servers fails on windows socket has no attribute fromfd
Mher Movsisyan mher.movsis...@gmail.com added the comment: py3k does support socket.fromfd on Windows (#1378) -- nosy: +mher ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5879 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4761] create Python wrappers for openat() and others
Ross Lagerwall rosslagerw...@gmail.com added the comment: Attached is a patch that adds: faccessat, fchmodat, fchownat, fstatat, futimesat, linkat, mkdirat, mknodat, openat, readlinkat, renameat, symlinkat, unlinkat, utimensat and mkfifoat. Each function has documentation and a unit test and is conditionally included only if the functions exist using autoconf testing. Most of the code for the functions and unit tests was taken from the corresponding non-at versions. Tested on Linux 2.6.35 and FreeBSD 8.1 (although FreeBSD 8.1 does not have utimensat). This should then allow a patch for #4489 to be created. -- keywords: +patch nosy: +rosslagerwall Added file: http://bugs.python.org/file20130/i4761.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4761 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10748] zipfile does not write empty ZIP structure if close() called after __init__() as doc suggests
New submission from Ian Stevens iancstev...@gmail.com: The zipfile documentation (http://docs.python.org/library/zipfile.html) states: If the file is created with mode 'a' or 'w' and then close()d without adding any files to the archive, the appropriate ZIP structures for an empty archive will be written to the file. This is not the case, eg.:: from StringIO import StringIO import zipfile s = StringIO() z = zipfile.ZipFile(s, 'w') z.close() s.len 0 The code for zipfile (http://svn.python.org/projects/python/trunk/Lib/zipfile.py) does not support the documentation either. The ending records are written only if ZipFile._didModify is True, and that attribute is only set to True if writestr() or write() are called. Either the code should be fixed to support writing the ending records on an empty zip, or the documentation should be changed to reflect the existing behaviour. Test case (for Lib/test/test_zipfile):: def test_close_empty_zip_creates_valid_zip(self): # Test that close() called on a ZipFile without write creates a valid ZIP. zf = zipfile.ZipFile(TESTFN, w) zf.close() chk = zipfile.is_zipfile(TESTFN) self.assertTrue(chk) -- assignee: d...@python components: Documentation, Library (Lib) messages: 124433 nosy: Ian.Stevens, d...@python priority: normal severity: normal status: open title: zipfile does not write empty ZIP structure if close() called after __init__() as doc suggests type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10748 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10724] socket.close close telnet with RST
R. David Murray rdmur...@bitdance.com added the comment: Regardless, Python doesn't generate the tcp/ip sequence numbers, the OS socket library does, so this is not a bug in Python. If you follow the code link I posted you will see that, other than Python internal bookkeeping, the only thing socket.close does is to call the platform socket close method. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10724 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10748] zipfile does not write empty ZIP structure if close() called after __init__() as doc suggests
Georg Brandl ge...@python.org added the comment: This has been fixed in Python 2.7.1 (which the online docs refer to). I assume that you're using 2.6 or an earlier version. As for the code in SVN, the trunk is currently not in use; development happens in the release27-maint, release31-maint and py3k branches (the latter being the actual trunk of development). This irritation will go away soon once we have migrated to Hg. -- nosy: +georg.brandl resolution: - out of date status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10748 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10748] zipfile does not write empty ZIP structure if close() called after __init__() as doc suggests
Ian Stevens iancstev...@gmail.com added the comment: Yes, I'm using 2.6. If this is not the expected behaviour in 2.6, the doc should reflect that with a New in version 2.7 note. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10748 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10733] plistlib rejects strings containing control characters
Ronald Oussoren ronaldousso...@mac.com added the comment: I agree with Martin that this is a tricky one. The file is problematic because it is invalid XML[1], however Apple's tools are perfectly happy to proces the file and as Mitchell notes plistlib exists to interoperate with Apple's plist files. I'm therefore reopening the issue, but with a low priority. It is unlikely that I'll work on this in the near future though. Replacing all control characters by entities before trying to parse the Plist XML would likely be the best way forward. A patch (including testcases) would definitely be appreciated. BTW. I've checked that Apple's Cocoa libraries will read the file, this is not just a bug in the xml1 output formatter of plutil. Using PyObjC: from Foundation import NSDictionary d = NSDictionary.dictionaryWithContentsOfFile_('com.apple.Terminal.plist') [1] It is invalid XML because it contains control characters which are invalid according to the XML specification (http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char). -- priority: normal - low stage: committed/rejected - unit test needed status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10733 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10475] hardcoded compilers for LDSHARED/LDCXXSHARED on NetBSD
Antoine Pitrou pit...@free.fr added the comment: Does it work properly if CC and CXX are not defined by the user? (probably a naïve question, sorry) -- nosy: +pitrou stage: - patch review type: - behavior versions: +Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10743] 3.2's sysconfig doesn't work with virtualenv
Antoine Pitrou pit...@free.fr added the comment: Agreed it should probably be a release blocker. I guess it has to do with (not) following symlinks, right? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4761] create Python wrappers for openat() and others
Changes by Antoine Pitrou pit...@free.fr: -- stage: unit test needed - patch review versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4761 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10742] memoryview.readonly attribute is not documented
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +mark.dickinson, ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10748] zipfile does not write empty ZIP structure if close() called after __init__() as doc suggests
Georg Brandl ge...@python.org added the comment: We usually don't do this for bugfixes, but here it makes sense I guess. r87414. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10748 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10743] 3.2's sysconfig doesn't work with virtualenv
Georg Brandl ge...@python.org added the comment: OK, let's make this one. Tarek to the rescue! -- priority: deferred blocker - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10743] 3.2's sysconfig doesn't work with virtualenv
Tarek Ziadé ziade.ta...@gmail.com added the comment: Will do tonight -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10743 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1243654] Faster output if message already has a boundary
R. David Murray rdmur...@bitdance.com added the comment: Committed test and fix in r87415, r87416, r87417. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1243654 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4761] create Python wrappers for openat() and others
Antoine Pitrou pit...@free.fr added the comment: Thanks for the patch. A couple of comments: - the C code is misindented in some places (using 8 spaces rather than 4) - you should use support.unlink consistently in the tests (rather than sometimes os.unlink or posix.unlink) - when cleaning up in tests (through unlink() or rmdir()), it's better to use finally clauses so that cleaning up gets done even on error; or, alternatively, to use self.addCleanup() (see http://docs.python.org/dev/library/unittest.html#unittest.TestCase.addCleanup) (I haven't looked at the C code in detail since you say it's mostly copy/paste from existing code) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4761 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10744] ctypes arrays have incorrect buffer information (PEP-3118)
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10744 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10735] platform.architecture() gives misleading results for OS X multi-architecture executables
Antoine Pitrou pit...@free.fr added the comment: Adding a warning sounds like a good idea. Is it reasonable to include a recommended cross-platform approach in the platform doc, like either the sys.maxsize test or the struct.calsize(P) test (which is used as a default fallback in platform.architecture)? Yes. Are there any currently supported platforms where either of those wouldn't work? No. I think even on fringe platforms it is unlikely for size_t to not reflect the native pointer width (although it is theoretically possible). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10749] lots of warnings when generating logging docs
New submission from Antoine Pitrou pit...@free.fr: make html in the Doc directory and then: [...] /home/antoine/py3k/__svn__/Doc/howto/logging.rst:507: WARNING: duplicate object description of logging.logging.Formatter.__init__, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst, use :noindex: for one of them /home/antoine/py3k/__svn__/Doc/howto/logging.rst:733: WARNING: duplicate label library-config, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging.rst:849: WARNING: duplicate label useful-handlers, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging.rst:834: WARNING: duplicate label custom-levels, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging.rst:944: WARNING: duplicate label logging-exceptions, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging.rst:969: WARNING: duplicate label arbitrary-object-messages, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging.rst:460: WARNING: duplicate label handler-basic, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging-cookbook.rst:596: WARNING: duplicate label filters-contextual, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging-cookbook.rst:149: WARNING: duplicate label multiple-destinations, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging-cookbook.rst:333: WARNING: duplicate label network-logging, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging-cookbook.rst:470: WARNING: duplicate label context-info, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging-cookbook.rst:872: WARNING: duplicate label zeromq-handlers, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst /home/antoine/py3k/__svn__/Doc/howto/logging-cookbook.rst:670: WARNING: duplicate label multiple-processes, other instance in /home/antoine/py3k/__svn__/Doc/library/logging.rst [...] -- assignee: vinay.sajip components: Documentation, Library (Lib) messages: 124446 nosy: pitrou, vinay.sajip priority: normal severity: normal stage: needs patch status: open title: lots of warnings when generating logging docs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10749 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10749] lots of warnings when generating logging docs
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +d...@python ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10749 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10749] lots of warnings when generating logging docs
Georg Brandl ge...@python.org added the comment: Will vanish after a full rebuild; the duplicate detection is a bit buggy in Sphinx when the documents are read in the wrong order. -- nosy: +georg.brandl resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10749 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10744] ctypes arrays have incorrect buffer information (PEP-3118)
Changes by Georg Brandl ge...@python.org: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10744 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10735] platform.architecture() gives misleading results for OS X multi-architecture executables
Antoine Pitrou pit...@free.fr added the comment: I'm committing a doc update in r87421 with a suggestion to use sys.maxsize. I'll let Marc-André decide how to deal with the rest of the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10735 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10694] zipfile.py end of central directory detection not robust
Georg Brandl ge...@python.org added the comment: High is not near high enough to get noticed before the release :) -- nosy: +georg.brandl priority: high - deferred blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes
Changes by Georg Brandl ge...@python.org: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10746 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10254] unicodedata.normalize('NFC', s) regression
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: In the new patch, issue10254b.diff, I've added a test that would crash unpatched code: unicodedata.normalize('NFC', 'C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸C̸Ç') Segmentation fault Martin, I still feel uneasy about the fixed size of the skipped buffer. It is not obvious that skipped combining characters always get removed from the buffer before the next starter is processed. I would really like another pair of eyes to look at this code before it goes in especially to 2.6. Victor, IIRC, you did some stress testing on random data. I wonder if you could test this code after tightening the assert to cskipped 4. (The current theory is that this should be enough.) -- Added file: http://bugs.python.org/file20131/issue10254b.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10254 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10746] ctypes c_long c_bool have incorrect PEP-3118 type codes
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10746 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10750] raw attribute of buffered IO objects is assignable
New submission from Antoine Pitrou pit...@free.fr: This really looks backwards: f = open(LICENSE, rb) f.name = bar Traceback (most recent call last): File stdin, line 1, in module AttributeError: attribute 'name' of '_io.BufferedReader' objects is not writable f.raw = None __main__:1: ResourceWarning: unclosed file _io.FileIO name='LICENSE' mode='rb' -- components: IO, Library (Lib) messages: 124451 nosy: amaury.forgeotdarc, benjamin.peterson, pitrou priority: normal severity: normal stage: needs patch status: open title: raw attribute of buffered IO objects is assignable type: behavior versions: Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10750] raw attribute of buffered IO objects is assignable
Antoine Pitrou pit...@free.fr added the comment: Here is a patch. -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file20132/io_roattrs.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4761] create Python wrappers for openat() and others
Ross Lagerwall rosslagerw...@gmail.com added the comment: Attached is an updated patch which: - fixes badly indented C code - uses support.unlink consistently - cleans up tests better using finally -- Added file: http://bugs.python.org/file20133/i4761_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4761 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10750] raw attribute of buffered IO objects is assignable
Benjamin Peterson benja...@python.org added the comment: 2010/12/21 Antoine Pitrou rep...@bugs.python.org: Antoine Pitrou pit...@free.fr added the comment: Here is a patch. I assume you can put test_readonly_attributes in CommonBufferTests? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10750] raw attribute of buffered IO objects is assignable
Antoine Pitrou pit...@free.fr added the comment: Le mardi 21 décembre 2010 à 20:36 +, Benjamin Peterson a écrit : Benjamin Peterson benja...@python.org added the comment: 2010/12/21 Antoine Pitrou rep...@bugs.python.org: Antoine Pitrou pit...@free.fr added the comment: Here is a patch. I assume you can put test_readonly_attributes in CommonBufferTests? That's where it is :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10750] raw attribute of buffered IO objects is assignable
Benjamin Peterson benja...@python.org added the comment: Ah, I see. LGTM then. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4761] create Python wrappers for openat() and others
Benjamin Peterson benja...@python.org added the comment: The docs shouldn't use [ to denote optional args. Rather, optional arguments can just be shown by their defaults. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4761 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10750] raw attribute of buffered IO objects is assignable
Antoine Pitrou pit...@free.fr added the comment: Thank you, committed in r87427 (3.2), r87428 (3.1) and r87429 (2.7). -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10750 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly brace expansion
R. David Murray rdmur...@bitdance.com added the comment: Thanks for the research and the updated patch. Unfortunately as a feature request this is going to have to wait for 3.3 since we missed the pre-beta window. -- versions: +Python 3.3 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4871] zipfile can't decrypt
R. David Murray rdmur...@bitdance.com added the comment: Thinking about this some more, it seems like the chance that someone is using bytearray to pass a password to zipfile is vanishingly small, especially since in non-optimized mode setpassword would have rejected it. So I think that this should go in. -- assignee: - r.david.murray stage: - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4871 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly brace expansion
Mathieu Bridon boche...@fedoraproject.org added the comment: Thanks for the research and the updated patch. Unfortunately as a feature request this is going to have to wait for 3.3 since we missed the pre-beta window. Ok. This is my first patch to Python, so I'm not sure what I should do to get this in. Is keeping the patch in sync with the trunk enough? Is there something else, like some more formal process to follow? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9584] Allow curly brace expansion
R. David Murray rdmur...@bitdance.com added the comment: Nope, you've got it. After the final release of Python 3.2, please post to the issue to remind us about it, and someone will commit the patch. (For future Python releases we expect that the delays in our ability to commit feature patches will be much shorter, but this is the way it works right now.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4871] zipfile can't decrypt
R. David Murray rdmur...@bitdance.com added the comment: Committed in r87430 (with message word order change), backported to 3.1 in r87431. Making the parallel change to 2.7 would be likely to break working code, IMO. -- resolution: - fixed stage: commit review - committed/rejected status: open - closed versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4871 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9285] A decorator for cProfile and profile modules
Lukas Lueg lukas.l...@gmail.com added the comment: +1 -- nosy: +ebfe ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9285 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10694] zipfile.py end of central directory detection not robust
R. David Murray rdmur...@bitdance.com added the comment: Xuanji: thanks for taking a crack at the test. Rather than adding another data file to the test directory, how about creating a zipfile using the zipfile module in the test, closing it, opening it as a file, writing the /r/n to it, and then opening it back up for read as a zipfile for the test. That's more parallel to how the other zipfile tests work. Given what we know I'd be inclined to accept Kevin's suggested fix, unless Alan speaks up against it. In that case the test may as well check that the comment is what we expect, as well. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10694 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10751] WSGIREF - REMOTE_USER and REMOTE-USER collision
New submission from Alex Raitz alex.ra...@gmail.com: Clients can overwrite 'REMOTE_USER' header variable value with an arbitrary 'Remote-User' value by specifying the later after the former. This has tricky implications when a proxy server is being used, namely that if the proxy passes a re-written REMOTE_USER but also the user-supplied 'Remote-User', Python WSGI will actually store HTTP_REMOTE_USER as the value of the user-supplied 'Remote-User' header based on the order that the headers are processed. ./python2.6/wsgiref/headers.py: 184 for k, v in _params.items(): 185 if v is None: 186 parts.append(k.replace('_', '-')) 187 else: 188 parts.append(_formatparam(k.replace('_', '-'), v)) -- components: Extension Modules messages: 124466 nosy: Alex.Raitz priority: normal severity: normal status: open title: WSGIREF - REMOTE_USER and REMOTE-USER collision type: security versions: Python 2.6, Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10751 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10751] WSGIREF - REMOTE_USER and REMOTE-USER collision
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +pje ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10751 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10752] build_ssl.py is relying on unreliable behaviour of os.popen
New submission from Sridhar Ratnakumar sridh...@activestate.com: I noticed that despite ActivePerl being installed, `os.popen(...).close()` returned 1 (see find_working_perl in build_ssl.py), while in actuality that command executed successfully with return code 0; I verified this by using the subprocess module. Here's a patch: --- python/PCbuild/build_ssl.py.orig +++ python/PCbuild/build_ssl.py @@ -45,11 +45,11 @@ # Being a Perl dummy, the simplest way I can check is if the Win32 package # is available. def find_working_perl(perls): +import subprocess for perl in perls: -fh = os.popen('%s -e use Win32;' % perl) -fh.read() -rc = fh.close() -if rc: +try: +subprocess.check_call('%s -e use Win32;' % perl, shell=True) +except subprocess.CalledProcessError: continue return perl print(Can not find a suitable PERL:) -- components: Build, Windows messages: 124467 nosy: srid priority: normal severity: normal status: open title: build_ssl.py is relying on unreliable behaviour of os.popen type: compile error versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10752 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10752] build_ssl.py is relying on unreliable behaviour of os.popen
Changes by Antoine Pitrou pit...@free.fr: -- assignee: - ocean-city nosy: +loewis, ocean-city ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10752 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10747] Include version info in Windows shortcuts
Changes by Sridhar Ratnakumar sridh...@activestate.com: -- nosy: +srid ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10747 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10753] request_uri method of wsgiref module does not support RFC1808 params.
New submission from Timothy Gates tim.ga...@gmail.com: Consider the URL making use of the RFC1808 param syntax... http://www/path;cookie=1234 The entire section '/path;cookie=1234' is passed in as PATH_INFO and so under the request_uri implementation it will be quoted import wsgiref wsgiref.request_uri({'wsgi.url_scheme': 'http', 'HTTP_HOST': 'www', 'PATH_INFO': '/path;cookie=1234'}) 'http://www/path%3Bcookie%3D1234' -- components: Library (Lib) messages: 124468 nosy: Timothy.Gates priority: normal severity: normal status: open title: request_uri method of wsgiref module does not support RFC1808 params. type: behavior versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10753 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10753] request_uri method of wsgiref module does not support RFC1808 params.
R. David Murray rdmur...@bitdance.com added the comment: Presumably all that is needed is to add ';' to 'safe' in the call that encodes PATH_INFO? -- nosy: +orsenthil, pje, r.david.murray versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10753 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8754] ImportError: quote bad module name in message
Éric Araujo mer...@netwok.org added the comment: I set LANG and LC_ALL to C and tried to import a module with a non-ASCII name: $ ./python -m échec™♥ python: No module named '\udcc3\udca9chec\udce2\udc84\udca2\udce2\udc99\udca5' Is that a good enough test? I guess the “__main__ changes” you’re talking about are the addition of single quotes around __main__ in some error messages; that was only for the sake of consistency. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8754 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10475] hardcoded compilers for LDSHARED/LDCXXSHARED on NetBSD
Nicolas Joly nj...@pasteur.fr added the comment: I do not tested it extensively, but seems so. nj...@petaure [temp/python27] ./python Python 2.7.1+ (release27-maint:87432M, Dec 22 2010, 01:10:26) [GCC 4.1.3 20080704 prerelease (NetBSD nb2 20081120)] on netbsd5 Type help, copyright, credits or license for more information. import sys sys.version '2.7.1+ (release27-maint:87432M, Dec 22 2010, 01:10:26) \n[GCC 4.1.3 20080704 prerelease (NetBSD nb2 20081120)]' import os os.uname() ('NetBSD', 'petaure.lan', '5.99.41', 'NetBSD 5.99.41 (PETAURE) #7: Mon Dec 20 23:06:49 CET 2010 nj...@petaure.lan:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/PETAURE', 'amd64') -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10475 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10724] socket.close close telnet with RST
Changes by sean216 taoyuan-...@163.com: Removed file: http://bugs.python.org/file20091/normal RST and fin.pcap ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10724 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com