SQLObject 1.6.1
Hello! I'm pleased to announce version 1.6.1, the first bugfix release of branch 1.6 of SQLObject. What's new in SQLObject === * Allow unicode in .orderBy(u'-column'). Contributor for this release is Andrew Trusty. For a more complete list, please see the news: http://sqlobject.org/News.html What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject == Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: https://pypi.python.org/pypi/SQLObject/1.6.1 News and changes: http://sqlobject.org/News.html Oleg. -- Oleg Broytmanhttp://phdru.name/p...@phdru.name Programmers don't die, they just GOSUB without RETURN. -- https://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: 403 forbidden error
On Monday, October 27, 2014 11:05:04 AM UTC+5:30, Chris Angelico wrote: On Mon, Oct 27, 2014 at 4:12 PM, Diya Rai diyar...@gmail.com wrote: This is the part of the code which im trying to execute. We are trying to load test a web application through python script, currently checking the login part. Does it work when you log in using a web browser? If so, grab a browser with debugging facilities (Firefox with Firebug, or Chrome with its F12 box, or something), do the login, and have a look at exactly what request headers are being sent. Then compare with what your script is doing. Once you have the two side by side, you can progressively work through it until you figure out which header makes the difference - maybe your script isn't sending Host, or maybe you need a cookie from a previous request, or maybe it's actually checking the Referer and rejecting if it isn't right. Could be all sorts of things. Good luck! Might be a tedious job, or might be the first thing you try. ChrisA Thanks a lot ChrisA It works fine while logging in through browser. Im using firefox, and have checked the headers with firebug. I tried passing all the headers and it works while passing the cookie header. My question is whether is it the correct way to try or can i write python script in such a way that it can handle it automatically. Currently for checking login page, it would be fine.But when we go for testing registration page it become tedious. I would also like to get your opinion on load testing with python script. Thanks in advance, Diya -- https://mail.python.org/mailman/listinfo/python-list
Re: XML Patch
Hi, please keep this on-list. Nicholas Cole schrieb am 26.10.2014 um 22:43: On Sun, Oct 26, 2014 at 6:30 PM, Stefan Behnel wrote: Nicholas Cole schrieb am 26.10.2014 um 18:00: I'm looking for a python library that can parse XML Documents and create xml-aware diff files, and then use those to patch documents. In other words, I'd like something similar to the Google diff-match-patch tools, but something which is XML aware. I can see several projects on Pypi that can generate some form of xml diff, but I can't seem to see anything that can also do the patching side of things. Is there a use case for this? Yes - I want to store a series of XML diffs/patches and be able to generate documents by applying them. Could you be a little more specific? There are lots of ways to generate XML, but I never heard of anyone who wanted to do this based on diffs between other documents. What kind of document differences are you talking about here? Stefan -- https://mail.python.org/mailman/listinfo/python-list
Re: XML Patch
On Mon, Oct 27, 2014 at 7:28 AM, Stefan Behnel stefan...@behnel.de wrote: Hi, please keep this on-list. Sorry about that. Wrong button! [snip] Yes - I want to store a series of XML diffs/patches and be able to generate documents by applying them. Could you be a little more specific? There are lots of ways to generate XML, but I never heard of anyone who wanted to do this based on diffs between other documents. What kind of document differences are you talking about here? I don't think the specific documents matter, and I don't think it's a unique use-case. Here's Microsoft talking about XML diff and patching (including a hypothetical example): http://msdn.microsoft.com/en-gb/library/aa302294.aspx There's a tool here to do it: http://xmlpatch.sourceforge.net I'd just really like to be able to do something similar in Python. Best wishes, N. -- https://mail.python.org/mailman/listinfo/python-list
Re: (test) ? a:b
Mark Lawrence breamore...@yahoo.co.uk a écrit dans le message de news:mailman.15070.1413978605.18130.python-l...@python.org... Also would you please access this list via https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. Hi I read the last document but it seems that it is intended for those who post messages through Google Groups. I am using a usenet client so i should not be affected It seems that he double blank lines spacing comes from buscacio, not me regards -- https://mail.python.org/mailman/listinfo/python-list
Callback functions arguments
Hi In this web site at example n°5 http://fsincere.free.fr/isn/python/cours_python_tkinter.php A program is using the Scale widget from tkinter module. Here is a piece of code: Valeur = StringVar() echelle = Scale(Mafenetre, from_=-100, to=100, resolution=10, \ orient=HORIZONTAL, length=300, width=20, label=Offset, \ tickinterval=20, variable=Valeur, command=maj) The maj callback function is: def maj(nouvelleValeur): print(nouvelleValeur) When the user move the scale with the mouse, the new position is supposed to be printed on the python shell. The maj function has an argument nouvelleValeur but no argument is passed through the Scale widget. So how the hell Python knows that it has to pass parameter Valeur to the maj function ? thx -- https://mail.python.org/mailman/listinfo/python-list
asyncio: setting file permissions of a Unix socket?
Hi! :) I'm using the asyncio.Protocol interface to build a server which binds to a unix socket file. I want other system users to connect to the unix socket, so to communicate with the server. Where should I set the permissions of the file? The problem is that the socket file is created when the programs starts listening for the connections. Because of this, I can't change the file permission before a connection is made. At the same time, a connection can't happen because of the file permissions. Currently, I workaround this with os.umask(0o000). But I also want to make other files later with default permissions. So I have to revert the umask, but where? I can only do this in the client connection code, which is out of place. Bellow is what I've done. Can you suggest a better way? I wish to avoid permission fixing code like os.umask() for every connection. Maybe I shouldn't use asyncio.Protocol in the first place? Thank you! :) Example code: #! /usr/bin/env python3 import os import asyncio class ExampleServer(asyncio.Protocol): def __init__(self): os.umask(0o002)# This is my workaround. Can I avoid this? # if not umask_restored: # An alternative workaround. # os.umask(0o002) def connection_made(self, transport): self.transport = transport def data_received(self, data): print(Data: , data) self.transport.write(bOK, bye!\n) self.transport.close() def main(): socket_filepath = /tmp/example-server.socket loop = asyncio.get_event_loop() server_coroutine = loop.create_unix_server(ExampleServer, socket_filepath) server = loop.run_until_complete(server_coroutine) os.umask(0o000) # This is my workaround. try: loop.run_forever() except KeyboardInterrupt: print(exit) finally: server.close() loop.close() os.remove(socket_filepath) if __name__ == __main__: main() -- https://mail.python.org/mailman/listinfo/python-list
Re: Callback functions arguments
ast wrote: Hi In this web site at example n°5 http://fsincere.free.fr/isn/python/cours_python_tkinter.php A program is using the Scale widget from tkinter module. Here is a piece of code: Valeur = StringVar() echelle = Scale(Mafenetre, from_=-100, to=100, resolution=10, \ orient=HORIZONTAL, length=300, width=20, label=Offset, \ tickinterval=20, variable=Valeur, command=maj) The maj callback function is: def maj(nouvelleValeur): print(nouvelleValeur) When the user move the scale with the mouse, the new position is supposed to be printed on the python shell. The maj function has an argument nouvelleValeur but no argument is passed through the Scale widget. So how the hell Python knows that it has to pass parameter Valeur to the maj function ? Python doesn't know it has to pass an argument, it just does it. Change the callback to def maj(): print(no args) and you'll get an error. If I were to guess echelle = Scale(Mafenetre, from_=-100, to=100, resolution=10, \ orient=HORIZONTAL, length=300, width=20, label=Offset, \ tickinterval=20, variable=Valeur, command=maj) you probably are misled by the 'command=maj' part in the above line. This means that the function is passed and is different from command=maj() where the *result* of the function is passed. Here's a self-contained example that may clear things up for you: def call_them(one, two): ... one(1) ... two(2, 3) ... def square(a): ... print(a, *, a, =, a*a) ... def product(a, b): ... print(a, *, b, =, a*b) ... call_them(square, product) 1 * 1 = 1 2 * 3 = 6 call_them(product, product) Traceback (most recent call last): File stdin, line 1, in module File stdin, line 2, in call_them TypeError: product() missing 1 required positional argument: 'b' call_them() expects that one() takes 1 argument and two() takes 2 arguments. If the user passes a function that expects a different number of arguments a TypeError is raised. -- https://mail.python.org/mailman/listinfo/python-list
Re: (test) ? a:b
Michael Torrie wrote: As far as I can tell, no BASIC dialect I've looked at (DOS and Linux worlds only), has ever had any logical operators like AND (), OR (||), and NOT (!). They only appear to have bitwise operators (,|,~ C equivalent). The fact that comparison operators returned 0 and -1 made the bitwise operators function the same as logical. Applesoft used 0 and 1, so its NOT definitely wasn't bitwise on the whole number. I can't remember what its AND and OR did for numbers other than 0 or 1 (if I even thought to try it), but since it did all arithmetic in floating point, I suspect they were logical rather than bitwise. -- Greg -- https://mail.python.org/mailman/listinfo/python-list
Re: Callback functions arguments
- Original Message - From: ast nom...@invalid.com To: python-list@python.org Sent: Monday, 27 October, 2014 9:16:26 AM Subject: Callback functions arguments Hi In this web site at example n°5 http://fsincere.free.fr/isn/python/cours_python_tkinter.php A program is using the Scale widget from tkinter module. Here is a piece of code: Valeur = StringVar() echelle = Scale(Mafenetre, from_=-100, to=100, resolution=10, \ orient=HORIZONTAL, length=300, width=20, label=Offset, \ tickinterval=20, variable=Valeur, command=maj) The maj callback function is: def maj(nouvelleValeur): print(nouvelleValeur) When the user move the scale with the mouse, the new position is supposed to be printed on the python shell. The maj function has an argument nouvelleValeur but no argument is passed through the Scale widget. So how the hell Python knows that it has to pass parameter Valeur to the maj function ? thx The Scale object is performing the call, hence it will be the Scale object that will call your maj function with a nouvelleValeur parameter. When you write command=maj, you pass the function, but you don't call it. That's the purpose of a callback. You provide a function and it get called by the object you've been giving the function to. The Scale object should be documented and should provide with the callback signature. See http://effbot.org/zone/tkinter-callbacks.htm JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: asyncio: setting file permissions of a Unix socket?
Martin wrote: I'm using the asyncio.Protocol interface to build a server which binds to a unix socket file. I want other system users to connect to the unix socket, so to communicate with the server. Where should I set the permissions of the file? You should start the demon with a strict umask and set the permissions after the socket is created. Deriving from SocketServer.UnixStreamServer I'm overriding the server_bind() method: class MyServer(SocketServer.UnixStreamServer): [..] def server_bind(self): Override server_bind to set socket options. self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) self.socket.settimeout(SOCKET_TIMEOUT) try: os.unlink(self.server_address) except OSError: if os.path.exists(self.server_address): raise SocketServer.UnixStreamServer.server_bind(self) os.chmod(self.server_address,int(SOCKET_PERMISSIONS,8)) return # server_bind() Ciao, Michael. -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
- Original Message - From: Seymore4Head Seymore4Head@Hotmail.invalid To: python-list@python.org Sent: Monday, 27 October, 2014 3:27:18 AM Subject: Classes and the command line I am trying to learn classes. I am currently using Python 2.7 at the command line. If you try to type commands at the command line and make the slightest mistake you have to start over. I was trying to copy and paste these instructions into the command prompt. http://en.wikibooks.org/wiki/Python_Programming/Classes class Foo: ... def setx(self, x): ... self.x = x ... def bar(self): ... print self.x There is really no way to do that without pasting line by line is there and adding deleting spaces? And if you use spaces and tabs, they are not the same. You could use Ipython http://ipython.org/, if you're familiar with the python shell you won't get lost as it's quite the same with a lot of features added. One of them is the %paste magic function, it will paste your clipboard taking care of the indentation for you. JM -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
On Sun, 26 Oct 2014 23:32:08 -0400, Seymore4Head wrote: On Mon, 27 Oct 2014 14:06:11 +1100, Ben Finney ben+pyt...@benfinney.id.au wrote: Seymore4Head Seymore4Head@Hotmail.invalid writes: I am trying to learn classes. I am currently using Python 2.7 at the command line. (I think you mean the interactive Python interpreter, or just the Python shell.) Since you are learning Python, I will strongly recommend you ignore Python 2 unless it becomes unavoidable. At the moment, it is unavoidable. The instructors are teaching Python 2 so I have to learn Python 2, for now. Instead, learn Python 3 primarily; it is much better because it omits a bunch of legacy behaviour you don't need. If you try to type commands at the [interactive shell] and make the slightest mistake you have to start over. Right. There is line-by-line history, and editing enabled with the readline plug-in. (This is an advantage of using a programmer- friendly operating system, which MS Windows sadly is not.) I was trying to copy and paste these instructions into the [interactive Python shell]. http://en.wikibooks.org/wiki/Python_Programming/Classes class Foo: ... def setx(self, x): ... self.x = x ... def bar(self): ... print self.x There is really no way to do that without pasting line by line is there and adding deleting spaces? And if you use spaces and tabs, they are not the same. Right on all counts. The interactive Python shell is good for very quickly experimenting and demonstrating how Python actually behaves, statement by statement. But as you point out, it is not a good choice for anything more complex. It is a good learning and debugging tool. When you start to write larger units of code, like a class or a function, you can trade immediacy for flexibility: write your code into a text editor, save it to a file foo.py, then run that code at a separate OS command prompt by invoking python foo.py in the terminal. That way, you can continue to adjust and tweak the code as you learn how your changes affect the code. You do need to keep invoking the actions separately edit the file, save the file, run the file with Python but this is what's needed when you want to run a program more than once anyway, so it's a good step to take. Find a good, *general-purpose* programmer's editor. Preferably licensed under free software terms, with a strong community supporting it, and available on all major platforms for when you switch to a decent programmer-friendly operating system. I am actually using Notepad some too. Thanks notepad is not a programmer friendly editor personally I like Geany as it is nice and basic but still offers a lot of programmer friendly features such as syntax highlighting, a small terminal window which I use to run the interactive terminal for testing quick one-liners pressing f5 will save run the current file being edited. www.geany.org Notepad+ is also often suggested along with many other programmer editors/ Integrated development environments (IDE). I would advise you keep away from the more complex IDE's for now as you do not want to overload your learning requirements. -- Who the mad would destroy, first they make Gods. -- Bernard Levin -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
On Mon, Oct 27, 2014 at 10:17 PM, alister alister.nospam.w...@ntlworld.com wrote: Notepad+ is also often suggested along with many other programmer editors/ Integrated development environments (IDE). That would be Notepad++, and yes, it's fairly well recommended. It's based on the same edit component as SciTE, another good editor (and the one I use). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
Roy Smith wrote: Yes and no. If something goes wrong in a .write() method, is not Python supposed to raise an error? (!) Define wrong. It is not an error for a write() call to consume fewer bytes than were requested. It's not? I'm asking a genuine question here, not a rhetorical one. I would expect that if I ask to write 2 bytes, and only 1 byte is written, that absolutely is an error. Under what circumstances is it okay for write() to throw data away? How would you expect this to be handled in Python? Raise DataPartiallyWrittenError? I would expect it to raise an IOError, most likely with one of the following error codes: * errno.EIO (physical input/output error) * errno.EFBIG (file is too large) * errno.ENOSPC (no space left on device, disk is full) -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
On Mon, Oct 27, 2014 at 10:30 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Roy Smith wrote: Yes and no. If something goes wrong in a .write() method, is not Python supposed to raise an error? (!) Define wrong. It is not an error for a write() call to consume fewer bytes than were requested. It's not? I'm asking a genuine question here, not a rhetorical one. I would expect that if I ask to write 2 bytes, and only 1 byte is written, that absolutely is an error. Under what circumstances is it okay for write() to throw data away? How would you expect this to be handled in Python? Raise DataPartiallyWrittenError? I would expect it to raise an IOError, most likely with one of the following error codes: * errno.EIO (physical input/output error) * errno.EFBIG (file is too large) * errno.ENOSPC (no space left on device, disk is full) You're assuming the condition, whatever it is, is permanent. The most common reason for write() to be temporarily unable to write everything is a non-blocking socket, pipe, or somesuch. It writes as much as it can, tells you how much that is, and lets you buffer the rest or deal with it in whatever other way you choose. If it is permanent, though, then yes, it should tell you. But what if you ask it to write a megabyte, it writes half of it, and then finds that there's no space on the disk? Should it: 1) Back out the write and raise an exception? 2) Write part of the data and raise an exception? 3) Write part of the data and NOT raise an exception? All three make sense. The third one is an option only if it's documented as being able to tell you about partial writes. The second has a problem in that you can't necessarily communicate this is how much I wrote properly while also signalling the exception (imagine if one function calls write() more than once, and it doesn't catch any exceptions, just lets them bubble up). And backing out a write isn't always possible. So what's to do? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: id == vs is
In article mailman.15221.1414379336.18130.python-l...@python.org, Cameron Simpson c...@zip.com.au wrote: The is test is more direct and less subject to iffiness because the longer expression using id() leaves more scope/time for things to change, and of course id itself can be rebound to something weird. Not to mention that Python is case-sensitive and in the code as presented by the OP: Id(x) == id(y) those are two different functions :-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
In article 544e2cf2$0$13009$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Roy Smith wrote: Yes and no. If something goes wrong in a .write() method, is not Python supposed to raise an error? (!) Define wrong. It is not an error for a write() call to consume fewer bytes than were requested. It's not? I'm asking a genuine question here, not a rhetorical one. I would expect that if I ask to write 2 bytes, and only 1 byte is written, that absolutely is an error. Under what circumstances is it okay for write() to throw data away? It's not throwing away data. The write() call returns a count of how many bytes is consumed, so you can present the rest of them again in a later write() call (assuming that makes sense to do for your application). In some cases, the underlying hardware (or network protocol) may be unable to handle the number of bytes you requested, or may fail in mid-transmission. Imagine a serial link. You tell it to write 100 bytes. It starts sending them down the line and after 20 bytes, the connection fails. What should write() do in that case? It hasn't written all the data, so it needs to let you know that. It also has written *some* of the data, so it needs to let you know that too. What you do with that information is up to you, but it clearly needs to return a richer status indication than just success/failure. -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
On Sun, 26 Oct 2014 23:32:08 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: On Mon, 27 Oct 2014 14:06:11 +1100, Ben Finney ben+pyt...@benfinney.id.au wrote: Seymore4Head Seymore4Head@Hotmail.invalid writes: I am trying to learn classes. I am currently using Python 2.7 at the command line. (I think you mean the interactive Python interpreter, or just the Python shell.) Since you are learning Python, I will strongly recommend you ignore Python 2 unless it becomes unavoidable. At the moment, it is unavoidable. The instructors are teaching Python 2 so I have to learn Python 2, for now. Instead, learn Python 3 primarily; it is much better because it omits a bunch of legacy behaviour you don't need. If you try to type commands at the [interactive shell] and make the slightest mistake you have to start over. Right. There is line-by-line history, and editing enabled with the readline plug-in. (This is an advantage of using a programmer-friendly operating system, which MS Windows sadly is not.) I was trying to copy and paste these instructions into the [interactive Python shell]. http://en.wikibooks.org/wiki/Python_Programming/Classes class Foo: ... def setx(self, x): ... self.x = x ... def bar(self): ... print self.x There is really no way to do that without pasting line by line is there and adding deleting spaces? And if you use spaces and tabs, they are not the same. Right on all counts. The interactive Python shell is good for very quickly experimenting and demonstrating how Python actually behaves, statement by statement. But as you point out, it is not a good choice for anything more complex. It is a good learning and debugging tool. When you start to write larger units of code, like a class or a function, you can trade immediacy for flexibility: write your code into a text editor, save it to a file foo.py, then run that code at a separate OS command prompt by invoking python foo.py in the terminal. That way, you can continue to adjust and tweak the code as you learn how your changes affect the code. You do need to keep invoking the actions separately edit the file, save the file, run the file with Python but this is what's needed when you want to run a program more than once anyway, so it's a good step to take. Find a good, *general-purpose* programmer's editor. Preferably licensed under free software terms, with a strong community supporting it, and available on all major platforms for when you switch to a decent programmer-friendly operating system. I am actually using Notepad some too. Thanks I meant Notepad ++ -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
On 2014-10-25, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: It may be rare to use an expression both for its side-effects and its return value, It's actually quite common. For example: f = open(filename) d = f.readline() In both of those lines, the side effects and return values are equally vital. The same applies to reading from a queue, popping from a stack, etc. -- Grant Edwards grant.b.edwardsYow! This PORCUPINE knows at his ZIPCODE ... And he has gmail.comVISA!! -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
On 2014-10-27, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Roy Smith wrote: Yes and no. If something goes wrong in a .write() method, is not Python supposed to raise an error? (!) Define wrong. It is not an error for a write() call to consume fewer bytes than were requested. It's not? I'm asking a genuine question here, not a rhetorical one. No. Under Unix/Posix a write() call may _always_ write fewer bytes than requested. It may be that the device/pipe/file whatever has filled and blocking is disabled. It may be that the device has decided that, at the moment, it can only handle a certain amount of data for some other reason. For example: Let's say you're writing to a network connection that must segment data, and you try to write more than will fit in the current segment. The write() call may fill the segment, send the segment, and refuse the rest of the data -- requiring that you make a subsequent write() with the remaining data (at which point it will start a new segment). Or, it may be because the system call was interrupted by something completely unrelated to your program, the write() call, or the thing to which you're writing [and it was more convenient for whoever wrote the OS to do a partial write than it was to try to resume the write]. If you really want to make sure that all bytes get written, you _must_ put all write() calls in a loop that checks the return value and keeps re-writing any unwritten data. And to answer your next question: yes, Unix application programmers have been complaining about that (perhaps justifiably) since 1970. -- Grant Edwards grant.b.edwardsYow! I have a TINY BOWL in at my HEAD gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Web services from python
What is the best package to use with python 2.6 to access Web services. Is it ZSI? Can anyone recommend a good tutorial, preferably with a sandbox web service? -- https://mail.python.org/mailman/listinfo/python-list
Re: Lazy-evaluation lists/dictionaries
On 2014-10-26, Terry Reedy tjre...@udel.edu wrote: On 10/26/2014 10:14 AM, Jon Ribbens wrote: Is there any better way to do this other than simply re-implementing these types from scratch, emulating all their methods and operations? (i.e. using UserList/UserDict). I was under the impression that that sort of thing was supposed to have gone since Python 2.2 or so. We considered dropping UserDict and UserList for 3.0 but kept them in collections for cases in which subclassing does not work. It seems on further investigation to be hard/impossible to subclass Python classes from C extensions. I've gone with subclassing dict, and reimplementing most of its methods. It helps that I only need it to be read-only. It's a pity there's no protocol for 'dynamic' lists/dicts though. -- https://mail.python.org/mailman/listinfo/python-list
Anyone know the solution
Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. THIS IS THE LIST OF BOY NAMES Jacob Michael Joshua Matthew Daniel Christopher Andrew Ethan Joseph William Anthony David Alexander Nicholas Ryan Tyler James John Jonathan Noah Brandon Christian Dylan Samuel Benjamin Zachary Nathan Logan Justin Gabriel Jose Austin Kevin Elijah Caleb Robert Thomas Jordan Cameron Jack Hunter Jackson Angel Isaiah Evan Isaac Mason Luke Jason Gavin Jayden Aaron Connor Aiden Aidan Kyle Juan Charles Luis Adam Lucas Brian Eric Adrian Nathaniel Sean Alex Carlos Bryan Ian Owen Jesus Landon Julian Chase Cole Diego Jeremiah Steven Sebastian Xavier Timothy Carter Wyatt Brayden Blake Hayden Devin Cody Richard Seth Dominic Jaden Antonio Miguel Liam Patrick Carson Jesse Tristan Alejandro Henry Victor Trevor Bryce Jake Riley Colin Jared Jeremy Mark Caden Garrett Parker Marcus Vincent Kaleb Kaden Brady Colton Kenneth Joel Oscar Josiah Jorge Cooper Ashton Tanner Eduardo Paul Edward Ivan Preston Maxwell Alan Levi Stephen Grant Nicolas Omar Dakota Alexis George Collin Eli Spencer Gage Max Cristian Ricardo Derek Micah Brody Francisco Nolan Ayden Dalton Shane Peter Damian Jeffrey Brendan Travis Fernando Peyton Conner Andres Javier Giovanni Shawn Braden Jonah Cesar Bradley Emmanuel Manuel Edgar Erik Mario Edwin Johnathan Devon Erick Wesley Oliver Trenton Hector Malachi Jalen Raymond Gregory Abraham Elias Leonardo Sergio Donovan Colby Marco Bryson Martin THIS IS THE LIST OF GIRLS NAME Emily Madison Emma Olivia Hannah Abigail Isabella Samantha Elizabeth Ashley Alexis Sarah Sophia Alyssa Grace Ava Taylor Brianna Lauren Chloe Natalie Kayla Jessica Anna Victoria Mia Hailey Sydney Jasmine Julia Morgan Destiny Rachel Ella Kaitlyn Megan Katherine Savannah Jennifer Alexandra Allison Haley Maria Kaylee Lily Makayla Brooke Mackenzie Nicole Addison Stephanie Lillian Andrea Zoe Faith Kimberly Madeline Alexa Katelyn Gabriella Gabrielle Trinity Amanda Kylie Mary Paige Riley Jenna Leah Sara Rebecca Michelle Sofia Vanessa Jordan Angelina Caroline Avery Audrey Evelyn Maya Claire Autumn Jocelyn Ariana Nevaeh Arianna Jada Bailey Brooklyn Aaliyah Amber Isabel Danielle Mariah Melanie Sierra Erin Molly Amelia Isabelle Madelyn Melissa Jacqueline Marissa Shelby Angela Leslie Katie Jade Catherine Diana Aubrey Mya Amy Briana Sophie Gabriela Breanna Gianna Kennedy Gracie Peyton Adriana Christina Courtney Daniela Kathryn Lydia Valeria Layla Alexandria Natalia Angel Laura Charlotte Margaret Cheyenne Mikayla Miranda Naomi Kelsey Payton Ana Alicia Jillian Daisy Mckenzie Ashlyn Caitlin Sabrina Summer Ruby Rylee Valerie Skylar Lindsey Kelly Genesis Zoey Eva Sadie Alexia Cassidy Kylee Kendall Jordyn Kate Jayla Karen Tiffany Cassandra Juliana Reagan Caitlyn Giselle Serenity Alondra Lucy Kiara Bianca Crystal Erica Angelica Hope Chelsea Alana Liliana Brittany Camila Makenzie Veronica Lilly Abby Jazmin Adrianna Karina Delaney Ellie Jasmin -- https://mail.python.org/mailman/listinfo/python-list
Re: Lazy-evaluation lists/dictionaries
On 2014-10-26, Tim Delaney timothy.c.dela...@gmail.com wrote: On 27 October 2014 01:14, Jon Ribbens jon+use...@unequivocal.co.uk wrote: I have a need, in a Python C extension I am writing, for lists and dictionaries with lazy evaluation - by which I mean that at least some of the values in the lists/dictionaries are proxy objects which, rather than returning as themselves, should return the thing they are a proxy for when retrieved. This is because retrieving the proxied objects is expensive and only a small minority of them will actually be accessed, so retrieving them all before they are actually accessed is massively inefficient. Why not put proxy objects into the list/dict? That's precisely what I am doing. The point is that when they are retrieved they need to be resolved into the genuine objects. Have a look at the weakref module for an API that may be suitable for such proxy objects (if you used the same API, that would also allow you to transparently use weakrefs in your lists/dicts). Hmm, the idea behind that appears to be to create a proxy that emulates every possible method of every conceivable type. My method of only emulating the list and dict methods seems to be somewhat simpler for my purpose ;-) -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
Grant Edwards invalid@invalid.invalid: If you really want to make sure that all bytes get written, you _must_ put all write() calls in a loop that checks the return value and keeps re-writing any unwritten data. And to answer your next question: yes, Unix application programmers have been complaining about that (perhaps justifiably) since 1970. I wouldn't have it any other way. Now, I have confused the discussion with some misinformation myself. Python2's file.write() doesn't return a value but pushes the whole string out. Python3's file.write() returns the number of *characters* written. I don't know if the number can ever be different from the total number of characters in the string. In POSIX, a write(2) system call on file blocks until all bytes have been passed on to the file system. The only exception (no pun intended) I know is the reception of a signal. Even then, I'm not sure Linux file systems ever cut writes short because of signals. I think the lack of nonblocking file access in Linux is one of the OS's main shortcomings. Python's sockets and pipes don't have write methods. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Mon, 27 Oct 2014 08:10:04 -0700, emmanueloje wrote: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. Your tutor for a start I think I could probably get one working in an hour or so without too much difficulty. What do you have? we do not do homework for you here. if you have some code that doesn't work as expected we may assist -- semper en excretus -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
2014-10-27 11:10 GMT-04:00 emmanuel...@gmail.com: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. THIS IS THE LIST OF BOY NAMES Jacob Michael Joshua Matthew Daniel Christopher Andrew Ethan Joseph William Anthony David Alexander Nicholas Ryan Tyler James John Jonathan Noah Brandon Christian Dylan Samuel Benjamin Zachary Nathan Logan Justin Gabriel Jose Austin Kevin Elijah Caleb Robert Thomas Jordan Cameron Jack Hunter Jackson Angel Isaiah Evan Isaac Mason Luke Jason Gavin Jayden Aaron Connor Aiden Aidan Kyle Juan Charles Luis Adam Lucas Brian Eric Adrian Nathaniel Sean Alex Carlos Bryan Ian Owen Jesus Landon Julian Chase Cole Diego Jeremiah Steven Sebastian Xavier Timothy Carter Wyatt Brayden Blake Hayden Devin Cody Richard Seth Dominic Jaden Antonio Miguel Liam Patrick Carson Jesse Tristan Alejandro Henry Victor Trevor Bryce Jake Riley Colin Jared Jeremy Mark Caden Garrett Parker Marcus Vincent Kaleb Kaden Brady Colton Kenneth Joel Oscar Josiah Jorge Cooper Ashton Tanner Eduardo Paul Edward Ivan Preston Maxwell Alan Levi Stephen Grant Nicolas Omar Dakota Alexis George Collin Eli Spencer Gage Max Cristian Ricardo Derek Micah Brody Francisco Nolan Ayden Dalton Shane Peter Damian Jeffrey Brendan Travis Fernando Peyton Conner Andres Javier Giovanni Shawn Braden Jonah Cesar Bradley Emmanuel Manuel Edgar Erik Mario Edwin Johnathan Devon Erick Wesley Oliver Trenton Hector Malachi Jalen Raymond Gregory Abraham Elias Leonardo Sergio Donovan Colby Marco Bryson Martin THIS IS THE LIST OF GIRLS NAME Emily Madison Emma Olivia Hannah Abigail Isabella Samantha Elizabeth Ashley Alexis Sarah Sophia Alyssa Grace Ava Taylor Brianna Lauren Chloe Natalie Kayla Jessica Anna Victoria Mia Hailey Sydney Jasmine Julia Morgan Destiny Rachel Ella Kaitlyn Megan Katherine Savannah Jennifer Alexandra Allison Haley Maria Kaylee Lily Makayla Brooke Mackenzie Nicole Addison Stephanie Lillian Andrea Zoe Faith Kimberly Madeline Alexa Katelyn Gabriella Gabrielle Trinity Amanda Kylie Mary Paige Riley Jenna Leah Sara Rebecca Michelle Sofia Vanessa Jordan Angelina Caroline Avery Audrey Evelyn Maya Claire Autumn Jocelyn Ariana Nevaeh Arianna Jada Bailey Brooklyn Aaliyah Amber Isabel Danielle Mariah Melanie Sierra Erin Molly Amelia Isabelle Madelyn Melissa Jacqueline Marissa Shelby Angela Leslie Katie Jade Catherine Diana Aubrey Mya Amy Briana Sophie Gabriela Breanna Gianna Kennedy Gracie Peyton Adriana Christina Courtney Daniela Kathryn Lydia Valeria Layla Alexandria Natalia Angel Laura Charlotte Margaret Cheyenne Mikayla Miranda Naomi Kelsey Payton Ana Alicia Jillian Daisy Mckenzie Ashlyn Caitlin Sabrina Summer Ruby Rylee Valerie Skylar Lindsey Kelly Genesis Zoey Eva Sadie Alexia Cassidy Kylee Kendall Jordyn Kate Jayla Karen Tiffany Cassandra Juliana Reagan Caitlyn Giselle Serenity Alondra Lucy Kiara Bianca Crystal Erica Angelica Hope Chelsea Alana Liliana Brittany Camila Makenzie Veronica Lilly Abby Jazmin Adrianna Karina Delaney Ellie Jasmin -- https://mail.python.org/mailman/listinfo/python-list The answer to you question is Yes. -- Joel Goldstick http://joelgoldstick.com -- https://mail.python.org/mailman/listinfo/python-list
Build Question: How to Add -Wl,--option Before Objects In Setup.py?
I need to add a linker option to the command(s) run by setup.py when building various objects. I'm not familiar with Python at all, so I basically copied and modified a line from one area of the script to another ext_modules=[Extension('_struct', ['_struct.c'], extra_link_args = ['Wl,--allow-shlib-undefined'])], *snip* Unfortunately this seems to append the option to the end of the command line. What's the best (fastest) way to add it before the object being built (objectname.o)? -- https://mail.python.org/mailman/listinfo/python-list
A bug?
I use python 3.4.0 version. In the course of developing / running a python program, I have encountered a problem. I have reproduced below a simple program to bring it out. d = [[0]*3]*4 dd = [1,2,3,4,5,6,7,8,9,10,11,12] for i in range(4): ... for j in range(3): d[i][j] = dd[i*3+j] ... d [[10, 11, 12], [10, 11, 12], [10, 11, 12], [10, 11, 12]] d is not transferred to dd as expected? Of course I can use 'append' do my job (less elegantly though). -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On 10/27/2014 05:01 PM, uma...@gmail.com wrote: I use python 3.4.0 version. In the course of developing / running a python program, I have encountered a problem. I have reproduced below a simple program to bring it out. d = [[0]*3]*4 dd = [1,2,3,4,5,6,7,8,9,10,11,12] for i in range(4): ... for j in range(3): d[i][j] = dd[i*3+j] ... d [[10, 11, 12], [10, 11, 12], [10, 11, 12], [10, 11, 12]] d is not transferred to dd as expected? Of course I can use 'append' do my job (less elegantly though). See https://docs.python.org/3/library/stdtypes.html?highlight=list#common-sequence-operations under Note 2 . Also asked and answered multiple times at stackoverflow, e.g., http://stackoverflow.com/questions/6688223/ -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On Mon, Oct 27, 2014 at 10:17 AM, Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de wrote: See https://docs.python.org/3/library/stdtypes.html?highlight=list#common-sequence-operations under Note 2 . Also asked and answered multiple times at stackoverflow, e.g., http://stackoverflow.com/questions/6688223/ Also see https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list (probably a better resource than that footnote). -- https://mail.python.org/mailman/listinfo/python-list
memory, PE files, etc...
Hi! I'd like to write one or more scripts that analyze processes in memory on Windows 7. I used to do these things in C++ by using native Win32 API calls. How should I proceed in python? Any pointers? -- https://mail.python.org/mailman/listinfo/python-list
Re: memory, PE files, etc...
On 27/10/2014 17:16, kiuhn...@yahoo.it wrote: Hi! I'd like to write one or more scripts that analyze processes in memory on Windows 7. I used to do these things in C++ by using native Win32 API calls. How should I proceed in python? Any pointers? psutil is definitely your friend: https://github.com/giampaolo/psutil Although WMI can be quite handy too, depending on what you're trying to do: http://timgolden.me.uk/python/wmi/ TJG -- https://mail.python.org/mailman/listinfo/python-list
variable attribute name
I want to let the name of an attribute be the string value of a variable. Here is some code: class Object(object): pass A = Object() s = 'attr' A.s = 1 The last line denotes the variable value by s (not a python form). What I want is to have A.attr = 1, but 'attr' determined by the value of s. Please advise. -- https://mail.python.org/mailman/listinfo/python-list
Re: variable attribute name
On Mon, Oct 27, 2014 at 2:23 PM, Harvey Greenberg hjgreenb...@gmail.com wrote: I want to let the name of an attribute be the string value of a variable. Here is some code: class Object(object): pass A = Object() s = 'attr' A.s = 1 The last line denotes the variable value by s (not a python form). What I want is to have A.attr = 1, but 'attr' determined by the value of s. Please advise. setattr(A, s, 1) -- https://mail.python.org/mailman/listinfo/python-list
Re: memory, PE files, etc...
On Monday, October 27, 2014 6:24:19 PM UTC+1, Tim Golden wrote: psutil is definitely your friend: https://github.com/giampaolo/psutil Although WMI can be quite handy too, depending on what you're trying to do: http://timgolden.me.uk/python/wmi/ TJG Thanks for answering. I don't know if psutil is what I'm looking for. What I need to do is more related to debugging than to administration. Let's say I want to search for a sequence of bytes in the .text section of a given module. Can I do that with psutil? Maybe I should buy this book: http://www.amazon.com/Gray-Hat-Python-Programming-Engineers/dp/1593271921 -- https://mail.python.org/mailman/listinfo/python-list
Re: variable attribute name
On 10/27/14 2:32 PM, Larry Martell wrote: On Mon, Oct 27, 2014 at 2:23 PM, Harvey Greenberg hjgreenb...@gmail.com wrote: I want to let the name of an attribute be the string value of a variable. Here is some code: class Object(object): pass A = Object() s = 'attr' A.s = 1 The last line denotes the variable value by s (not a python form). What I want is to have A.attr = 1, but 'attr' determined by the value of s. Please advise. setattr(A, s, 1) Larry's code will work for you. If you are making many attributes like this, you might be better off just using a dictionary in the first place: a = {} a[s] = 1 -- Ned Batchelder, http://nedbatchelder.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
In article CAHu5PrbHSob2r-zOTCtrYiqdudU_q+4mDXOXzp=_rejp7kh...@mail.gmail.com, Cyd Haselton chasel...@gmail.com wrote: I need to add a linker option to the command(s) run by setup.py when building various objects. I'm not familiar with Python at all, so I basically copied and modified a line from one area of the script to another ext_modules=[Extension('_struct', ['_struct.c'], extra_link_args = ['Wl,--allow-shlib-undefined'])], *snip* Unfortunately this seems to append the option to the end of the command line. What's the best (fastest) way to add it before the object being built (objectname.o)? It depends on what system and build tools that you are using and that the Python you are using was built with but, in general on most POSIX-like systems, one way to do it should be to supply it via an LDFLAGS environment variable. The safest approach would be to get the default value of LDFLAGS for this Python instance, append your additional values to it, and pass it back into the setup.py build. You can do that all in one line: LDFLAGS=$(python -c 'import sysconfig;print(sysconfig.get_config_var(LDFLAGS))') -Wl,--allow-shlib-undefined python setup.py build -- Ned Deily, n...@acm.org -- https://mail.python.org/mailman/listinfo/python-list
Re: I am out of trial and error again Lists
Rustom Mody rustompm...@gmail.com writes: What would you say to a person who - Buys a Lambhorgini I'd say: Don't buy a Lambhorgini from that nice guy you met at a party, but buy a Lamborghini by an authorized dealer ;-) -- I was a kid when Lamborghini launched the Miura! -- https://mail.python.org/mailman/listinfo/python-list
different behavior from idle/pycharm and shell
Consider this code: --- from ctypes import * user32 = windll.user32 user32.MessageBoxA(0, 'ok', 'ok', 0) --- If I run it in idle or from pycharm, the messagebox shows 'o' instead of 'ok', but if I run it from shell, it shows 'ok' like it should. The same happens with msvcrt.printf(). Why? -- https://mail.python.org/mailman/listinfo/python-list
Re: different behavior from idle/pycharm and shell
On Monday, October 27, 2014 3:38:31 PM UTC-7, kiuh...@yahoo.it wrote: Consider this code: --- from ctypes import * user32 = windll.user32 user32.MessageBoxA(0, 'ok', 'ok', 0) --- If I run it in idle or from pycharm, the messagebox shows 'o' instead of 'ok', but if I run it from shell, it shows 'ok' like it should. The same happens with msvcrt.printf(). Why? If I had to take a guess, in the shell, it is encoding the string characters as single bytes as expected, but in Idle or PyCharm, it is encoding them as WCHARs, which are two-bytes wide. Two things to try: 1. Change the call to MessageBoxW and see if it works in Idle/PyCharm. Note that this will probably break the call from the shell. 2. Try a string longer than two characters and see what you get. -- https://mail.python.org/mailman/listinfo/python-list
Re: different behavior from idle/pycharm and shell
On 2014-10-27 22:38, kiuhn...@yahoo.it wrote: Consider this code: --- from ctypes import * user32 = windll.user32 user32.MessageBoxA(0, 'ok', 'ok', 0) --- If I run it in idle or from pycharm, the messagebox shows 'o' instead of 'ok', but if I run it from shell, it shows 'ok' like it should. The same happens with msvcrt.printf(). Why? You didn't say whether you're using Python 2 or Python 3, but it looks like you're using Python 3. There are 2 forms of the MessageBox function, one with the suffix 'A', which uses bytestrings, and one with the suffix 'W', which uses Unicode strings. In Python 3, the str class is a Unicode string, so you'll want the MessageBoxW function: from ctypes import * user32 = windll.user32 user32.MessageBoxW(0, 'ok', 'ok', 0) Also, the msvcrt.printf function expects a bytestring. -- https://mail.python.org/mailman/listinfo/python-list
Re: different behavior from idle/pycharm and shell
On Monday, October 27, 2014 11:55:44 PM UTC+1, MRAB wrote: On 2014-10-27 22:38, kiuhnm wrote: Consider this code: --- from ctypes import * user32 = windll.user32 user32.MessageBoxA(0, 'ok', 'ok', 0) --- If I run it in idle or from pycharm, the messagebox shows 'o' instead of 'ok', but if I run it from shell, it shows 'ok' like it should. The same happens with msvcrt.printf(). Why? You didn't say whether you're using Python 2 or Python 3, but it looks like you're using Python 3. There are 2 forms of the MessageBox function, one with the suffix 'A', which uses bytestrings, and one with the suffix 'W', which uses Unicode strings. In Python 3, the str class is a Unicode string, so you'll want the MessageBoxW function: from ctypes import * user32 = windll.user32 user32.MessageBoxW(0, 'ok', 'ok', 0) Also, the msvcrt.printf function expects a bytestring. Yes, you're right. Thank you both. -- https://mail.python.org/mailman/listinfo/python-list
Re: Build Question: How to Add -Wl, --option Before Objects In Setup.py?
On Mon, Oct 27, 2014 at 3:39 PM, Ned Deily n...@acm.org wrote: In article CAHu5PrbHSob2r-zOTCtrYiqdudU_q+4mDXOXzp=_rejp7kh...@mail.gmail.com, Cyd Haselton chasel...@gmail.com wrote: I need to add a linker option to the command(s) run by setup.py when building various objects. I'm not familiar with Python at all, so I basically copied and modified a line from one area of the script to another ext_modules=[Extension('_struct', ['_struct.c'], extra_link_args = ['Wl,--allow-shlib-undefined'])], *snip* Unfortunately this seems to append the option to the end of the command line. What's the best (fastest) way to add it before the object being built (objectname.o)? It depends on what system and build tools that you are using and that the Python you are using was built with but, in general on most POSIX-like systems, one way to do it should be to supply it via an LDFLAGS environment variable. The safest approach would be to get the default value of LDFLAGS for this Python instance, append your additional values to it, and pass it back into the setup.py build. You can do that all in one line: LDFLAGS=$(python -c 'import sysconfig;print(sysconfig.get_config_var(LDFLAGS))') -Wl,--allow-shlib-undefined python setup.py build -- Ned Deily, n...@acm.org I'm building python on an Android device in the KBOX environment...which simulates a Unix type filesystem. Python isn't installed; I'm building from sources (2.7.8) with GCC 4.8.0 and make. The problem with the LDFLAGS approach is that some of the libraries that must be linked (-lc -ldl) do not need the --allow-shlib-undefined option...it's only the lpython2.7 that does. Any way to do this? Cyd Haselton -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On Mon, 27 Oct 2014 08:10:04 -0700, emmanueloje wrote: Write a program that reads the contents of the two files into two separate lists. Yep, know how to do that The user should be able to enter a boy's name, a girl's name or both Yep, know how to do that and the application will display messages indicating whether the names were among the most popular. Nope, not sure how to do that, please define the algorithm for determining a most popular name Determining if the name is in either of the lists is easy, know how to do that, but I'm not sure from your problem description if that's your definition of a most popular name or not. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 28/10/2014 1:10 AM, emmanuel...@gmail.com wrote: Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy's name, a girl's name or both, and the application will display messages indicating whether the names were among the most popular. This is actually a trick question. This is a classic unsolvable problem in computer science, known as the Dual Baskets problem. It is NP-complete, meaning that there is no easy solution. It requires brute-forcing and can take an indefinite period of time to complete, if at all. The correct answer is Not possible. -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On Mon, 27 Oct 2014 09:01:57 -0700, uma...@gmail.com wrote: I use python 3.4.0 version. In the course of developing / running a python program, I have encountered a problem. I have reproduced below a simple program to bring it out. d = [[0]*3]*4 dd = [1,2,3,4,5,6,7,8,9,10,11,12] for i in range(4): ... for j in range(3): d[i][j] = dd[i*3+j] ... d [[10, 11, 12], [10, 11, 12], [10, 11, 12], [10, 11, 12]] d is not transferred to dd as expected? Of course I can use 'append' do my job (less elegantly though). Not sure if this is elegant or not: d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] but it seems to be a one-line solution for what you're trying to do. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On Tuesday, October 28, 2014 6:07:14 AM UTC+5:30, Denis McMahon wrote: On Mon, 27 Oct 2014 09:01:57 -0700, umatrp wrote: I use python 3.4.0 version. In the course of developing / running a python program, I have encountered a problem. I have reproduced below a simple program to bring it out. d = [[0]*3]*4 dd = [1,2,3,4,5,6,7,8,9,10,11,12] for i in range(4): ... for j in range(3): d[i][j] = dd[i*3+j] ... d [[10, 11, 12], [10, 11, 12], [10, 11, 12], [10, 11, 12]] d is not transferred to dd as expected? Of course I can use 'append' do my job (less elegantly though). Not sure if this is elegant or not: d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] but it seems to be a one-line solution for what you're trying to do. Neat More generally for d being a 2-D reshape of dd (which may be anything as long as the size matches) dd = [1,2,3,4,5,6,7,8,9,10,11,12] d=[[dd[i*3+j] for j in range(3)] for i in range(4)] d [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On Tue, Oct 28, 2014 at 12:12 PM, Rustom Mody rustompm...@gmail.com wrote: More generally for d being a 2-D reshape of dd (which may be anything as long as the size matches) dd = [1,2,3,4,5,6,7,8,9,10,11,12] d=[[dd[i*3+j] for j in range(3)] for i in range(4)] d [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] The inner comprehension should surely be a slice: [dd[i*3:i*3+3] for i in range(4)] [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On 28 October 2014 00:36, Denis McMahon denismfmcma...@gmail.com wrote: d = [[list(range(1,13))[i*3+j] for j in range(3)] for i in range(4)] A quick note. Ranges (even 2.7's xrange) are all indexable. The cast to a list isn't needed. -- https://mail.python.org/mailman/listinfo/python-list
Re: A bug?
On Tuesday, October 28, 2014 6:56:10 AM UTC+5:30, Chris Angelico wrote: On Tue, Oct 28, 2014 at 12:12 PM, Rustom Mody wrote: More generally for d being a 2-D reshape of dd (which may be anything as long as the size matches) dd = [1,2,3,4,5,6,7,8,9,10,11,12] d=[[dd[i*3+j] for j in range(3)] for i in range(4)] d [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] The inner comprehension should surely be a slice: [dd[i*3:i*3+3] for i in range(4)] [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]] Sweet! [Something for my class today] Looks even better this way: dd = range(1,13) [dd[i*3:i*3+3] for i in range(4)] [range(1, 4), range(4, 7), range(7, 10), range(10, 13)] In the same vein a transpose: [list(dd[i::3]) for i in range(3)] [[0, 3, 6, 9], [1, 4, 7, 10], [2, 5, 8, 11]] [Not sure why both are 3; no 4's...] -- https://mail.python.org/mailman/listinfo/python-list
Re: memory, PE files, etc...
On Tuesday, October 28, 2014 12:41:40 AM UTC+5:30, kiuh...@yahoo.it wrote: On Monday, October 27, 2014 6:24:19 PM UTC+1, Tim Golden wrote: psutil is definitely your friend: https://github.com/giampaolo/psutil Although WMI can be quite handy too, depending on what you're trying to do: http://timgolden.me.uk/python/wmi/ TJG Thanks for answering. I don't know if psutil is what I'm looking for. What I need to do is more related to debugging than to administration. Let's say I want to search for a sequence of bytes in the .text section of a given module. Can I do that with psutil? https://code.google.com/p/pefile/ ? -- https://mail.python.org/mailman/listinfo/python-list
Re: Status of side-effecting functions in python
On Mon, 27 Oct 2014 17:14:58 +0200, Marko Rauhamaa wrote: In POSIX, a write(2) system call on file blocks until all bytes have been passed on to the file system. The only exception (no pun intended) I know is the reception of a signal. Writing to a file (or block device) will return a short count in the event that it results in the size of the file exceeding * the space available on the partition, * the user's quota, * the process' file size limit (RLIMIT_FSIZE), or * any implementation limit on the maximum size of a file, and at least one byte can be written. This behaviour is mandated by POSIX. This is different to writing to a socket, pipe or character device, where a short count is considered an entirely normal result, and a subsequent write for the remaining bytes will often succeed. Even then, I'm not sure Linux file systems ever cut writes short because of signals. Linux never interrupts I/O on discs or block devices due to signals. These are restarted regardless of whether the signal is set for automatic restarting (SA_RESTART flag). I think the lack of nonblocking file access in Linux is one of the OS's main shortcomings. It doesn't really matter. In the absence of an explicit mlock() or mlockall(), the actual code which would be controlling the access is demand-paged from disc, as is the memory to/from which the data is transferred (along with the memory which would hold the return code from read() or write(), for that matter). Asynchronous I/O in the sense of select(), poll(), O_NONBLOCK etc is meant for situations where delays could be indefinite, e.g. network connections or terminals. For short delays (i.e. disc access), there's not much point having a mechanism so that you can avoid blocking while the data is read from disc just so that you can block while the code in the else branch is read from disc. If you want the program to be able to do something else while waiting for I/O, use threads. The introduction of threads made most concurrency- related issues in the POSIX API moot. -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
On 10/26/2014 11:24 PM, Chris Angelico wrote: On Mon, Oct 27, 2014 at 2:18 PM, Rustom Mody rustompm...@gmail.com wrote: On Monday, October 27, 2014 8:40:48 AM UTC+5:30, Chris Angelico wrote: You can get block-by-block history by using Idle. I find that fairly convenient for manipulating class/function definitions. ChrisA Umm... Nice! A bit inconsistent in that the '...' does not appear. But thats good; makes copy|cut-pasting from interpreter to file a mostly trivial operation. One of the differences between console interpreter and Idle Shell is that the former is line oriented whereas Shell is statement oriented. In the console interpreter, you cannot edit a line after it is entered. In Shell, you can edit any line until you enter an entire statment. Similarly, c. i. history recalls a line at a time. Recalling an multiline statment has to be done a line at a time, in order. Shell history recalls an entire statement, even if multiple lines (this is what Chris means by 'blocks'). Explaining this difference as the reason for no ... is on my todo list. It's inconsistent only because the default sys.ps2 is those dots, which aren't necessary in Idle. You could make it consistent by simply changing sys.ps2. Nope. User code is executed in the user process. Its only effect on the Idle process is to write to stdout or stderr for display. There is tracker issue about letting users change sys.ps1 *in the Idle process*, but it would have to be through the menu or config dialog. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
On 10/26/2014 11:28 PM, Seymore4Head wrote: I am going to be flexible on IDLE in the near future, but I wanted to try it the old fashion way. I already know using IDLE is better, but I am not sure using IDLE will invoke Python 2 and I am not sure how to change that at the moment. Currently, Idle executes user code with the same interpreter it is running on. Now that user code is executed in a subprocess, there is the possibility of using a different python in the subprocess. But this is for the future. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Anyone know the solution
On 10/27/2014 11:10 AM, emmanuel...@gmail.com wrote: THIS IS THE LIST OF BOY NAMES Jacob ... Writing hundreds of unnecessary lines at minimum inconsiderate. Please don't do it. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Classes and the command line
On Tue, Oct 28, 2014 at 3:08 PM, Terry Reedy tjre...@udel.edu wrote: It's inconsistent only because the default sys.ps2 is those dots, which aren't necessary in Idle. You could make it consistent by simply changing sys.ps2. Nope. User code is executed in the user process. Its only effect on the Idle process is to write to stdout or stderr for display. There is tracker issue about letting users change sys.ps1 *in the Idle process*, but it would have to be through the menu or config dialog. I knew that, honest I did... umm, let's just pretend I was talking about changing sys.ps2 in the console interpreter. Yeah. Because I totally knew that changing it in Idle wouldn't work. Plus, I tested it before posting, like everyone should. Honest! Changing it in the console interpreter does work, though. Python 3.5.0a0 (default:301b9a58021c, Oct 2 2014, 09:20:24) [GCC 4.7.2] on linux Type help, copyright, credits or license for more information. import sys sys.ps2= def x(): pass And if you want consistency, that's a good way to get it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[issue22739] There is no disk in the drive error
New submission from Lachlan Kingsford: An error is being raised that 'There is no disk in the drive. Please insert a disk into drive \Device\Harddisk1\DR1. Cancel, Try Again, Continue)'. The line of code referred to has no reference to any file or disk access. None of its calling procedures have any file or disk access. As such, I am fairly confident that the error is not caused by an error in my code. The Python interpreter was embedded via cx_freeze. The embedded interpreter was Win64 running on 64 bit Windows 7. The computer that reported the bug did not have Python installed on it. I have been unable to replicate the bug. Similar bugs have been reported due to USB sticks and phones, but none were plugged in or removed while the program was being run. At this stage, I am unsure if this is a bug with Windows, cx_freeze, or pygame. The bug is also listed on https://github.com/lkingsford/AtlasWarriors/issues/5, with access to the source available. You can view the stack trace and an image of the error, and the stack trace there. I am not sure if this is a known issue but I am unable to find any reference to it. -- components: IO, Windows messages: 230060 nosy: Lachlan.Kingsford, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: There is no disk in the drive error versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22256] pyvenv should display a progress indicator while creating an environment
Vinay Sajip added the comment: It looks as if ensurepip is where changes should happen. The venv code just makes a subprocess.check_output() call to ensurepip, and anything that ensurepip outputs would be displayed on the console. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22256 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22725] improve documentation for enumerate() (built-in function)
Georg Brandl added the comment: next() is quite unlike match() and search(), as you almost never use next() on iterators directly. Rather, the iterator is iterated by constructs like a for loop or a comprehension, or another function that consumes it (list, map, ...) -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22725 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22739] There is no disk in the drive error
Tim Golden added the comment: I very much doubt that this is a Python issue as such. Other things being equal, I would expect Harddisk\DR1 to be a CD-ROM or some other removable disk. Using something like winobj.exe from sysinternals should show what it expects to be on a given machine. It's certainly possible that the machine on which cx_freeze is being used has a permanent D: drive while the corresponding drive on the target machine is removable. (Strictly Harddisk\DR1 needn't be the D: drive and it needn't be removable, but that's far and away the most common configuration). I obviously can't say why any code should be be trying to access that drive. You could try running procexp.exe (sysinternals again) to see what handle is being attempted on that drive by that program which might lend a clue as to where the problem is arising. But, again, I don't believe this is a Python issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22739 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10548] Error in setUp not reported as expectedFailure (unittest)
Michael Foord added the comment: Assertions are not uncommon in setUp. setUp is for setting up common state shared between tests and I regularly want to assert that state creation / preconditions are correct. I've never been bitten by this issue (I rarely use expectedFailure), but it's worth noting the use case. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10548 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22740] Cache error
New submission from Stephan Monecke: `python2 test.py` results in the following error: Traceback (most recent call last): File test.py, line 1, in module import seaborn as sns File /path/seaborn.py, line 4, in module sns.set(style=ticks) AttributeError: 'module' object has no attribute 'set' seaborn.py is an old plot-file thats already deleted. -- components: Extension Modules messages: 230065 nosy: smoneck priority: normal severity: normal status: open title: Cache error type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22740] Cache error
Stephan Monecke added the comment: Edit: test.py contains just import seaborn as sns -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22725] improve documentation for enumerate() (built-in function)
Van Ly added the comment: While next() is rarely used directly on iterators, as you say, it may help to remind the experienced reader of the mechanical characteristic in essence which a new reader on first approach uses to construct a mental model. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22725 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22741] suggestion for improving wording on len(s) (built-in function)
New submission from Van Ly: -- suggest the following because -- the parenthetical parts interrupt the reading too often len(s) Returns a length count, the number of objects in argument s which may be a sequence, or mapping: a string, list or tuple, or a dictionary. -- assignee: docs@python components: Documentation messages: 230068 nosy: docs@python, vy0123 priority: normal severity: normal status: open title: suggestion for improving wording on len(s) (built-in function) type: enhancement versions: Python 2.7, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22741 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22740] Cache error
Stephan Monecke added the comment: Problem found. Induced by a .pyc file in the folder. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22740] Cache error
Changes by Georg Brandl ge...@python.org: -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22731] test_capi test fails because of mismatched newlines
Nick Coghlan added the comment: Argh, you're making me page _testembed back into my brain. I try to avoid having to do that ;) Anyway, this doesn't look like the right fix to me - although it may indeed be a test bug uncovered by a VC10-VC14 behavioural change in the behaviour of printf(). The origin of the output being checked is https://hg.python.org/cpython/file/default/Programs/_testembed.c#l79 Note the mixture of output from C level printf() calls and Python level print() calls inside check_stdio_details(). My guess would be that VC10 is translating '\n' to '\r\n' in the printf() calls, and VC14 has stopped doing that. To confirm my theory: check if it is only the lines that start with Expected that end with '\n' rather than '\r\n' under VC14 (those are the ones produced directly from C - the others are produced via Python's print builtin). If that *is* what's happening, we may want to convert the embedding tests over to running the subprocess in universal newlines mode, and adjust the expected output accordingly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22731] test_capi test fails because of mismatched newlines
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22731 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22725] improve documentation for enumerate() (built-in function)
Ethan Furman added the comment: I do not think 'next' is needed in this context. Unlike 'match' and 'search', 'next' is a function that can be used with any iterator and mentioning it here is unnecessary. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22725 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22738] improve sys.argv, 'python -h' documentation
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22738 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22741] suggestion for improving wording on len(s) (built-in function)
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22741 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22678] An OSError subclass for no space left on device would be nice
STINNER Victor added the comment: The PEP 3151 introduced specialized subclasses of OSError. Antoine Pitrou conducted a survey to decide which errors are common enough to merit a builtin exception: http://legacy.python.org/dev/peps/pep-3151/#appendix-a-survey-of-common-errnos ENOSPC is not mentionned in the PEP. According to 0002-Use-the-new-NoSpaceError.patch the error is rare: only used *once* in Python... and only in a very specific unit test (to workaround an issue on a specific buildbot...). It looks like ENOSPC is available on Linux, Windows, FreeBSD and Mac OS X. It is part of the POSIX standad, ex: http://pubs.opengroup.org/onlinepubs/009604599/basedefs/errno.h.html -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22741] suggestion for improving wording on len(s) (built-in function)
Stefan Krah added the comment: The original wording is clearer (this also applies to similar issues that have been opened recently). -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22741 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22678] An OSError subclass for no space left on device would be nice
Antoine Pitrou added the comment: That said I am not against adding a new error for this, but I agree the need is probably rather rare (the error is rare in itself, and there's not much to do if you hit a disk space issue, usually). I'm going to wait for other people to come with comments and possible use cases. In any case, thank you for submitting a patch, this is appreciated. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22256] pyvenv should display a progress indicator while creating an environment
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22256 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22737] Provide a rejected execution model and implementations for futures.
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22737 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22722] inheritable pipes are unwieldy without os.pipe2
STINNER Victor added the comment: Would it be acceptable to implement a pipe2 shim for those platforms? If I understand correctly, you propose to add an option inheritable parameter to os.pipe(): def os.pipe(inheritable=False): ... The PEP 446 was written to fix race conditions. os.pipe(inheritable=True) would create a race condition if another thread calls fork(). What is your use case? Please elaborate. The subprocess module makes pass_fds file descriptors inheritables in a safe way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22722 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21668] The select and time modules uses libm functions without linking against it
Changes by Matt Frank matthew.i.fr...@intel.com: -- nosy: +WanderingLogic Added file: http://bugs.python.org/file37041/audioop_ctypes_test_link_with_libm.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21668 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21668] The select and time modules uses libm functions without linking against it
Matt Frank added the comment: Additionally, * audioop calls floor() * _ctypes_test calls sqrt() Patch attached. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21668 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21668] The select and time modules uses libm functions without linking against it
Changes by Matt Frank matthew.i.fr...@intel.com: -- nosy: +freakboy3742 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21668 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20306] Lack of pw_gecos field in Android's struct passwd causes cross-compilation for the pwd module to fail
Changes by Matt Frank matthew.i.fr...@intel.com: -- nosy: +freakboy3742 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20306 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21668] The select and time modules uses libm functions without linking against it
STINNER Victor added the comment: audioop_ctypes_test_link_with_libm.patch + libraries=['m']) Why not using math_libs here? It would also be nice to add a comment explaining why libm is needed in each module. Can someone please combine both patches? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21668 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22742] IDLE shows traceback when printing non-BMP character
New submission from Alexander Belopolsky: print(\N{ROCKET}) Traceback (most recent call last): File pyshell#1, line 1, in module print(\N{ROCKET}) File idlelib/PyShell.py, line 1352, in write return self.shell.write(s, self.tags) UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f680' in position 0: Non-BMP character not supported in Tk Shouldn't IDLE replace non-encodable characters with \uFFFD? I think \N{ROCKET} � is user-friendlier than the traceback. See also #14304. -- components: Library (Lib) messages: 230078 nosy: belopolsky priority: normal severity: normal status: open title: IDLE shows traceback when printing non-BMP character type: behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22742 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22743] Specify supported XML version
New submission from Friedrich Spee von Langenfeld: The W3C has published two versions of the standard specification for the Extensible Markup Language (XML) [version 1.0 and 1.1]. I know that the W3C expects all parsers to understand both versions. I propose to state here (https://docs.python.org/3/library/xml.html) which versions of XML Python supports, especially, because https://docs.python.org/3/library/xml.etree.elementtree.html uses version 1.0 of the W3C recommendation in its examples. The version compatibility is named in https://docs.python.org/3/library/pyexpat.html#xml.parsers.expat.xmlparser.XmlDeclHandler , but I don´t think a normal user, who only want a quick, but reliable solution, would ever read this entry. What do you think? -- assignee: docs@python components: Documentation messages: 230079 nosy: Friedrich.Spee.von.Langenfeld, docs@python priority: normal severity: normal status: open title: Specify supported XML version type: enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22743 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21668] The select and time modules uses libm functions without linking against it
Matt Frank added the comment: audioop_ctypes_test_link_with_libm.patch + libraries=['m']) Why not using math_libs here? math_libs is defined in detect_modules(). But the _ctypes_test extension is defined in a different function: detect_ctypes(). The other option, would be to define math_libs=['m'] directly above this line and then use it once. I didn't think that added clarity, but I'd be happy to do it that way if it fits better with standard style. It would also be nice to add a comment explaining why libm is needed in each module. Done. Can someone please combine both patches? Done. -- Added file: http://bugs.python.org/file37042/time_select_audioop_ctypes_test_link_with_libm.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21668 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22695] open() declared deprecated in python 3 docs
Василий Макаров added the comment: I can confirm this issue is fixed for now. Closing ticket.. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22695 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22744] os.path.join on Windows creates invalid paths with spaces
New submission from tegavu: Windows does not like/permit folders with spaces in the beginning or folders and files with a tailing space character, as this will cause problems. The python functions for os.mkdir will solve this by eliminating the blanks automatically. But os.path.join() will give wrong results. Example: #Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) import os dir1 = c:\\ dir2 = test file = test.txt os.mkdir( os.path.join(dir1, dir2) ) # this will correctly create c:\test\ f = open( os.path.join(dir1, dir2, file) ,wb) # this will fail with 'FileNotFoundError: [Errno 2] No such file or directory: 'c:\\test \\test.txt'' print(__ + os.path.join(dir1, dir2, file) + __) # this will incorrectly show 'c:\test \test.txt' # or if you chose to also have spaces at the end of test.txt will show them -- messages: 230082 nosy: tegavu priority: normal severity: normal status: open title: os.path.join on Windows creates invalid paths with spaces type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22744 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface
New submission from Wolfgang Rohdewald: The attached script works with Python2.7. With Python3.4, it produces Traceback (most recent call last): File /usr/lib/python3.4/cgitb.py, line 268, in __call__ self.handle((etype, evalue, etb)) File cgibug.py, line 12, in handle cgitb.Hook.handle(self, info) File /usr/lib/python3.4/cgitb.py, line 273, in handle self.file.write(reset()) TypeError: 'str' does not support the buffer interface When replacing the file mode 'wb' with 'w', it produces this failure: File /usr/lib/python3.4/cgitb.py, line 288, in handle self.file.write(doc + '\n') TypeError: can't concat bytes to str The script works as expected with Python2.7 with both file modes. -- components: Library (Lib) files: cgibug.py messages: 230083 nosy: wrohdewald priority: normal severity: normal status: open title: cgitb with Py3: TypeError: 'str' does not support the buffer interface type: crash versions: Python 3.4 Added file: http://bugs.python.org/file37043/cgibug.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22745 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9351] argparse set_defaults on subcommands should override top level set_defaults
R. David Murray added the comment: If I understand you correctly, that would mean that if the namespace keyword is not used, we'd have the fixed behavior, but if the namespace keyword is used, we'd have the backward compatible behavior? If I'm understanding correctly, that sounds like a good solution to me (coupled with backing this out of the maint versions). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9351 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22746] cgitb html: wrong encoding for utf-8
New submission from Wolfgang Rohdewald: The attached script shows the non-ascii characters wrong wherever they occur, including the exception message and the comment in the source code. Looking at the produced .html, I can say that cgitb simply passes the single byte utf-8 codes without encoding them as needed. Same happens with Python3.4 (after applying some quick and dirty changes to cgitb.py, see bug #22745). -- components: Library (Lib) files: cgibug.py messages: 230085 nosy: wrohdewald priority: normal severity: normal status: open title: cgitb html: wrong encoding for utf-8 type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file37044/cgibug.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22746 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22725] improve documentation for enumerate() (built-in function)
R. David Murray added the comment: That would not be consistent with the rest of the docs. Consider, for example, that the full documetation of dictionary views (https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects), which are iterables in much the same way that the enumerate object is, does not mention next. The glossary link to iterable will lead the reader to the discussion of next, which is a fundamental Python concept and does not need to be repeated. In my opinion, of course, others may disagree. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22725 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10548] Error in setUp not reported as expectedFailure (unittest)
R. David Murray added the comment: Can you ever imagine the assertions in the setUp being what you would want reported as an expected failure? I would think that setUp assertion failure would be something you would want to be always reported as a failure, even if you expect the test itself to fail. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10548 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17896] Move Windows external libs from src\..\ to src\externals
Steve Dower added the comment: Not so keen on having separate folders for Python version, mostly because I want to avoid having the current version in too many locations. I've settled on patchlevel.h as the canonical source of the version number for my VC14 branch - everything else should read it from there. If the patch is updated to read it from patchlevel.h then I'm +1. Otherwise +0, and I'll probably update it later myself :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17896 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10548] Error in setUp not reported as expectedFailure (unittest)
Michael Foord added the comment: Maybe if the expectedFailure is applied to the whole class and it's the setUp that is unable to work. I've never seen it used that way of course (mostly because it doesn't work that way) - but I *can* imagine it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10548 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17717] Set up nasm from external.bat
Steve Dower added the comment: Practically this is very easy to do, and I'm more than willing to author detection into the new PCbuild files. Having nasm mirrored on svn.python.org (or anywhere on a PSF host) would be real nice though. I don't particularly like making the build system rely on potentially unreliable external sites. Not sure what the legal ramifications here are though... -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17717 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22738] improve sys.argv, 'python -h' documentation
R. David Murray added the comment: I don't understand how your suggested change would affect the font size issue (nor do I really understand it as a sentence). For your second suggestion (which is unrelated), how about instead: -c str : interpret str as a program (terminates option list) That would make the phrasing more consistent with the text for the other options. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22738 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22740] Cache error
Changes by R. David Murray rdmur...@bitdance.com: -- stage: - resolved type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22740 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com