Re: Beware, my computer was infected.
On 16/02/2012 01:34, Jugurtha Hadjar wrote: Hello gentlemen, I'm writing these words to give you a heads up. My computer has recently been infected with 1.exe, and I am doing what I can to contain it. It spreads via mail and I fear it will send SPAM to lists I am subscribed to. If you receive weird mails from my address, thank you to report it to me. I will not send you an executable, so if you receive one from me, please do not open it and it would be nice to report it. I will send an e-mail to this list once I think it is no longer in the system. Thank you all. Everything is under control. -- ~Jugurtha Hadjar, -- http://mail.python.org/mailman/listinfo/python-list
Re: Beware, my computer was infected.
By the way, i like 1.exe, can i have it? 在 2012年2月18日 上午6:01,Jugurtha Hadjar jugurtha.had...@gmail.com写道: On 16/02/2012 01:34, Jugurtha Hadjar wrote: Hello gentlemen, I'm writing these words to give you a heads up. My computer has recently been infected with 1.exe, and I am doing what I can to contain it. It spreads via mail and I fear it will send SPAM to lists I am subscribed to. If you receive weird mails from my address, thank you to report it to me. I will not send you an executable, so if you receive one from me, please do not open it and it would be nice to report it. I will send an e-mail to this list once I think it is no longer in the system. Thank you all. Everything is under control. -- ~Jugurtha Hadjar, -- http://mail.python.org/**mailman/listinfo/python-listhttp://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: #line in python
Ross Boylan r...@biostat.ucsf.edu wrote: As an extension or alternate, could there be a decorator like @source_line(lineno, filename) for classes and methods that could do the conversion on the fly? I don't know if there's a way to go from the function (or class) object the decorator receives to the AST. No [easy] way to go from bytecodes back to AST, but I see no reason why you can't create a new code object with your filename and line numbers and then create a new function using your modified code object. If you don't have a 1:1 correspondence of lines then you'll need to pick out all the existing line numbers from the code object co_lnotab and modify them: see dis.py findlinestarts() for how to do this. Classes would be harder: the decorator doesn't run until after the class body has executed, so you can't change the line numbers that way until it's too late. The only thing I can think would be to put all of the generated code inside a function and fix up that function with a decorator that scans the bytecode to find all contained classes and fix them up. Or you could generate a .pyc file and then fix up line numbers in the whole file: see http://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html for some code that shows you what's in a .pyc -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: logging with logging.config.fileConfig
MRAB wrote: On 19/02/2012 20:23, Herman wrote: I tried to use file to config my logger and I got a weird situation that each message is outputted twice... Here is my scenario: python: 2.6 file abc_logging.conf: [snip] [logger_abc] level=DEBUG handlers=consoleHandler qualname=abc Add this line to stop the logging message from being propagated to higher level (ancestor) loggers: propagate=0 [snip] An alternative solution is to add a handler to the root logger only. If you don't plan to have specific handling for the abc logger, this is the way to go. Remove handlers=consoleHandler from abc section. Note that %name will still properly identifies the logger that raised the event. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT]: Smartphones and Python?
Michael Torrie wrote: I do not understand what you are saying, or at least why you are saying this. But I don't understand most of your posts. It's a bot. Add it to your kill file. JM -- http://mail.python.org/mailman/listinfo/python-list
PyKota, Python: AttributeError: 'module' object has no attribute '_quote'
Hello everyone, I'm new to linux/suse, but I was given the task to install the print accounting software PyKota. Before that I never even touched a linux system, so I don't have any basic knowlegde at all! Up to now I was able to solve all problems with the help of google, but now I'm stuck. My problem: linux-6n5c:/usr/local/bin # pkusers --add john paul Creation... ERROR: PyKota v1.26_official ERROR: pkusers failed ERROR: Traceback (most recent call last): ERROR: File /usr/local/bin/pkusers, line 442, in module ERROR: retcode = manager.main(args, options) ERROR: File /usr/local/bin/pkusers, line 345, in main ERROR: oldentry = getattr(self.storage, add%s % suffix)(entry) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storages/sql.py, line 598, in addUser ERROR: oldentry = self.getUser(user.Name) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storage.py, line 623, in getUser ERROR: user = self.getUserFromBackend(username) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storages/sql.py, line 355, in getUserFromBackend ERROR: % self.doQuote(self.userCharsetToDatabase(username))) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storages/pgstorage.py, line 144, in doQuote ERROR: return pg._quote(field, typ) ERROR: AttributeError: 'module' object has no attribute '_quote' I have no idea how to deal with it or what it even means! Executing linux-6n5c:/usr/local/bin # pkusers works fine and shows me commands, version number etc. But adding users or printers (with pkprinters) won't work. I would be really thankful if anyone could give me some advice or hints how to solve the problem! Kind regards Johannes -- View this message in context: http://python.6.n6.nabble.com/PyKota-Python-AttributeError-module-object-has-no-attribute-quote-tp4487915p4487915.html Sent from the Python - python-list mailing list archive at Nabble.com. -- http://mail.python.org/mailman/listinfo/python-list
Re: #line in python (dirty tricks)
Duncan Booth wrote Ross Boylan ross at biostat.ucsf.edu wrote: As an extension or alternate, could there be a decorator like @source_line(lineno, filename) for classes and methods that could do the conversion on the fly? I don't know if there's a way to go from the function (or class) object the decorator receives to the AST. No [easy] way to go from bytecodes back to AST, but I see no reason why you can't create a new code object with your filename and line numbers and then create a new function using your modified code object. Could you elaborate? I don't understand what you are suggesting. If you don't have a 1:1 correspondence of lines then you'll need to pick out all the existing line numbers from the code object co_lnotab and modify them: see dis.py findlinestarts() for how to do this. Classes would be harder: the decorator doesn't run until after the class body has executed, so you can't change the line numbers that way until it's too late. The only thing I can think would be to put all of the generated code inside a function and fix up that function with a decorator that scans the bytecode to find all contained classes and fix them up. Or you could generate a .pyc file and then fix up line numbers in the whole file: see http://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html for some code that shows you what's in a .pyc My latest concept is to produce code that rewrites itself. Suppose the naive file would be --- mycode.py (naive) class SomeClass: class comment def some_function(self, bar): pass - end --- Protect that code by putting an if 0: in front of it and indenting each line one space. Than prepend a bit of code to do the rewriting, and add indicators of the original line numbers. --- mycode.py (after wrapping) - from detangle import detangle detangle(mycode.py, mycode.nw) if 0: # original code goes here class SomeClass: class comment #and when line numbering changes #line 35 def some_function(self, bar): pass - end --- I would write detangle so that it scans through the file in which it appears (named in the first argument), rewriting so that it appears to come from the original file (mycode.nw) given in the second argument. The scanning would look for the if 0: in the file. At that point it would accumulate code by reading lines and stripping the leading space. If it found a #line directive it would remember it and then remove it from the string it was accumulating. Finally, detangle would would pass the string of code to ast.compile, catching any syntax errors and rewriting the file and line number (I might rewrite columns too with an extension) and then rethrowing them. If compilation succeeded detangle could rewrite the AST and then exec it. Ross -- http://mail.python.org/mailman/listinfo/python-list
HTTP logging
I am logging to HTTP: logger.addHandler(logging.handlers.HTTPHandler(host, url)) Works great, except if my HTTP server happens to be unavailable: socket.error: [Errno 111] Connection refused Other than wrapping all my logger.log() calls in try/except blocks, is there a way to skip logging to the HTTPhandler if the HTTP server is unavailable? -- http://mail.python.org/mailman/listinfo/python-list
Re: HTTP logging
On 20 February 2012 16:03, Jason Friedman ja...@powerpull.net wrote: I am logging to HTTP: logger.addHandler(logging.handlers.HTTPHandler(host, url)) Works great, except if my HTTP server happens to be unavailable: socket.error: [Errno 111] Connection refused Other than wrapping all my logger.log() calls in try/except blocks, is there a way to skip logging to the HTTPhandler if the HTTP server is unavailable? Here's one: subclass HTTPHandler :) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: HTTP logging
Arnaud Delobelle wrote: On 20 February 2012 16:03, Jason Friedman ja...@powerpull.net wrote: I am logging to HTTP: logger.addHandler(logging.handlers.HTTPHandler(host, url)) Works great, except if my HTTP server happens to be unavailable: socket.error: [Errno 111] Connection refused Other than wrapping all my logger.log() calls in try/except blocks, is there a way to skip logging to the HTTPhandler if the HTTP server is unavailable? Here's one: subclass HTTPHandler :) short answer: use logging.raiseExceptions = 0 long and incomplete answer: log calls should not raise any exception. http://docs.python.org/library/logging.html#handler-objects Handler.handleError(record) This method should be called from handlers when an exception is encountered during an emit() call. By default it does nothing, which means that exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will not care about errors in the logging system, they are more interested in application errors. You could, however, replace this with a custom handler if you wish. The specified record is the one which was being processed when the exception occurred However, I looked into the code and find out an (undocumented ?) attribute of the logging module : raiseException which value is set to 1 by default (python 2.5.2 logging.__version__ '0.5.0.2' ). When set to 1, handlerError print the traceback. This has been probably fixed in recent version of the module since the handleError doc does not reference raiseException anymore. JM -- http://mail.python.org/mailman/listinfo/python-list
Re: PyKota, Python: AttributeError: 'module' object has no attribute '_quote'
JohannesTU wrote: Hello everyone, I'm new to linux/suse, but I was given the task to install the print accounting software PyKota. Before that I never even touched a linux system, so I don't have any basic knowlegde at all! Up to now I was able to solve all problems with the help of google, but now I'm stuck. My problem: linux-6n5c:/usr/local/bin # pkusers --add john paul Creation... ERROR: PyKota v1.26_official ERROR: pkusers failed ERROR: Traceback (most recent call last): ERROR: File /usr/local/bin/pkusers, line 442, in module ERROR: retcode = manager.main(args, options) ERROR: File /usr/local/bin/pkusers, line 345, in main ERROR: oldentry = getattr(self.storage, add%s % suffix)(entry) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storages/sql.py, line 598, in addUser ERROR: oldentry = self.getUser(user.Name) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storage.py, line 623, in getUser ERROR: user = self.getUserFromBackend(username) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storages/sql.py, line 355, in getUserFromBackend ERROR: % self.doQuote(self.userCharsetToDatabase(username))) ERROR: File /usr/local/lib/python2.7/site-packages/pykota/storages/pgstorage.py, line 144, in doQuote ERROR: return pg._quote(field, typ) ERROR: AttributeError: 'module' object has no attribute '_quote' I have no idea how to deal with it or what it even means! I suppose you have successfully repaired your car, but don't know what an engine might be ;) Executing linux-6n5c:/usr/local/bin # pkusers works fine and shows me commands, version number etc. But adding users or printers (with pkprinters) won't work. I would be really thankful if anyone could give me some advice or hints how to solve the problem! The error traceback explained: Python is trying to call a function named _quote() in a module named pg. The most likely reason is either that you have the wrong version of the module or a module unrelated to the required one that has the same name and appears earlier in Python's search path. You can start debugging with $ python2.7 -c'import pg; print pg.__file__' to find out the filename and then look into the corresponding .py file. If that is related to postgresql you are probably seeing a version mismatch. Consult PyKota's documentation to find out the program's dependencies. -- http://mail.python.org/mailman/listinfo/python-list
paper submission and versioning system - advice?
Hello, I'd like to find a web-based system to help a committee I'm on, where we receive proposals from different faculty. I wrote something in python, from scratch, a number of years ago because there wasn't anything available then but it is showing its age and I figured that someone has written something. Essentially I need users to be able to start a proposal, with some basic information, and then be able to add files to it. Other users will be allowed to add files as well, but I'd like to limit deletions to the committee members. It seems as if there just has to be available tools like this, but I am not even sure what such a system is called. Is there anything like this, in python preferably? thanks, Brian Blais -- Brian Blais bbl...@gmail.com http://web.bryant.edu/~bblais http://brianblais.wordpress.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: HTTP logging
On Feb 20, 5:07 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: However, I looked into the code and find out an (undocumented ?) attribute of the logging module : raiseException which value is set to 1 by default (python 2.5.2 logging.__version__ '0.5.0.2' ). When set to 1, handlerError print the traceback. This has been probably fixed in recent version of the module since the handleError doc does not reference raiseException anymore. Actually, I think it's a mistake in the docs - when they were reorganised a few months ago, the text referring to raiseExceptions was moved to the tutorial: http://docs.python.org/howto/logging.html#exceptions-raised-during-logging I will reinstate it in the reference API docs, but the answer to Jason's problem is to either subclass HTTPHandler and override handleError to suppress the error, or set logging.raiseExceptions to True (in which case all logging exceptions will be swallowed - not necessarily what he wants). Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list
Re: paper submission and versioning system - advice?
On 02/20/2012 05:45 PM, Brian Blais wrote: Hello, I'd like to find a web-based system to help a committee I'm on, where we receive proposals from different faculty. I wrote something in python, from scratch, a number of years ago because there wasn't anything available then but it is showing its age and I figured that someone has written something. Essentially I need users to be able to start a proposal, with some basic information, and then be able to add files to it. Other users will be allowed to add files as well, but I'd like to limit deletions to the committee members. It seems as if there just has to be available tools like this, but I am not even sure what such a system is called. Is there anything like this, in python preferably? thanks, Brian Blais Well I guess that any web framework would provide you more or less easily with all you need.. Django turbogears pyramid flask or web2py are just the names I know. -- http://mail.python.org/mailman/listinfo/python-list
Re: #line in python (dirty tricks)
Ross Boylan r...@biostat.ucsf.edu wrote: No [easy] way to go from bytecodes back to AST, but I see no reason why you can't create a new code object with your filename and line numbers and then create a new function using your modified code object. Could you elaborate? I don't understand what you are suggesting. This (written for Python 3.x, needs some attribute names changing for Python 2.x: import functools def source_line(lineno, filename = None): def decorator(f): c = f.__code__ code = type(c)( c.co_argcount, c.co_kwonlyargcount, c.co_nlocals, c.co_stacksize, c.co_flags, c.co_code, c.co_consts, c.co_names, c.co_varnames, c.co_filename if filename is None else filename, c.co_name, lineno, c.co_lnotab, c.co_freevars, c.co_cellvars) f.__code__ = code return f return decorator @source_line(43, 'foo.bar') def foo(): This is foo for i in range(10): bar() @source_line(665, 'evil.txt') def bar(): raise RuntimeError(oops) if __name__=='__main__': import traceback try: foo() except RuntimeError as ex: traceback.print_exc() When you run it the output looks something like this (if you create a file evil.txt with 667 lines): Traceback (most recent call last): File C:\temp\foo.py, line 30, in module foo() File foo.bar, line 47, in foo File evil.txt, line 667, in bar Evil line 667 RuntimeError: oops -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: HTTP logging
On Feb 20, 5:47 pm, Vinay Sajip vinay_sa...@yahoo.co.uk wrote: I will reinstate it in the reference API docs, but the answer to Jason's problem is to either subclass HTTPHandler and override handleError to suppress the error, or set logging.raiseExceptions to True (in which case all logging exceptions will be swallowed - not Um, that should be *False*, not True. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list
Re: paper submission and versioning system - advice?
On 2/20/2012 1:47 PM, Andrea Crotti wrote: On 02/20/2012 05:45 PM, Brian Blais wrote: I'd like to find a web-based system to help a committee I'm on, where we receive proposals from different faculty. I wrote something in python, from scratch, a number of years ago because there wasn't anything available then but it is showing its age and I figured that someone has written something. Essentially I need users to be able to start a proposal, with some basic information, and then be able to add files to it. Other users will be allowed to add files as well, but I'd like to limit deletions to the committee members. It seems as if there just has to be available tools like this, but I am not even sure what such a system is called. Content Management System (in this case, for a private web site?) is one term I have seen. Is there anything like this, in python preferably? Too many ;-). Well I guess that any web framework would provide you more or less easily with all you need.. Django turbogears pyramid flask or web2py are just the names I know. + others... To possibly limit choices, decide whether you want files available to the world or just those with accounts (which requires an authentication system). -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
netCDF4 variable manipulation
Hi, I'm trying to read a netCDF4 variable from a file (no problem) and then scale it before writing over the original variable in the file. I'm using python 2.7 and the latest netCDF4 module. It's not that I keep getting an error message but I want to do this without using for loops and all the manuals seems to be skipping this task as if it is never done. I'm new to python and coming over from matlab. Does anyone know how to modify the netCDF4 variable in python and then write it back without creating a new variable, or using for loops? Appreciate the help, /S -- http://mail.python.org/mailman/listinfo/python-list
Re: [semi OT]: Smartphones and Python?
On Wed, Feb 15, 2012 at 3:36 PM, Paul Rubin no.email@nospam.invalid wrote: Martin Schöön martin.sch...@gmail.com writes: A very quick internet search indicated that this should be no big deal if I go for an Android-based phone. What about the alternatives? It works pretty well with Maemo, though phones with that are not so easy to find. My ex-officemate wrote some SL4A (Android) apps in Python and said it was pretty easy to use, though some features were missing. I know that one missing feature was tkinter. The missing features is why I wish SL4A's Python were based on jython or the java version of pypy. Apparently each new function needs a stub for the SL4A CPython; something that runs on a JVM (OK: Dalvik really, but it's almost the same thing) should be able to call java functions directly. -- http://mail.python.org/mailman/listinfo/python-list
Re: netCDF4 variable manipulation
On 02/20/2012 03:37 PM, Sheldon wrote: Hi, I'm trying to read a netCDF4 variable from a file (no problem) and then scale it before writing over the original variable in the file. I'm using python 2.7 and the latest netCDF4 module. It's not that I keep getting an error message but I want to do this without using for loops and all the manuals seems to be skipping this task as if it is never done. I'm new to python and coming over from matlab. Does anyone know how to modify the netCDF4 variable in python and then write it back without creating a new variable, or using for loops? Appreciate the help, /S Are you using netcdf version 4, or is that name just a coincidence? If you're using a 3rd party library, you really should say so, and post a link, for those curious. in any case, if you are, I can't help you. This is apparently some special kind of variable similar to a numpy array. On the other hand, you may just be asking how to update some bytes in a file, in place. if you read the file in binary mode, then you can use seek() to go back the appropriate distance, and simply write it. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: netCDF4 variable manipulation
On Mon, 20 Feb 2012 12:37:22 -0800, Sheldon wrote: Hi, I'm trying to read a netCDF4 variable from a file (no problem) and then scale it before writing over the original variable in the file. I'm using python 2.7 and the latest netCDF4 module. It's not that I keep getting an error message but I want to do this without using for loops and all the manuals seems to be skipping this task as if it is never done. I'm new to python and coming over from matlab. Does anyone know how to modify the netCDF4 variable in python and then write it back without creating a new variable, or using for loops? There is no such thing as the netCDF4 variable in Python -- it is not a built-in part of the language, and therefore there is no built-in feature for manipulating it. You are going to have to be more specific about what you want than just how do I modify a variable with for loops?. My wild guess is that you have some sort of config file which includes a field called netCDF4 and you want to update it in place. We can't tell you how to do this without knowing what the config file is -- is it an INI file, XML, JSON, YAML, Unix-style rc file, a binary pickle, or something else? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Numeric root-finding in Python
On Sun, 12 Feb 2012 10:20:17 -0500, inq1ltd inq1...@inqvista.com wrote: I don't know the first thing about this math problem however, if I were to code this I might try ; except ZeroDivisionError: assert w = -1 rather than; except ZeroDivisionError: assert w == -1 Why? DM -- http://mail.python.org/mailman/listinfo/python-list
Re: Numeric root-finding in Python
On 21/02/2012 01:33, David Monaghan wrote: On Sun, 12 Feb 2012 10:20:17 -0500, inq1ltdinq1...@inqvista.com wrote: I don't know the first thing about this math problem however, if I were to code this I might try ; except ZeroDivisionError: assert w = -1 rather than; except ZeroDivisionError: assert w == -1 Why? DM Why not is probably a better question, given that Dennis Lee Bieber and Dave Angel have already pointed out that this is not legal Python, it'll give a syntax error. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: paper submission and versioning system - advice?
On Feb 21, 3:45 am, Brian Blais bbl...@gmail.com wrote: Essentially I need users to be able to start a proposal, with some basic information, and then be able to add files to it. Other users will be allowed to add files as well, but I'd like to limit deletions to the committee members. It seems as if there just has to be available tools like this, but I am not even sure what such a system is called. Is there anything like this, in python preferably? Frankly, I'd start at a much higher level than a web framework. I think you could easily get what you want from a ticketing system like Trac: http://trac.edgewall.org/ Trac's tickets would be proposals in your system; I believe you can attach files to them by default, and even limit the size type of attachments. There's a permissions mechanism that would provide your committee members with higher levels of access. It sits by default on SVN, so there's your versioning, and provides a wiki, so it's easy to add supporting documentation to the site. It also provides a very elegant plug-in system for easy extension, and is all in Python. -- http://mail.python.org/mailman/listinfo/python-list
Python Game Programming Challenge (PyWeek) #14 is coming!
The 14th Python Game Programming Challenge (PyWeek) is coming. It'll run from the 22nd to the 29th of April. http://pyweek.org/14/ New user registration is NOT YET OPEN. It will open one month before the challenge starts. The PyWeek challenge: - Invites entrants to write a game in one week from scratch either as an individual or in a team, - Is intended to be challenging and fun, - Will hopefully increase the public body of game tools, code and expertise, - Will let a lot of people actually finish a game, and - May inspire new projects (with ready made teams!) If you're in the US and can make it I'm co-presenting a 3 hour pygame tutorial at PyCon in March. -- http://mail.python.org/mailman/listinfo/python-list
Should I acquire lock for logging.Handler.flush()?
I'm writing a custom logging Handler that sends emails through AWS Simple Email Service using the boto library. As there's a quota cap on how many (200) emails I can send within 24hrs, I think I need to buffer my log messages from the emit() calls (Or is that a bad idea?). And I was reading the Handler documentation and was confused if I should call the acquire() and release() methods from within a flush() call. -- Fayaz Yusuf Khan Cloud developer and architect Dexetra SS, Bangalore, India fayaz.yusuf.khan_AT_gmail_DOT_com fayaz_AT_dexetra_DOT_com +91-9746-830-823 signature.asc Description: This is a digitally signed message part. -- http://mail.python.org/mailman/listinfo/python-list
[issue14062] UTF-8 Email Subject problem
New submission from Michal Sladek mic...@sladkovi.eu: Hello! I think there is a problem when adding UTF-8 subject to email message. I wrote following function (its code is based on examples I found in offical docs) which should send an email with UTF-8 subject, UTF-8 plain text body and attached file when all arguments are given. fromAddr - address of sender toAddr - address of recipient subject - subject body - text of email body attachment - full path to file we want to attach Here is the code: def sendMail (fromAddr, toAddr, subject, body = '', attachment = ''): message = email.mime.multipart.MIMEMultipart() message.add_header('From',fromAddr) message.add_header('To',toAddr) message['Subject'] = email.header.Header(subject,'utf-8') if (body != ''): msgPart = email.mime.text.MIMEText(body,'plain','utf-8') message.attach(msgPart) if (attachment != ''): if os.path.exists(attachment) == True: filename = attachment.rpartition(os.sep)[2] fp = open(attachment,'rb') msgPart = email.mime.base.MIMEBase('application','octet-stream') msgPart.set_payload(fp.read()) fp.close() email.encoders.encode_base64(msgPart) msgPart.add_header('Content-Disposition','attachment',filename=filename) message.attach(msgPart) if smtpPort == 25: smtpCon = smtplib.SMTP(smtpSrv,smtpPort) else: smtpCon = smtplib.SMTP_SSL(smtpSrv,smtpPort) if (smtpUser != '') and (smtpPass != ''): smtpCon.login(smtpUser,smtpPass) smtpCon.send_message(message,mail_options=['UTF8SMTP','8BITMIME']) smtpCon.quit() Running the function with following arguments: sendMail('rzro...@seznam.cz','msla...@volny.cz','žluťoučký kůň','úpěl ďábelské ódy') produces following output on receiving side: Return-Path: rzro...@seznam.cz Received: from smtp2.seznam.cz (smtp2.seznam.cz [77.75.76.43]) by mx1.volny.cz (Postfix) with ESMTP id DD6BB2E09CD for msla...@volny.cz; Mon, 20 Feb 2012 08:34:38 +0100 (CET) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=seznam.cz; h=Received:Content-Type:MIME-Version:From:To:Subject:--===1029508565==:MIME-Version:Content-Transfer-Encoding:X-Smtpd:X-Seznam-User:X-Session:X-Country:X-Virus-Info:X-Seznam-SPF:X-Seznam-DomainKeys; b=cdU1VSRTCDf0x2CeBNbLJxYSOhSy7r9lNp+1s7+bed6AGBI48vufe3q7f8JFxlfTc ulZIDptWi6PMvlZYCBkh1uzTKcihZR7MCoxgW0PJLO1LX5elTJsZ/GTc5oe/GZXkTPT qwj1EQIlVn0dpZtt4jIzfC2RrO2IRieR2rozeQM= Received: from dvr.ph.sladkovi.eu (ip-84-42-150-218.net.upcbroadband.cz [84.42.150.218])by email-relay2.ng.seznam.cz (Seznam SMTPD 1.2.15-6@18976) with ESMTP; Mon, 20 Feb 2012 08:34:35 +0100 (CET) Content-Type: multipart/mixed; boundary1029508565== MIME-Version: 1.0 From: rzro...@seznam.cz To: msla...@volny.cz Subject: =?utf-8?b?xb5sdcWlb3XEjWvDvSBrxa/FiA==?= X-DKIM-Status: fail X-Virus: no (m2.volny.internal - Mon, 20 Feb 2012 08:34:40 +0100 (CET)) X-Spam: no (m2.volny.internal - Mon, 20 Feb 2012 08:34:41 +0100 (CET)) X-Received-Date: Mon, 20 Feb 2012 08:34:42 +0100 (CET) --===1029508565==:Content-Type: text/plain; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: base64 X-Smtpd: 1.2.15-6@18976 X-Seznam-User: rzro...@seznam.cz X-Session: 11 X-Country: CZ X-Virus-Info:clean X-Seznam-SPF:neutral X-Seznam-DomainKeys:unknown w7pwxJtsIMSPw6FiZWxza8OpIMOzZHk= --===1029508565==-- Although no attachment argument was given, the client says that message has an attachment of unknown type and that message does not contain any text at all. See that message part header :Content-Type: text/plain; charset=utf-8 is part of the message part boundary instead of beeing inside of the message part. When I change the code of function to generate the subject manually and add it via add_header like this: def sendMail (fromAddr, toAddr, subject, body = '', attachment = ''): message = email.mime.multipart.MIMEMultipart() message.add_header('From',fromAddr) message.add_header('To',toAddr) base64Subject = base64.b64encode(subject.encode('utf-8')).decode() encodedSubject = '=?UTF-8?B?{0}?='.format(base64Subject) message.add_header('Subject',encodedSubject) if (body != ''): msgPart = email.mime.text.MIMEText(body,'plain','utf-8') message.attach(msgPart) if (attachment != ''): if os.path.exists(attachment) == True: filename = attachment.rpartition(os.sep)[2] fp = open(attachment,'rb') msgPart = email.mime.base.MIMEBase('application','octet-stream') msgPart.set_payload(fp.read()) fp.close() email.encoders.encode_base64(msgPart) msgPart.add_header('Content-Disposition','attachment',filename=filename) message.attach(msgPart) if smtpPort == 25: smtpCon =
[issue14047] UTF-8 Email Header
Michal Sladek mic...@sladkovi.eu added the comment: Hello Martin! Thanks for your kind words and for giving me hints how to fill the bug report properly. I hope this time it will be accepted (ID 14062). Best regards Michal Dne 19. února 2012 19:59 Martin v. Löwis rep...@bugs.python.org napsal(a): Martin v. Löwis mar...@v.loewis.de added the comment: Michal, it's your wording of your report, and also some of the contents that caused Eric's reaction. When you conclude with Am I doing something wrong?, then your message is *not* a bug report, but a question for help (namely, you are asking somebody to find out whether you did something wrong). Please structure bug reports as follows: 1. this is what I did 2. this is what happened 3. this is what I expected to happen instead Your report gives hints at 1, but neither discusses 2 or 3. I.e. you say what code you write, but you did not say (AFAICT) what parameters you passed to the function. And you did not say what happened when you passed the parameters. This is important information, as the first step of us is to reproduce the bug report, i.e. try out all your steps and see whether the same happens also when we do it (which often enough is not the case). Since this bug report is already filled with unrelated meta-discussion, please submit a new bug report in the style I explain above. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14047 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14047 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14034] first example in argparse doc is too complicated
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: I chose to go the way of a howto. I find argparse complex enough to deserve one. note: I have checked each example on the 3 releases that possess the module (2.7, 3.2, and 3.3), and the differences in output are very small. -- keywords: +patch Added file: http://bugs.python.org/file24576/argparse_howto.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14034 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14050] Tutorial, list.sort() and items comparability
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: An an aside, shouldn't that be in-place instead of in place (http://en.wikipedia.org/wiki/In-place)? -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14050 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13605] document argparse's nargs=REMAINDER
Georg Brandl ge...@python.org added the comment: Blocks not introduced by :: are *NOT* code blocks. If they happen to begin with , they are recognized as doctest blocks and colorized as doctests. Doctest blocks shouldn't be indented. (The indent is a blockquote in this case.) -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13605 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9253] argparse: optional subparsers
Steven Bethard steven.beth...@gmail.com added the comment: The implementation looks along the right track. Now it just needs some tests. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9253 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14027] Add pysetup script for Windows
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: I don’t understand the notions of standard vs. custom. Does standard mean setuptools? #12394 is not quite ready yet, so nothing is set in stone, but if possible I’d prefer to generate pysetup.exe. Let’s move the sub-discussion there. Okay, we'll continue on #12394, but I'll comment here on standard vs. custom - by standard, I meant the setuptools way of doing it, but not necessarily using the setuptools code - see my comment in #12394 on an alternative. The basic method is that used by setuptools, but the specific implementation is different - somescript.exe opens somescript-script.py, reads a shebang line to find which Python to invoke, then invokes it with the script. By custom I meant something else without anything specific in mind - and I'm not sure it's worth the bother and extra work of a customised pysetup.exe. Perhaps all or at least some of this could be simplified in 3.3 if the PEP 397 launcher is included in Python. Mark Hammond has re-started discussions about this on Python-dev, and hopefully we'll have a consensus to get it in. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14027 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10112 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13605] document argparse's nargs=REMAINDER
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: (this is only concerning the latest commit) Not sure if I should open a new issue, but why is there a print function at all, given that: print(parser.parse_args('--foo B cmd --arg1 XX ZZ'.split())) Namespace(args=['--arg1', 'XX', 'ZZ'], command='cmd', foo='B') parser.parse_args('--foo B cmd --arg1 XX ZZ'.split()) Namespace(args=['--arg1', 'XX', 'ZZ'], command='cmd', foo='B') -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13605 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13846] Add time.monotonic() function
Antoine Pitrou pit...@free.fr added the comment: Boost has a monotonic time implementation (steady_clock) for OS X: http://svn.boost.org/svn/boost/trunk/boost/chrono/detail/inlined/mac/chrono.hpp -- nosy: +ned.deily, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13846 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14058] test_sys has started failing
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Yep, works now. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14058 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
New submission from Vinay Sajip vinay_sa...@yahoo.co.uk: == FAIL: test_insensitive (importlib.test.source.test_case_sensitivity.CaseSensitivityTest) -- Traceback (most recent call last): File /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/test/source/test_case_sensitivity.py, line 56, in test_insensitive self.assertIn(self.name, sensitive.get_filename(self.name)) AssertionError: 'MoDuLe' not found in '/var/folders/ZN/ZNY48Gb3FyW7he0qBsYJME+++TI/-Tmp-/tmpx6934s/sensitive/module.py' Failure occurs when tested using a framework build (make frameworkinstall) on Mac OS X 10.5.8 (Leopard). -- assignee: ronaldoussoren components: Library (Lib), Macintosh messages: 153776 nosy: brett.cannon, ronaldoussoren, vinay.sajip priority: normal severity: normal status: open title: test_importlib failure on Mac OS X type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Ned Deily n...@acm.org added the comment: Also fails on 10.7 standard unix (non-framework) build on case-insensitive HFS+ fils system. -- assignee: ronaldoussoren - brett.cannon nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12428] functools test coverage
Nick Coghlan ncogh...@gmail.com added the comment: Just noticed one minor nit with the patch: the pure Python version of functools.partial should support func as a keyword argument that is passed to the underlying object. The trick is to declare a positional only argument like this: def f(*args, **kwds): first, *args = args # etc... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12428 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12428] functools test coverage
Nick Coghlan ncogh...@gmail.com added the comment: Also, the closure based implementation should be decorated with @staticmethod (see http://bugs.python.org/issue11704) and the tests updated accordingly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12428 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14064] collections module imported twice in urllib/parse.py
New submission from Bithin A bithin2...@gmail.com: In urllib/parse.py the collections module is imported twice which is against the PEP8-- Style Guide for Python Code. -- components: Library (Lib) files: multiple_imports.patch keywords: patch messages: 153780 nosy: Bithin.A priority: normal severity: normal status: open title: collections module imported twice in urllib/parse.py Added file: http://bugs.python.org/file24577/multiple_imports.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14064] collections module imported twice in urllib/parse.py
Changes by Bithin A bithin2...@gmail.com: -- type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6884] Impossible to include file in sdist that starts with 'build' on Win32
Nadeem Vawda nadeem.va...@gmail.com added the comment: (2.7.2 doesn’t include neither Antoine’s changeset nor mine, right?) Correct; it dates back to June last year, before issue 13193 was filed. Can you reproduce the “include buildout.cfg” bug too? Yes, that problem is present in 2.7.2, but not in the current revision of the 2.7 branch. In 2.7.2, the offending regex is r'^build\.*' (since translate_pattern() uses os.path.join, and doesn't escape the separator), whereas in 2.7-head the regex is r'^build/.*' (using a hardcoded /). 2.7-head with your patch applied gives r'^build\\.*' (the correct value). In this case (unlike #9691 and #14004), the problem was fixed by the changes in issue 13193, since the offending code is in the if prefix is not None: codepath of translate_pattern(), rather than in glob_to_re(). While we're talking about translate_pattern(), I have a question about this line: pattern_re = ^%s/.*%s % (prefix_re, pattern_re) It seems that if you specify both a prefix and a (nonempty) pattern, the resulting regexp is something like PREFIX/.*PATTERN, using the pattern argument as a suffix. Is this the intended behavior? I would have expected something like PREFIX/(.*/)?PATTERN, defaulting to PREFIX/.* if pattern is empty. For example, it seems wrong that recursive-include foo bar.* matches foo/test_bar.py. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6884 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14052] importlib mixes up '.' and os.getcwd()
Antoine Pitrou pit...@free.fr added the comment: There was the following sporadic buildbot failure: == FAIL: test_package___file__ (test.test_imp.PEP3147Tests) -- Traceback (most recent call last): File /srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_imp.py, line 333, in test_package___file__ os.sep.join(('.', 'pep3147', '__init__.py'))) AssertionError: 'pep3147/__init__.py' != './pep3147/__init__.py' - pep3147/__init__.py + ./pep3147/__init__.py ? ++ I wonder if the test suite is playing games and sometimes using importlib :-/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14052 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14064] collections module imported twice in urllib/parse.py
Benjamin Peterson benja...@python.org added the comment: This is perfectly fine the way it is. PEP 8 has nothing to say about it. -- nosy: +benjamin.peterson resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14064] collections module imported twice in urllib/parse.py
Changes by Bithin A bithin2...@gmail.com: Removed file: http://bugs.python.org/file24577/multiple_imports.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14064 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14062] UTF-8 Email Subject problem
Changes by Martin v. Löwis mar...@v.loewis.de: -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14062 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14065] Element should support cyclic GC
New submission from Martin v. Löwis mar...@v.loewis.de: The C implementation of xml.etree.ElementTree.Element needs to support cyclic GC. The attached script demonstrates the lack to support that: in 3.2, the script passes; in 3.3 (7697223df6df) it fails with an AssertionError as the cycle was not cleared. This is an incompatible change from 3.2. -- files: a.py messages: 153784 nosy: loewis priority: normal severity: normal status: open title: Element should support cyclic GC versions: Python 3.3 Added file: http://bugs.python.org/file24578/a.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14065 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14065] Element should support cyclic GC
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14065 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14065] Element should support cyclic GC
Changes by Antoine Pitrou pit...@free.fr: -- components: +Library (Lib) nosy: +flox stage: - needs patch type: - behavior versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14065 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14059] Implement multiprocessing.Barrier
sbt shibt...@gmail.com added the comment: Here is an initial implementation. Differences from threading.Barrier: - I have not implemented reset(). - wait() returns 0 or -1. One thread returns 0, the remainder return -1. This is different to threading.Barrier where each of the N threads returns a unique index in range(N). - I added an action_args parameter to the constructor. This is a tuple which provides argument to the action callback. (This is because closures are not picklable, making no-argument callbacks rather limiting for multiprocessing.) -- nosy: +sbt Added file: http://bugs.python.org/file24579/barrier.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14059 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14059] Implement multiprocessing.Barrier
sbt shibt...@gmail.com added the comment: barrier_tests.py contains minor modifications of the unit tests for threading.Barrier. (The two tests using reset() are commented out.) The implementation passes for me on Linux and Windows. -- Added file: http://bugs.python.org/file24580/barrier_tests.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14059 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13447] Add tests for some scripts in Tools/scripts
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +francismb type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13447 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14053] Make Tools/scripts/patchcheck.py compatible with mercurial mqueues.
Francisco Martín Brugué franci...@email.de added the comment: Nice feedback ! One question : An alternative approach that solves all three of these problems is to check whether we have any patches applied (using hg qapplied), and if this is the case, then add --rev qbase to the hg status command line. This will list all files added/modified by patches as well as by uncommitted changes. Shouldn't be --rev qparent ? with --rev qbase the first MQ patch applied changes are not listed ... (one wants the changes between qparent and qtip) -- title: Make patchcheck compatible with MQ - Make Tools/scripts/patchcheck.py compatible with mercurial mqueues. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14057] Speedup sysconfig startup
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14057 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14052] importlib mixes up '.' and os.getcwd()
Antoine Pitrou pit...@free.fr added the comment: [...] And I can't reproduce, even when using --randseed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14052 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Brett Cannon br...@python.org added the comment: Antoine, do you think this may have been triggered by your latest patch? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14052] importlib mixes up '.' and os.getcwd()
Brett Cannon br...@python.org added the comment: The test suite does use importlib for some imports as finders from importlib for some packages stick around. I brought this up a way back but people thought it was actually a good idea to let importlib handle imports to stress test it. Anyway, if it can't be reproduced then I don't think this is worth worrying about. As Nick pointed out, everything should be absolute anyway. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14052 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14052] importlib mixes up '.' and os.getcwd()
Changes by Brett Cannon br...@python.org: -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14052 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Antoine Pitrou pit...@free.fr added the comment: Antoine, do you think this may have been triggered by your latest patch? I don't know, perhaps Vinay can bisect to find the offending commit? (I don't have a Mac) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Brett Cannon br...@python.org added the comment: I have a Mac, but I'm heading out the door; I will see if I can diagnose it and fix it tonight or tomorrow (unless someone beats me to it). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13641] decoding functions in the base64 module could accept unicode strings
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset c760bd844222 by Antoine Pitrou in branch 'default': Issue #13641: Decoding functions in the base64 module now accept ASCII-only unicode strings. http://hg.python.org/cpython/rev/c760bd844222 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13641] decoding functions in the base64 module could accept unicode strings
Antoine Pitrou pit...@free.fr added the comment: I've committed issue13641-alternative-v1.patch. I really think practicality beats purity here and, furthermore, there's no associated danger (non-ASCII data is rejected both as bytes and str). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13641] decoding functions in the base64 module could accept unicode strings
Changes by Antoine Pitrou pit...@free.fr: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13641 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14040] Deprecate some of the module file formats
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 42f61304f77d by Antoine Pitrou in branch 'default': Issue #14040: Remove rarely used file name suffixes for C extensions (under POSIX mainly). http://hg.python.org/cpython/rev/42f61304f77d -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14040 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14053] Make Tools/scripts/patchcheck.py compatible with mercurial mqueues.
Nadeem Vawda nadeem.va...@gmail.com added the comment: Shouldn't be --rev qparent ? Yes, that's right. I seem to confuse qbase and qparent often... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14040] Deprecate some of the module file formats
Antoine Pitrou pit...@free.fr added the comment: I've now committed the suffix removal patch with a what's new entry. Thanks! -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14040 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset f4b7ecf8a5f8 by Georg Brandl in branch '3.1': Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime) http://hg.python.org/cpython/rev/f4b7ecf8a5f8 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14066] Crash in imputil.imp.find_module when a *directory* exists with the given name due to double-close of FILE*
New submission from Dave Malcolm dmalc...@redhat.com: $ mkdir some_directory_ending_with_a.py $ python -c import imputil; imputil.imp.find_module('some_directory_ending_with_a') *** glibc detected *** python: double free or corruption (!prev): 0x01589bf0 *** Aborted What's happening is that call_find_module opens fp, and tries to create a PyFileObject from it: 2844 if (fp != NULL) { 2845 fob = PyFile_FromFile(fp, pathname, fdp-mode, fclose); 2846 if (fob == NULL) { 2847 fclose(fp); 2848 return NULL; 2849 } 2850 } The call fails at the very end of fill_file_fields() inside the call to dircheck() here: 180 f-f_fp = fp; 181 f = dircheck(f); 182 return (PyObject *) f; 183 } 184 but f-fp == fp Hence when fill_file_fields returns NULL, and f is cleaned up here: 484 if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { 485 Py_DECREF(f); 486 Py_DECREF(o_name); 487 return NULL; 488 } then f-fp is closed within file_dealloc() Then, when PyFile_FromFile returns NULL, call_find_module calls fclose(fp): 2844 if (fp != NULL) { 2845 fob = PyFile_FromFile(fp, pathname, fdp-mode, fclose); 2846 if (fob == NULL) { 2847 fclose(fp); 2848 return NULL; 2849 } 2850 } and it attempts to close fp for the second time. The documentation for PyFile_FromFile: http://docs.python.org/c-api/file.html#PyFile_FromFile says: Return NULL and close the file using close on failure. It therefore looks like call_find_module's fclose(fp) is incorrect here, and is what leads to the double-free. -- components: Library (Lib) messages: 153799 nosy: dmalcolm priority: normal severity: normal status: open title: Crash in imputil.imp.find_module when a *directory* exists with the given name due to double-close of FILE* type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14066 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Ned Deily n...@acm.org added the comment: The first bad revision is: changeset: 75048:bbaab666e6c7 parent: 75045:5b4b70bd2b6f user:Antoine Pitrou solip...@pitrou.net date:Mon Feb 20 01:48:16 2012 +0100 summary: Issue #14043: Speed up importlib's _FileFinder by at least 8x, and add a new importlib.invalidate_caches() function. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14066] Crash in imputil.imp.find_module when a *directory* exists with the given name due to double-close of FILE*
Dave Malcolm dmalc...@redhat.com added the comment: Duplicate of issue 7732 -- resolution: - duplicate status: open - closed superseder: - imp.find_module crashes Python if there exists a directory named __init__.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14066 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 4a31f6b11e7a by Georg Brandl in branch '3.2': Merge from 3.1: Issue #13703: add a way to randomize the hash values of basic types (str, bytes, datetime) http://hg.python.org/cpython/rev/4a31f6b11e7a -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Antoine Pitrou pit...@free.fr added the comment: Can you please try this patch? -- assignee: brett.cannon - keywords: +patch Added file: http://bugs.python.org/file24581/impcasing.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Ned Deily n...@acm.org added the comment: With impcasing.patch applied, test_importlib passes on OS X (10.7 with case-insensitive fs). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 3297dcdad196 by Antoine Pitrou in branch 'default': Issue #14063: fix test_importlib failure under OS X case-insensitive filesystems http://hg.python.org/cpython/rev/3297dcdad196 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14063] test_importlib failure on Mac OS X
Antoine Pitrou pit...@free.fr added the comment: Ok, thanks for testing! -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14063 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14060] Implement a CSP-style channel
Martin v. Löwis mar...@v.loewis.de added the comment: I think zero-sized queues are exactly the right answer here. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14060 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14053] Make Tools/scripts/patchcheck.py compatible with mercurial mqueues.
Francisco Martín Brugué franci...@email.de added the comment: The patch is updated. Notice about: [...]Ideally, it should distinguish between this and other errors by checking the subprocess's stderr, so that if a different error occurs, we can still print out the error message. […] that should be improved as now stderr is ignored in 'mq_changed_files' (user case: 'no mq extension enabled'). Suggestions are welcome! [..] but this is a bit orthogonal. IMHO the MQ feature works very well for pydev newbies (as I'm) and it's a good recommendation (it's a taste thing ...) The easiest thing to do is to make some changes and use hg diff patch.diff and the devguide should advertise this IMHO. This also works fine with `make patchcheck`. There is some small differences between diff, qdiff and status but if one uses MQ then diff isn't enough. One really wants to know the changes from qparent to qtip and using 'status' as proposed I thing that it's the best solution. Cheers, francis -- Added file: http://bugs.python.org/file24582/issue14053_1f9461ef6312.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
New submission from Antoine Pitrou pit...@free.fr: This is an experimental patch that limits the frequency of stat() calls in _FileFinder.find_module(). It speeds up finding modules by 2x here, but unfortunately breaks some tests (which expect modules to appear immediately when created). -- components: Library (Lib) files: imptime.patch keywords: patch messages: 153809 nosy: brett.cannon, ncoghlan, pitrou priority: low severity: normal status: open title: Avoid more stat() calls in importlib type: performance versions: Python 3.3 Added file: http://bugs.python.org/file24583/imptime.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic
Martin v. Löwis mar...@v.loewis.de added the comment: The patch is fairly incomplete: it assumes that the compiler supports __attribute__((visibility())), but it really needs to check for that. Also, there is no chance that this can go into Python 2.7; retargetting for 3.3. -- versions: +Python 3.3 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10112 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10112 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13447] Add tests for some scripts in Tools/scripts
Francisco Martín Brugué franci...@email.de added the comment: +1 while working on #issue14053 I missed the test for the scripts (in this case some kind of mocking is needed). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13447 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13405] Add DTrace probes
Dave Malcolm dmalc...@redhat.com added the comment: jcea: BTW, will you be at PyCon US this year? if so, can we sprint on getting the DTrace and SystemTap hooks into CPython in some form acceptable to the rest of the CPython maintainers? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13405 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
Changes by Antoine Pitrou pit...@free.fr: Added file: http://bugs.python.org/file24584/imptime.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
Changes by Antoine Pitrou pit...@free.fr: Removed file: http://bugs.python.org/file24583/imptime.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14053] Make Tools/scripts/patchcheck.py compatible with mercurial mqueues.
Nadeem Vawda nadeem.va...@gmail.com added the comment: Hmm... it looks like mq_changed_files() duplicates a chunk of logic from the existing changed_files() code. You can get rid of this redundancy by replacing mq_changed_files() with a function that checks for applied MQ patches; let's call it mq_patches_applied(). Then you can say: if mq_patches_applied(): cmd += ' --rev qparent' before the call to Popen in changed_files(), and leave the rest of the function unmodified. The basic logic that the code will follow is this: if MQ patches applied: return files listed by 'hg status --added --modified --no-status --rev qparent' else: return files listed by 'hg status --added --modified --no-status' The mq_patches_applied() function can be implemented by running 'hg qapplied' and checking whether it (a) prints at least one patch name, (b) prints out nothing, or (c) gives an error. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
Brett Cannon br...@python.org added the comment: The patch uses the time module which is not a built-in, so it breaks bootstrapping by directly importing a module, and an extension at that. At best you could switch to a modified _FileFinder after importlib is initially running and able to import extension modules. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
Antoine Pitrou pit...@free.fr added the comment: The patch uses the time module which is not a built-in, so it breaks bootstrapping by directly importing a module, and an extension at that. At best you could switch to a modified _FileFinder after importlib is initially running and able to import extension modules. Yup, as I said it's more of a proof-of-concept. (I was actually surprised that time is not a built-in module) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14067] Avoid more stat() calls in importlib
Brett Cannon br...@python.org added the comment: On Mon, Feb 20, 2012 at 18:06, Antoine Pitrou rep...@bugs.python.orgwrote: Antoine Pitrou pit...@free.fr added the comment: The patch uses the time module which is not a built-in, so it breaks bootstrapping by directly importing a module, and an extension at that. At best you could switch to a modified _FileFinder after importlib is initially running and able to import extension modules. Yup, as I said it's more of a proof-of-concept. (I was actually surprised that time is not a built-in module) Yeah, I had to double-check myself. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14067 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13703] Hash collision security issue
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset ed76dc34b39d by Georg Brandl in branch 'default': Merge 3.2: Issue #13703 plus some related test suite fixes. http://hg.python.org/cpython/rev/ed76dc34b39d -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13703 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14053] Make patchcheck work with MQ
Changes by Éric Araujo mer...@netwok.org: -- title: Make Tools/scripts/patchcheck.py compatible with mercurial mqueues. - Make patchcheck work with MQ ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14062] UTF-8 Email Subject problem
Changes by Éric Araujo mer...@netwok.org: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14062 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13447] Add tests for some scripts in Tools/scripts
Éric Araujo mer...@netwok.org added the comment: I’m pushing this higher on my todo list then. I’ll certainly upload a patch for review here with the basic machinery, then commit it, and then we’ll be able to add tests for the tools we like. -- assignee: - eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13447 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14034] Add argparse howto
Éric Araujo mer...@netwok.org added the comment: Nice. I’ll find time to review later; Steven, do you have objections on the idea of adding an argparse howto? Do you want to review it yourself? -- nosy: +bethard title: first example in argparse doc is too complicated - Add argparse howto ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14034 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14047] UTF-8 Email Header
Éric Araujo mer...@netwok.org added the comment: I had written a message which read much like Martin’s and wanted to reopen this report, but apparently my flaky connection did not let it go through and now it’s lost. My apologies for not understanding your report for what it was, and thanks for persevering. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14047 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14050] Tutorial, list.sort() and items comparability
Éric Araujo mer...@netwok.org added the comment: Nope, the expression would be hyphenated only when used as an adjective: - “This sorts the sequence in place” vs. ‑ “Performs an in-place rearrangement by birthdate” -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14050 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14053] Make patchcheck work with MQ
Francisco Martín Brugué franci...@email.de added the comment: Updated. Interesting: I saw that repetition but due “[…] Ideally, it should distinguish between this and other errors by checking the subprocess's stderr, so that if a different error occurs, we can still print out the error message. […]” I just wanted to keep cmd's separated first :-) Let me know what can be done … Cheers, francis -- Added file: http://bugs.python.org/file24585/issue14053_3297dcdad196.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1521950] shlex.split() does not tokenize like the shell
Éric Araujo mer...@netwok.org added the comment: This time you should have received an email from Rietveld, I made sure that your ID was expanded to an email address. I like all the suggestions you made in reply to my comments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1521950 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com