pytest-2.6: shorter TBs, new warning system, better nose/mock support
pytest-2.6.0: shorter tracebacks, new warning system, test runner compat === pytest is a mature Python testing tool with more than a 1000 tests against itself, passing on many different interpreters and platforms. The 2.6.0 release should be drop-in backward compatible to 2.5.2 and fixes a number of bugs and brings some new features, mainly: - shorter tracebacks by default: only the first (test function) entry and the last (failure location) entry are shown, the ones between only in short format. Use ``--tb=long`` to get back the old behaviour of showing long entries everywhere. - a new warning system which reports oddities during collection and execution. For example, ignoring collecting Test* classes with an ``__init__`` now produces a warning. - various improvements to nose/mock/unittest integration Note also that 2.6.0 departs with the zero reported bugs policy because it has been too hard to keep up with it, unfortunately. Instead we are for now rather bound to work on upvoted issues in the https://bitbucket.org/hpk42/pytest/issues?status=newstatus=opensort=-votes issue tracker. See docs at: http://pytest.org As usual, you can upgrade from pypi via:: pip install -U pytest Thanks to all who contributed, among them: Benjamin Peterson Jurko Gospodnetić Floris Bruynooghe Marc Abramowitz Marc Schlaich Trevor Bekolay Bruno Oliveira Alex Groenholm have fun, holger krekel 2.6.0 --- - fix issue537: Avoid importing old assertion reinterpretation code by default. Thanks Benjamin Peterson. - fix issue364: shorten and enhance tracebacks representation by default. The new --tb=auto option (default) will only display long tracebacks for the first and last entry. You can get the old behaviour of printing all entries as long entries with --tb=long. Also short entries by default are now printed very similarly to --tb=native ones. - fix issue514: teach assertion reinterpretation about private class attributes Thanks Benjamin Peterson. - change -v output to include full node IDs of tests. Users can copy a node ID from a test run, including line number, and use it as a positional argument in order to run only a single test. - fix issue 475: fail early and comprehensible if calling pytest.raises with wrong exception type. - fix issue516: tell in getting-started about current dependencies. - cleanup setup.py a bit and specify supported versions. Thanks Jurko Gospodnetic for the PR. - change XPASS colour to yellow rather then red when tests are run with -v. - fix issue473: work around mock putting an unbound method into a class dict when double-patching. - fix issue498: if a fixture finalizer fails, make sure that the fixture is still invalidated. - fix issue453: the result of the pytest_assertrepr_compare hook now gets it's newlines escaped so that format_exception does not blow up. - internal new warning system: pytest will now produce warnings when it detects oddities in your test collection or execution. Warnings are ultimately sent to a new pytest_logwarning hook which is currently only implemented by the terminal plugin which displays warnings in the summary line and shows more details when -rw (report on warnings) is specified. - change skips into warnings for test classes with an __init__ and callables in test modules which look like a test but are not functions. - fix issue436: improved finding of initial conftest files from command line arguments by using the result of parse_known_args rather than the previous flaky heuristics. Thanks Marc Abramowitz for tests and initial fixing approaches in this area. - fix issue #479: properly handle nose/unittest(2) SkipTest exceptions during collection/loading of test modules. Thanks to Marc Schlaich for the complete PR. - fix issue490: include pytest_load_initial_conftests in documentation and improve docstring. - fix issue472: clarify that ``pytest.config.getvalue()`` cannot work if it's triggered ahead of command line parsing. - merge PR123: improved integration with mock.patch decorator on tests. - fix issue412: messing with stdout/stderr FD-level streams is now captured without crashes. - fix issue483: trial/py33 works now properly. Thanks Daniel Grana for PR. - improve example for pytest integration with python setup.py test which now has a generic -a or --pytest-args option where you can pass additional options as a quoted string. Thanks Trevor Bekolay. - simplified internal capturing mechanism and made it more robust against tests or setups changing FD1/FD2, also better integrated now with pytest.pdb() in single tests. - improvements to pytest's own test-suite leakage detection, courtesy of PRs from Marc Abramowitz - fix issue492: avoid leak in test_writeorg. Thanks Marc Abramowitz. - fix issue493: don't
Re: OT: usenet reader software
Sturla Molden sturla.mol...@gmail.com writes: c...@isbd.net wrote: That doesn't address the problem at all! :-) You still need a news reader. The problem was that Thunderbird does not support killfiles when used as a newsreader. Leafnode adds filtering capabilities which Thunderbird (supposedly) does not have. There are plenty of non-Thunderbird news clients... -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: usenet reader software
I'm trying gnus again, and immediately see the beauty of it. Actually Usenet is fast and commercial free, and easier to secure from prying NSA etc al (?) so maybe it will receive a general revival eventually. /martin s On 21 Jul 2014, Paul Rudin paul.nos...@rudin.co.uk wrote: Sturla Molden sturla.mol...@gmail.com writes: c...@isbd.net wrote: That doesn't address the problem at all! :-) You still need a news reader. The problem was that Thunderbird does not support killfiles when used as a newsreader. Leafnode adds filtering capabilities which Thunderbird (supposedly) does not have. There are plenty of non-Thunderbird news clients... -- Sent with K-@ Mail - the evolution of emailing.-- https://mail.python.org/mailman/listinfo/python-list
Html Parsing stuff
Ok i get the basics of this and i have been doing some successful parsings and using regular expressions to find html tags. I have tried to find an img tag and write that image to a file. I have had no success. It says it has successfully wrote the image to the file with a try... except statement but when i try to open this it says that the image has like no been saved correctly or is damaged. This was just reading the src attribute of the tag and trying to save that link to a .jpg(the extension of the image). Ok so i looked deeper and added a forward slash to the url and then added the image src attribute to it. I then opened that link with the urllib.urlopen() and then read the contents and saved it to the file again. I still got the same result as before. Is there a function in beautiful soup or the urllib module that i can use to save and image. This is just a problem i am sorting out not a whole application so the code is small. Thanks -- https://mail.python.org/mailman/listinfo/python-list
Re: Confused with Functions and decorators
On Saturday, July 19, 2014 8:44:25 PM UTC+8, Wojciech Giel wrote: On 19/07/14 12:40, Jerry lu wrote: oh yeah i forgot about the decorators. Um say that you wanted to decorate a function with the outer() func you would just put @outer on top of it? And this is the same as passing another func into the outer func? yes. syntax was added because with very long function definitions it was dificult to track reassignment to the name when it followed definition of the function. decorators is just abbreviation. def outer(f): ... def inner(*args, **kwargs): ... print(inner function) ... return f(*args, **kwargs) ... return inner ... @outer ... def myfunc(x): ... print(Myfunc, x) ... myfunc(test) inner function Myfunc test it is exactly equivalent to: def outer(f): ... def inner(*args, **kwargs): ... print(inner function) ... return f(*args, **kwargs) ... return inner ... def myfunc(x): ... print(Myfunc, x) ... myfunc = outer(myfunc) myfunc(test) inner function Myfunc test cheers Wojciech and also with the first example you say x is in the scope when is was created can you define x in the outer func and refer to it in the inner func? check nonlocal. Uhn, a local object inside a function can be passed back in Python. Of course, a local function is treated as an object in Python,and the GC is built-in. -- https://mail.python.org/mailman/listinfo/python-list
Re: Confused with Functions and decorators
On Mon, 21 Jul 2014 00:30:00 -0700, CHIN Dihedral wrote: Uhn, a local object inside a function can be passed back in Python. Of course, a local function is treated as an object in Python,and the GC is built-in. Sigh, the Dihedral bot is not what it used to be... -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
2014-07-21 4:30 GMT+02:00 Tim Chase python.l...@tim.thechases.com: On 2014-07-20 19:06, Rick Johnson wrote: STEPS TO REPRODUCE BUG 1: Attack of the clones! 1. Open the IDLE application 2. Maximize the window that appears 3. Go to the File Menu and choose the Open command Now repeat step 3 at least one more time, but feel free to keep opening new dialogs until your fingers bleed and/or eyes pop out. In the versions of IDLE that I have here (2.7.3 and 3.2.3), both prevent me from repeating step #3 multiple times. Not on 2.7.6 and 3.4 on Linux Mint either -- Regards, Martin S -- https://mail.python.org/mailman/listinfo/python-list
Re: Idle's Shell: prompts and indents (was ...) Idle users please read
On 7/20/2014 11:34 PM, Chris Angelico wrote: On Mon, Jul 21, 2014 at 1:28 PM, Terry Reedy tjre...@udel.edu wrote: A few users have noticed (and complained) that setting sys.ps1 and sys.ps2 *in the batch mode user process* has no effect. The Idle doc should better explain why this is and should be. User code should not affect the operation of Idle. Idle is separately configured through dialogs. As I understand it, setting them has *absolutely* no effect, currently, right? As far as I know, setting sys.ps1 and sys.ps2 have no effect in any batch mode program. This has nothing to do with Idle. There's no situation in which it would be useful to set them? In that case, it might be useful to put some magic in there (although I'm not sure it's possible; can't use @property at top level in a module) that gives a notification - pointing users to the dialog. In general, Idle should execute user code the same way that the interpreter does, subject to the limitations of the different execution environment. No idea how you'd go about it, but telling someone when what s/he does is useless can be helpful. What needs better documentation is what the execution environment is, and how the shell is different from a line-buffered console. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Html Parsing stuff
dont worry it has been solved -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: usenet reader software
On 2014-07-21, Paul Rudin paul.nos...@rudin.co.uk wrote: Sturla Molden sturla.mol...@gmail.com writes: c...@isbd.net wrote: That doesn't address the problem at all! :-) You still need a news reader. The problem was that Thunderbird does not support killfiles when used as a newsreader. Leafnode adds filtering capabilities which Thunderbird (supposedly) does not have. There are plenty of non-Thunderbird news clients... But relatively few GUI clients on Linux... which was what I was looking for. -- https://mail.python.org/mailman/listinfo/python-list
Re: Idle's Shell: prompts and indents (was ...) Idle users please read
On Mon, Jul 21, 2014 at 7:00 PM, Terry Reedy tjre...@udel.edu wrote: In general, Idle should execute user code the same way that the interpreter does, subject to the limitations of the different execution environment. Agreed, but I think the setting of prompts is a different execution environment case. It's a fundamental difference between batch mode and interactive, and Idle uses batch mode to implement interactive mode. So something like: sys.ps1=Python Setting sys.ps1 has no effect in Idle; see the Options menu. It might not be possible, but if it is, it wouldn't break any actual viable use-cases. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. -- Grant Edwards grant.b.edwardsYow! I'm RELIGIOUS!! at I love a man with gmail.coma HAIRPIECE!! Equip me with MISSILES!! -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
No intent to pollute this thread. But really interested in the invalid@invalid.invalid mailing address. And,,, obviously, I cannot send to invalid@invalid.invalid, so How does you(he) make this? 2014-07-21 22:27 GMT+08:00 Grant Edwards invalid@invalid.invalid: I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. -- -- https://mail.python.org/mailman/listinfo/python-list -- 吾輩は猫である。ホームーページはhttp://introo.me。 -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On Tue, Jul 22, 2014 at 12:27 AM, Grant Edwards invalid@invalid.invalid wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. There are many definitions of the word, and sometimes they disagree. (That's why it's common to have an issue tracker rather than a bug tracker; often the is this a bug report or a feature request question doesn't even matter. In theory, version x.y.? releases should have bug fixes but not feature additions, but sometimes some bug fix might potentially break code, so it's deferred till the next x.? release. Or a feature addition is allowed to be backported, because it's Idle, not the core language.) But even using that definition, I would not say that one single person saying this can't possibly be useful is enough to define something as a bug. Take, for instance, the behaviour of Windows's cmd.exe editing keys: enter three commands, then up-arrow three times and hit enter, then press down, enter, down, enter. You'll repeat the three commands. In other interfaces (eg GNU readline), you'd do the same job by pressing up, up, up, enter each time. Personally, I find the cmd.exe behaviour extremely surprising, especially when I've been working with some very similar commands (imagine: ./configure some_bunch_of_args; make; some_command_to_test; rm -rf *; git checkout HEAD - then repeat with a different set of configure arguments), and I end up stuck half way up command history, wondering why I'm not seeing what I wanted. Can be extremely awkward. But even so, I don't call this a bug. It's entirely possible that it is one - some internal state that isn't being reset correctly - as I don't have docs or the programmer's intention to compare against. However, I can't honestly call it a bug based on just my own use-cases. I personally find it useless and unhelpful, but that doesn't make it a bug any more than a colourblind person would find a colour-based UI phenomenon a bug. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On Tue, Jul 22, 2014 at 12:40 AM, Shiyao Ma i...@introo.me wrote: No intent to pollute this thread. But really interested in the invalid@invalid.invalid mailing address. And,,, obviously, I cannot send to invalid@invalid.invalid, so How does you(he) make this? When you send email, you have to have a valid envelope-from address, which can be found in the headers. But the From: address doesn't technically have to be valid. And if the email you received actually came from the news-mail gateway, then it's even less significant; the address used is simply whatever Grant chose to key into his newsreader, which in this case is a marker saying Please don't email me, just follow-up to the group :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 2014-07-21, Shiyao Ma i...@introo.me wrote: But really interested in the invalid@invalid.invalid mailing address. And,,, obviously, I cannot send to invalid@invalid.invalid, so How does you(he) make this? Some usenet clients, such as slrn which it looks like Grant is using according to the message header, support using different addresses for 'From:' and 'Reply-To:', and the comments in the default .slrnrc config file recommend using some form of 'invalid' in your 'From:' address to cut down on spam. Looks like Grant took that quite literally ;) Not sure if it really matters... probably can't hurt... Monte -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 21/07/2014 15:27, Grant Edwards wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. As in my entire career I've never come across a reasonable user then by that definition there are no bugs. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On Tue, Jul 22, 2014 at 1:19 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 21/07/2014 15:27, Grant Edwards wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. As in my entire career I've never come across a reasonable user then by that definition there are no bugs. Absence of evidence is not the same as evidence of absence. It may be that there is a single platinum reasonable user, kept at the International Bureau of Bugs, that we may all look on it and know what the SI Standard User is. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Python and IDEs [was Re: Python 3 is killing Python]
On Sunday, July 20, 2014 9:53:02 AM UTC+8, C.D. Reimer wrote: On 7/19/2014 6:23 PM, Steven D'Aprano wrote: I haven't used Python on Windows much, but when I did use it, I found the standard Python interactive interpreter running under cmd.exe to be bare- bones but usable for testing short snippets. If I recall correctly, it is missing any sort of command history or line editing other than backspace, which I guess it would have been painful to use for extensive interactive work, but when I started using Python on Linux the interactive interpreter had no readline support either so it was just like old times :-) Windows PowerShell supports very basic Linux commands and has a command history. I'm always typing ls for a directory listing when I'm on a Windows machine. The regular command line would throw a DOS fit. PowerShell lets me get away with it. http://en.wikipedia.org/wiki/Windows_PowerShell#Comparison_of_cmdlets_with_similar_commands I prefer working on my vintage 2006 Black MacBook. Alas, the CPU fan is dying and MacBook shuts down after 15 minutes. I'm surprised at how well I was able to set up a equivalent programming environment on Windows. Chris Reimer Well, Python could be used as a scripting language for routine jobs in various Oses. But Python has been designed to be a cross-platform high-level general purpose programming language from the birth. One can be sure that the investing in most of the programming concepts and skills in Python 2.XX is still valid in Python 3.XX. Forget those non-investing imitators' flase spamming claims. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
Chris Angelico ros...@gmail.com writes: Take, for instance, the behaviour of Windows's cmd.exe editing keys: enter three commands, then up-arrow three times and hit enter, then press down, enter, down, enter. You'll repeat the three commands. In other interfaces (eg GNU readline), you'd do the same job by pressing up, up, up, enter each time. Personally, I find the cmd.exe behaviour extremely surprising, especially when I've been working with some very similar commands (imagine: ./configure some_bunch_of_args; make; some_command_to_test; rm -rf *; git checkout HEAD - then repeat with a different set of configure arguments), and I end up stuck half way up command history, wondering why I'm not seeing what I wanted. Can be extremely awkward. But even so, I don't call this a bug. Granted, the readline library exposes a operate-and-get-next function, by default bound to \C-o, with the same behaviour as the cmd.exe one. I find it very handy in the scenario you picted. So again, feature and bug may be effectively subjective :-) ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On Tue, Jul 22, 2014 at 1:57 AM, Lele Gaifax l...@metapensiero.it wrote: Granted, the readline library exposes a operate-and-get-next function, by default bound to \C-o, with the same behaviour as the cmd.exe one. I find it very handy in the scenario you picted. So again, feature and bug may be effectively subjective :-) I've never used it, but from the name, I would take it to be equivalent to enter, down-arrow in the above scenario. As a single action, that's less surprising and just as useful. The problem isn't when you consciously want the feature - it's when you DON'T want it and get this unexpected state. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Network/multi-user program
So... this is a fairly general / hypothetical question, and I'm more looking for direction than specifics - though it may be useful as well. I need to create a particular application for administering a sporting event. 95% (and this may be understating the case) of the 'users' would likely be single-machine, single user scenarios. For those exceptions (which are important enough that I'm concerned over them) there would be one person 'administering' the event and a small number of others (probably 5, no more than 10) doing basic data entry - competitor registration and later entering scores. Before (setting up event), in between (squadding competitors based on classification, equipment, available positions on relays, etc.) and taking care of final reports for awards, etc. would be done only from the main program. The end-users are likely not tech-saavy, and most likely running Windows or maybe a Mac. Being able to do the data entry from a tablet would be nice but by no means necessary. Installation needs to be as stone-simple as possible - running from a pre-configured USB stick or a browser would be ideal. Use would be over small wired or wi-fi LAN enviroment - no exposure to Internet. Given that the vast majority of the 'work' is going to be done on one computer by one user, but wanting to retain the flexibility/ability to later have addtional 'clients' connect for data entry purposes... I'm trying to decide what would be a better option: create a stand-alone GUI desktop app and figure out how to create a separate 'client' program that can connect and perform basic CRUD operations, or start out with some sort of web framework and have everything literally run from the 'server' via a browser-based interface. The scope of the project in terms of users appears to be small enough that using something like sqlite would be feasible (the data entry clients would not be working on the same records), and the small development web servers that most projects like web2py, flask, django come with should (maybe?) be able to carry the (minimal) load as well. Having to throw html/css/js plus browser compatibility issues on top of everything else starts making the project look a whole lot bigger than I'm comfortable with... but on the other hand I have no idea how to go about connecting a client app to a running GUI program either. The whole project is fairly ambitious for my current skill level (basically small addressbook/task-list type apps) but I figured I'd have to stretch/grow a bit either way I go. So I guess I'm asking for advice or simplified examples of how to go about connecting a client desktop app to a parent/master desktop app, so I can get some idea of how big of a task I'm looking at here, and whether that would be more or less difficult than trying to do the equivalent job using a web framework. Thanks, Monte -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
On Tue, Jul 22, 2014 at 2:07 AM, Monte Milanuk memila...@invalid.com wrote: So I guess I'm asking for advice or simplified examples of how to go about connecting a client desktop app to a parent/master desktop app, so I can get some idea of how big of a task I'm looking at here, and whether that would be more or less difficult than trying to do the equivalent job using a web framework. Easier way: Don't have a master desktop app, but instead have a master database. Since you're posting this to python-list, I'll assume you currently intend writing this in Python; you can make a really simple transition from single-user-single-desktop to a networked system, although of course you'll want to think in terms of multiple users from the start. All you need to do is pick a database engine at the top of the script. As a general rule, I would say that it's okay to have more complicated installation instructions for a more demanding job, so you can have the single-user setup done with SQLite3 (no need to install a database and worry about passwords), but for the multi-user setup, they have to install (say) PostgreSQL on a single central server, and then possibly key in some authentication on each client (or even maybe not, depending on how much you trust the LAN - you did say there's no internet exposure). This is going to be comparable difficulty to setting up a centralized web server, but with the advantage that you can short-cut the whole thing when it's to be used on only one computer (not really possible with a browser-based system). Your UI would, obviously, be absolutely the same for both scenarios - it'd be all the same code, doing exactly the same things. (Obviously you'd have to make sure your SQL isn't specific to either engine, but that's easy enough. You won't warp your code much around that.) The only difference would be if you have to worry about update conflicts and other inherently multi-user issues, but ultimately there's no difference between the multi-user scenario where nobody else happens to be doing anything, and the dedicated single-user scenario. So, how big a task is it? If you're already familiar with the Python databasing API, and at least broadly familiar with a multi-user DBMS like PostgreSQL, and especially if you already know the important aspects of coping with simultaneous users, then this will be pretty easy - much easier than working it into a web browser. (And you'd need to worry about the issues of simultaneous users anyway. There's really no difference on that.) In terms of setup complexity for your users, it's *possible* that you could develop a low-performance web server that would be easier to deploy. You'd just need to either embed an HTTP server in your Python script, or use a framework that includes one; and if you make it single-threaded (ie all requests are serialized), you could use SQLite for the database back-end. In contrast, I'm suggesting a central database, which has to be installed and configured (most databases won't, by default, accept connections from anyone but localhost), which at very least will require a bit more chugging (you can automate all or at least most of it, but it'll still take time to install). The advantages are that you can trust your code (because it's all the same everywhere), and yet you have an extremely light single-user mode, plus your UI is flexible - you're not restricted to a web browser, you can build an actual application with whatever UI you like. And, in fact, you could have several different UIs, if you wanted to, because it's the database that's king. Maybe it'd be helpful to have a really REALLY cut-down UI for the basic data entry, with no clutter from the admin functions. It'd all work fine. (And you could add that later, without breaking anything.) It is, of course, possible to write a desktop application that can be remotely scripted for data entry. But I don't think it's necessary. :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
Monte Milanuk memila...@invalid.com writes: I need to create a particular application for administering a sporting event. 95% (and this may be understating the case) of the 'users' would likely be single-machine, single user scenarios. For those exceptions (which are important enough that I'm concerned over them) there would be one person 'administering' the event and a small number of others (probably 5, no more than 10) doing basic data entry - competitor registration and later entering scores. Before (setting up event), in between (squadding competitors based on classification, equipment, available positions on relays, etc.) and taking care of final reports for awards, etc. would be done only from the main program. The end-users are likely not tech-saavy, and most likely running Windows or maybe a Mac. Being able to do the data entry from a tablet would be nice but by no means necessary. Installation needs to be as stone-simple as possible - running from a pre-configured USB stick or a browser would be ideal. Use would be over small wired or wi-fi LAN enviroment - no exposure to Internet. I developed SoL[1] with almost the same goal, to manage Carrom tournaments. It started many years ago as a Windows only desktop application, but evolved into a much nicer and fun-to-develop web application, based on Python on the backend (using Pyramid and SQLAlchemy, with a SQLite database) and ExtJS on the frontend. That basically means that the backend may be installed with little effort on any Python-supported OS, and the frontend runs on most modern browsers. I manage small events with a single notebook and a low cost printer, without network connection, while major events with a network connection may be managed online. You can try it out at http://sol3.arstecnica.it/, using guest/guest as username/password. Hope this helps, ciao, lele. [1] https://pypi.python.org/pypi/SoL -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- https://mail.python.org/mailman/listinfo/python-list
RE: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
-Original Message- From: Python-list [mailto:python-list-bounces+michael.coll- barth=verizonwireless@python.org] On Behalf Of Grant Edwards Sent: Monday, July 21, 2014 10:27 AM To: python-list@python.org Subject: Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment! On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. -- I have to agree with Chris. A bug is what you call something that happens contrary to design or intent. Only. I build a program, regardless of the platform, with my intent, not yours. When it blows up or doesn't do what I want, then it's a bug and it's a bug even if there are no users for my program. Something that happens contrary to user expectations is an annoyance to that user. You might want to get your money back from those that taught you otherwise. BTW, there ain't no such thing as a 'reasonable' user. That's what they call an oxymoron. -- https://mail.python.org/mailman/listinfo/python-list
Installing Python 2.6.2 on Ubuntu 12.1
Question: How to install Python manually and make sure that all the necessary modules and .so files get built (eg: _sha256.so, zlib.so) Details: I am trying to install Python2.6.2 version manually, installation goes through fine, but later installing setuptools fails due to _sha256 Module not found. These are the steps I did for manually installing python in my private folder: 1. ./configure --help 2. ./configure --prefix=/home/brd/priv_env 3. make; make install The installation went through successfully, however I noticed that some of the _*.so files did not get built under lib/python2.6/lib-dynload/ folder (eg _sha256.so) , which is likely the reason why my setuptools install failed due to the error: File /home/cisco/priv_env/lib/python2.6/hashlib.py, line 138, in module sha224 = __get_builtin_constructor('sha224') File /home/cisco/priv_env/lib/python2.6/hashlib.py, line 66, in __get_builtin_constructor import _sha256 ImportError: No module named _sha256 Note that I have the necessary libraries installed on this machine eg: libzlib.so, libssl.so /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libssl3.so /usr/lib/x86_64-linux/gnu/libz.so.1 Another note, is that the standard python installation on this system (Python 2.7.3), does not have this problem, and has all the modules and .so files built. Sincere Regards, Behzad -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 2014-07-21, Shiyao Ma i...@introo.me wrote: No intent to pollute this thread. But really interested in the invalid@invalid.invalid mailing address. And,,, obviously, I cannot send to invalid@invalid.invalid, so FWIW, my real e-mail address is at the bottom of every post. How does you(he) make this? I execute the following slang code via my slrn startup file: username = grant.b.edwards; host = gmail.com; -- Grant Edwards grant.b.edwardsYow! Does someone from at PEORIA have a SHORTER gmail.comATTENTION span than me? -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 2014-07-21, Chris Angelico ros...@gmail.com wrote: On Tue, Jul 22, 2014 at 12:40 AM, Shiyao Ma i...@introo.me wrote: No intent to pollute this thread. But really interested in the invalid@invalid.invalid mailing address. And,,, obviously, I cannot send to invalid@invalid.invalid, so How does you(he) make this? When you send email, you have to have a valid envelope-from address, which can be found in the headers. But the From: address doesn't technically have to be valid. Note that a lot of mail servers and/or spam filters will think it's spam if it isn't. And if the email you received actually came from the news-mail gateway, It did. then it's even less significant; the address used is simply whatever Grant chose to key into his newsreader, which in this case is a marker saying Please don't email me, just follow-up to the group :) If people really do want to e-mail me, that's fine. What I'm trying to avoid is people who e-mail my without knowing they're doing so because that's the default setting for whatever broken-by-design email client, web-UI, or newsreading they happen to be using. If people conciously want to e-mail me, all they can by using the address in my sig. -- Grant Edwards grant.b.edwardsYow! Wait ... is this a FUN at THING or the END of LIFE in gmail.comPetticoat Junction?? -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 2014-07-21, Mark Lawrence breamore...@yahoo.co.uk wrote: On 21/07/2014 15:27, Grant Edwards wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. As in my entire career I've never come across a reasonable user then by that definition there are no bugs. Well done! -- Grant Edwards grant.b.edwardsYow! Hello. Just walk at along and try NOT to think gmail.comabout your INTESTINES being almost FORTY YARDS LONG!! -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On Mon, 21 Jul 2014 17:57:22 +0200, Lele Gaifax wrote: Chris Angelico ros...@gmail.com writes: Take, for instance, the behaviour of Windows's cmd.exe editing keys: enter three commands, then up-arrow three times and hit enter, then press down, enter, down, enter. You'll repeat the three commands. In other interfaces (eg GNU readline), you'd do the same job by pressing up, up, up, enter each time. Personally, I find the cmd.exe behaviour extremely surprising, especially when I've been working with some very similar commands (imagine: ./configure some_bunch_of_args; make; some_command_to_test; rm -rf *; git checkout HEAD - then repeat with a different set of configure arguments), and I end up stuck half way up command history, wondering why I'm not seeing what I wanted. Can be extremely awkward. But even so, I don't call this a bug. Granted, the readline library exposes a operate-and-get-next function, by default bound to \C-o, with the same behaviour as the cmd.exe one. I find it very handy in the scenario you picted. So again, feature and bug may be effectively subjective :-) Have you actually got that working in Python with the readline module? I've tried and tried and cannot get it to work. Any hints gratefully appreciated. -- Steven -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 2014-07-21, Grant Edwards invalid@invalid.invalid wrote: On 2014-07-21, Shiyao Ma i...@introo.me wrote: No intent to pollute this thread. But really interested in the invalid@invalid.invalid mailing address. And,,, obviously, I cannot send to invalid@invalid.invalid, so FWIW, my real e-mail address is at the bottom of every post. How does you(he) make this? I execute the following slang code via my slrn startup file: username = grant.b.edwards; host = gmail.com; Oops, I cut and pasted the wrong code: variable username = invalid; variable host=invalid.invalid; set_string_variable(hostname, host); set_string_variable(username, username); -- Grant Edwards grant.b.edwardsYow! Was my SOY LOAF left at out in th'RAIN? It tastes gmail.comREAL GOOD!! -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Granted, the readline library exposes a operate-and-get-next function, by default bound to \C-o, with the same behaviour as the cmd.exe one. I find it very handy in the scenario you picted. So again, feature and bug may be effectively subjective :-) Have you actually got that working in Python with the readline module? I've tried and tried and cannot get it to work. Any hints gratefully appreciated. I was pretty sure it worked when I revamped the readline support[1], many years ago, but effectively I'm not able to do it now, and I find this https://github.com/ipython/ipython/issues/41 where Chet Ramey says it's something that bash injects into the library... and that it should be easy to implement by the calling application. So I guess my memory is faulty. ciao, lele. [1] http://ftp.vim.org/languages/python/python/contrib-09-Dec-1999/System/Pyrl.README -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On Tue, Jul 22, 2014 at 2:55 AM, Grant Edwards invalid@invalid.invalid wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: When you send email, you have to have a valid envelope-from address, which can be found in the headers. But the From: address doesn't technically have to be valid. Note that a lot of mail servers and/or spam filters will think it's spam if it isn't. Yes, which is why I said technically. Most often, a difference between envelope-from and From: header is because of a resending, like when Mailman sends mail on behalf of someone else; the From is still a valid address, but it's not the same one as the envelope-from (which will be the list-bounces address). That said, though, I've often telnetted to a mail server and done something like this: helo mail from:some real address rcpt to:another real address data From: me To: me Subject: Test Test! . quit Generally that sort of thing gets through. Sometimes it lands in a spam box, but more often it doesn't. I don't remember it ever getting rejected, other than for issues of relaying (which usually come from typoing the recipient domain). ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
On 2014-07-21, Chris Angelico ros...@gmail.com wrote: On Tue, Jul 22, 2014 at 2:07 AM, Monte Milanuk memila...@invalid.com wrote: So I guess I'm asking for advice or simplified examples of how to go about connecting a client desktop app to a parent/master desktop app, so I can get some idea of how big of a task I'm looking at here, and whether that would be more or less difficult than trying to do the equivalent job using a web framework. Easier way: Don't have a master desktop app, but instead have a master database. Since you're posting this to python-list, I'll assume you currently intend writing this in Python; you can make a really simple transition from single-user-single-desktop to a networked system, although of course you'll want to think in terms of multiple users from the start. So... if everybody is using the same application to access the same database, how would you prevent say, a data entry user from accidentally breaking something above their pay-grade? Set up some sort of role-based privilege system to limit them to write access for some portions and read-only for others? Thanks, Monte -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
On 2014-07-21, Lele Gaifax l...@metapensiero.it wrote: I manage small events with a single notebook and a low cost printer, without network connection, while major events with a network connection may be managed online. You can try it out at http://sol3.arstecnica.it/, using guest/guest as username/password. Wow. I have no idea how the game/events run, but that is a very nice looking program! How hard was it to migrate from a desktop app to what you have now? Would you recommend this route for someone starting out? Monte -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
On Tue, Jul 22, 2014 at 4:16 AM, Monte Milanuk memila...@invalid.com wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: On Tue, Jul 22, 2014 at 2:07 AM, Monte Milanuk memila...@invalid.com wrote: So I guess I'm asking for advice or simplified examples of how to go about connecting a client desktop app to a parent/master desktop app, so I can get some idea of how big of a task I'm looking at here, and whether that would be more or less difficult than trying to do the equivalent job using a web framework. Easier way: Don't have a master desktop app, but instead have a master database. Since you're posting this to python-list, I'll assume you currently intend writing this in Python; you can make a really simple transition from single-user-single-desktop to a networked system, although of course you'll want to think in terms of multiple users from the start. So... if everybody is using the same application to access the same database, how would you prevent say, a data entry user from accidentally breaking something above their pay-grade? Set up some sort of role-based privilege system to limit them to write access for some portions and read-only for others? That would be one way, yes. The first question you'd need to ask is: How do you know who's data-entry and who's admins? As soon as you solve that (probably with some sort of login), you tie the access level to that. If you need absolute security, you would have the user enter a login and password which would actually be the database credentials. Then you grant exact rights in the database manager, permitting ONLY what that user is allowed to do. It's then utterly impossible, even for someone who knows Python and SQL, to do damage. But more likely, what you really want is a cut-down UI that simplifies things: if the user is data-entry level, you take away all the admin-type options. It might be possible to fiddle around in internals and gain elevated access, but that's not an issue in many environments. In any case, these are issues you'd need to figure out regardless of the development model. Ultimately, you could treat the entire computer, network, database, etc as a black box, and just look at two entities: the human, and the UI s/he is using. All permissions issues can be explained at that level. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Idle's Shell: prompts and indents (was ...) Idle users please read
On 7/21/2014 6:56 AM, Chris Angelico wrote: On Mon, Jul 21, 2014 at 7:00 PM, Terry Reedy tjre...@udel.edu wrote: In general, Idle should execute user code the same way that the interpreter does, subject to the limitations of the different execution environment. Agreed, but I think the setting of prompts is a different execution environment case. It's a fundamental difference between batch mode and interactive, and Idle uses batch mode to implement interactive mode. So something like: sys.ps1=Python Setting sys.ps1 has no effect in Idle; see the Options menu. It might not be possible, but if it is, it wouldn't break any actual viable use-cases. It would be a lot of work for close to 0 gain. It could not work consistent without special-casing sys assignments. Consider prompt1 = 'Me' setps1 = sys.ps1 setps1(prompt1) ;-(. Idle cannot exactly imitate the interactive interpreter (II) because it does not execute code in exactly the same way. For instance, http://bugs.python.org/issue21997 reported that fact that the sequence def dodebug(): pdb.set_trace() dodebug() behaves differently in Idle and II. Not knowing the details of Idle (currently only available in the code), the OP claimed that this is an Idle bug. It turns out that running dodebug indirectly def run_code(code): exec(code, globals()) run('dodebug()') *in the II* behaves like Idle. The above is essentially how Idle runs code. (The difference is that it substitutes a custom namespace designed to look like the globals() of a main modules, include having __name__ == '__main__'.) Well, at least I know now, so I know how to review claims that Idle is buggy when it acts a bit differently than the II. The exec abstraction has a few tiny leaks if one looks hard enough, such as with the debugger. Using inspect to look at the frame stack would also show a difference. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: Idle's Shell: prompts and indents (was ...) Idle users please read
On Tue, Jul 22, 2014 at 4:30 AM, Terry Reedy tjre...@udel.edu wrote: It would be a lot of work for close to 0 gain. It could not work consistent without special-casing sys assignments. The latter doesn't much matter (this is just a theory to help people realize what they've done, not an actual preventative - it's like if someone types quit and it comes back with a custom repr that tells them about quit() or EOF), but the former is the important bit here. Not a big deal, not worth a huge amount of effort. At best, this is something to docket away as here's another thing that we could do if we had an equivalent for @property at module-level, nothing more. (Because with that, it would be pretty easy.) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Event loop documentation error
I was reading https://docs.python.org/3/library/asyncio-eventloop.html#example-set-signal-handlers-for-sigint-and-sigterm and wanted to test the example, however, I am getting this error when I run the code; Traceback (most recent call last): File C:/Users/gorki/Documents/Python Scripts/as-io.py, line 14, in module loop.add_signal_handler(SIGINT, partial(ask_exit, SIGINT)) File C:\Python34\lib\asyncio\events.py, line 329, in add_signal_handler raise NotImplementedError NotImplementedError I was wondering if there is something I am doing wrong, or is this behaviour platform specific (I am on windows 7). I wanted to ask in the list before I file a bug report. -- http://ysar.net/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Event loop documentation error
On Tue, Jul 22, 2014 at 4:38 AM, Yaşar Arabacı yasar11...@gmail.com wrote: Traceback (most recent call last): File C:/Users/gorki/Documents/Python Scripts/as-io.py, line 14, in module loop.add_signal_handler(SIGINT, partial(ask_exit, SIGINT)) File C:\Python34\lib\asyncio\events.py, line 329, in add_signal_handler raise NotImplementedError NotImplementedError I was wondering if there is something I am doing wrong, or is this behaviour platform specific (I am on windows 7). I wanted to ask in the list before I file a bug report. SIGINT is a Unix signal. There is an equivalent for Windows, but it wouldn't at all surprise me if trying to hook signals raises NotImplementedError. See if there's a different way to hook Ctrl-C on Windows; if not, you may want to word your report as a feature request. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Event loop documentation error
-- Forwarded message -- From: Yaşar Arabacı yasar11...@gmail.com Date: 2014-07-21 21:54 GMT+03:00 Subject: Re: Event loop documentation error To: Chris Angelico ros...@gmail.com 2014-07-21 21:45 GMT+03:00 Chris Angelico ros...@gmail.com: SIGINT is a Unix signal. There is an equivalent for Windows, but it wouldn't at all surprise me if trying to hook signals raises NotImplementedError. See if there's a different way to hook Ctrl-C on Windows; if not, you may want to word your report as a feature request. ChrisA After reading the next page of the documentation, I realized that add_signal_handler() and remove_signal_handler() are not supported on Windows. Moreover, dev3.5 version of the docs are also saying that they are not supported, so I think they are not planning to supports those features on Windows anytime soon. In that case, should I make a bug report on docs that it should be mentioned on example that this feature is not supported on Windows. As for the feature request, I think there is a good reason that they didn't include it already. I will try to look into it, before making a feature request. -- http://ysar.net/ -- http://ysar.net/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Event loop documentation error
On Tue, Jul 22, 2014 at 4:55 AM, Yaşar Arabacı yasar11...@gmail.com wrote: After reading the next page of the documentation, I realized that add_signal_handler() and remove_signal_handler() are not supported on Windows. Moreover, dev3.5 version of the docs are also saying that they are not supported, so I think they are not planning to supports those features on Windows anytime soon. If I had to guess, I would say that the reason there's no Windows Ctrl-C handler would simply be that nobody's yet volunteered to write one. So you might be in a position to add what you want to 3.5 :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Event loop documentation error
On 21/07/2014 20:00, Chris Angelico wrote: On Tue, Jul 22, 2014 at 4:55 AM, Yaşar Arabacı yasar11...@gmail.com wrote: After reading the next page of the documentation, I realized that add_signal_handler() and remove_signal_handler() are not supported on Windows. Moreover, dev3.5 version of the docs are also saying that they are not supported, so I think they are not planning to supports those features on Windows anytime soon. If I had to guess, I would say that the reason there's no Windows Ctrl-C handler would simply be that nobody's yet volunteered to write one. So you might be in a position to add what you want to 3.5 :) ChrisA I'd check the bug tracker before doing anything. It's perfectly possible that somebody has already done this but the patch hasn't been reviewed yet. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Event loop documentation error
On Tue, Jul 22, 2014 at 5:15 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 21/07/2014 20:00, Chris Angelico wrote: On Tue, Jul 22, 2014 at 4:55 AM, Yaşar Arabacı yasar11...@gmail.com wrote: After reading the next page of the documentation, I realized that add_signal_handler() and remove_signal_handler() are not supported on Windows. Moreover, dev3.5 version of the docs are also saying that they are not supported, so I think they are not planning to supports those features on Windows anytime soon. If I had to guess, I would say that the reason there's no Windows Ctrl-C handler would simply be that nobody's yet volunteered to write one. So you might be in a position to add what you want to 3.5 :) ChrisA I'd check the bug tracker before doing anything. It's perfectly possible that somebody has already done this but the patch hasn't been reviewed yet. Or that, yes. My point is, I doubt there's a strong philosophical reason for there to be a lack of support, but merely that it hasn't been done yet. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: PyWart(2.7.8) IDLE is more buggy than Joe's apartment!
On 7/21/2014 10:27 AM, Grant Edwards wrote: On 2014-07-21, Chris Angelico ros...@gmail.com wrote: You call it a bug because you can't think of any way it could be beneficial. That's the wrong way of looking at it. Something isn't a bug because you find it annoying; it's a bug because it fails to implement the programmer's intentions and/or the docs/specification. I was always taught that it's a bug is when a program doesn't do what a reasonable user expects -- that it's got nothing to do with the programmer's intent. For the Python issue tracker at bugs.python.org, one definition of a behavior ('bug') issue, one that might lead to a patch in maintenance releases of current versions, is a discrepancy between doc claim and code behavior. Discrepancies can be fixed by changing either doc or code to match the other, depending on which is considered to be wrong. Of course, sometime the doc is absent, partial, ambiguous, or confusing. People (such as Rick) proposing enhancements often consider matching code and doc to be buggy by design. But this is different type of issue. For Idle, the doc briefly specifies behavior at a high, user level. File / open should 'open an existing file'. A text box for entry of a path would minimally suffice. The current open file dialog adds the option of filling in the box by clicking around the directory tree. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
How to extract digit from a number?
Hi, I see the following example on line, but it does not work. I do not know what is wrong. Could you correct it for me? Thanks, I'm not sure what [1, 1, 0, 0, 0, 0, ...] has to do with 128, but if you want the base 10 digits: a = 1234 [int(d) for d in str(a)] [1, 2, 3, 4] -- https://mail.python.org/mailman/listinfo/python-list
Re: How to extract digit from a number?
On 2014-07-21 13:14, fl wrote: I see the following example on line, but it does not work. I do not know what is wrong. Could you correct it for me? I'm not sure what [1, 1, 0, 0, 0, 0, ...] has to do with 128, but if you want the base 10 digits: a = 1234 [int(d) for d in str(a)] [1, 2, 3, 4] You don't specify *what* is wrong or what constitutes does not work. If you provide an example of what you *do* want, folks here can help you get closer to the code you need to do what you intend. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: How to extract digit from a number?
On Monday, July 21, 2014 4:26:25 PM UTC-4, Tim Chase wrote: On 2014-07-21 13:14, fl wrote: You don't specify *what* is wrong or what constitutes does not work. If you provide an example of what you *do* want, folks here can help you get closer to the code you need to do what you intend. -tkc The original source input is: a = 1234 [int(d) for d in str(a)] He hopes the output is: [1, 2, 3, 4] In fact, I get the output is: a = 1234 [int(d) for d in str(a)] Traceback (most recent call last): File interactive input, line 1, in module TypeError: 'str' object is not callable BTW, I just add input: import string The error is still there. Why does it say :TypeError: 'str' object is not callable? -- https://mail.python.org/mailman/listinfo/python-list
How to use string constant?
Hi, I learn string constant on Python tutorial at: https://docs.python.org/2/library/string.html Although it gives explanation, it does not show me any example usage. Could you give me an example on using these options? string.digits string.ascii_letters Thanks, -- https://mail.python.org/mailman/listinfo/python-list
Re: How to extract digit from a number?
In article d84aa18f-7c12-4262-a746-218581783...@googlegroups.com, fl rxjw...@gmail.com wrote: a = 1234 [int(d) for d in str(a)] Traceback (most recent call last): File interactive input, line 1, in module TypeError: 'str' object is not callable This looks like you've overwritten str with an *instance* of a string. When a python interpreter starts up, there are certain pre-defined symbols. For example, 'str' is bound to the string class. But, there's nothing to prevent you from re-defining it. Here's an example which produces the same result you got: - $ python Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type help, copyright, credits or license for more information. str = foo a = 1234 [int(d) for d in str(a)] Traceback (most recent call last): File stdin, line 1, in module TypeError: 'str' object is not callable - -- https://mail.python.org/mailman/listinfo/python-list
Re: How to extract digit from a number?
On 2014-07-21 13:42, fl wrote: The original source input is: a = 1234 [int(d) for d in str(a)] He hopes the output is: [1, 2, 3, 4] In fact, I get the output is: a = 1234 [int(d) for d in str(a)] Traceback (most recent call last): File interactive input, line 1, in module TypeError: 'str' object is not callable This sounds suspiciously like you have shadowed the str() function. You might search your code for something like str = test which shadows the built-in str() function. The code you have works at the command-line as long as you haven't shadowed the previously-existing str() function: $ python Python 2.7.3 (default, Mar 13 2014, 11:03:55) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. a = 1234 [int(d) for d in str(a)] [1, 2, 3, 4] -tkc -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
Monte Milanuk memila...@invalid.com writes: On 2014-07-21, Lele Gaifax l...@metapensiero.it wrote: I manage small events with a single notebook and a low cost printer, without network connection, while major events with a network connection may be managed online. You can try it out at http://sol3.arstecnica.it/, using guest/guest as username/password. Wow. I have no idea how the game/events run, but that is a very nice looking program! Thank you! How hard was it to migrate from a desktop app to what you have now? Well, basically I rewrote everything, there's nothing in common. The original application was written in Delphi, using Paradox tables, no i18n, no multiuser, no PDF printouts... On the other hand, with Python is far easier to get something working, and databasing with SQLAlchemy is a pleasure. On the frontend, ExtJS is impressive, even if it has its own drawbacks. Would you recommend this route for someone starting out? Yes, absolutely. You learn something that you can reuse over and over. Do not hesitate to ask for further hints. ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | -- Fortunato Depero, 1929. -- https://mail.python.org/mailman/listinfo/python-list
Re: Event loop documentation error
On 7/21/2014 2:38 PM, Yaşar Arabacı wrote: I was reading https://docs.python.org/3/library/asyncio-eventloop.html#example-set-signal-handlers-for-sigint-and-sigterm and wanted to test the example, With 3.4.0, 3.4.1, or 3.5.0a0 in the repository (available to view at hg.python.org, I believe)? Asyncio is patched at least once a week You can access the latest version of the 3.5 docs online (see the box in upper left corner) also to check how the example is written today. however, I am getting this error when I run the code; Traceback (most recent call last): File C:/Users/gorki/Documents/Python Scripts/as-io.py, line 14, in module loop.add_signal_handler(SIGINT, partial(ask_exit, SIGINT)) File C:\Python34\lib\asyncio\events.py, line 329, in add_signal_handler raise NotImplementedError NotImplementedError I was wondering if there is something I am doing wrong, or is this behaviour platform specific (I am on windows 7). I wanted to ask in the list before I file a bug report. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: How to use string constant?
On 7/21/2014 4:46 PM, fl wrote: Hi, I learn string constant on Python tutorial at: https://docs.python.org/2/library/string.html Although it gives explanation, it does not show me any example usage. Could you give me an example on using these options? string.digits string.ascii_letters import string 'a' in string.ascii_letters True 'a' in string.digits False -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
asyncip application hangs
I am trying to grasp how asyncio works today. Based on the examples that I found on the docs, I write a simple program like this; import asyncio import urllib.request import urllib.parse @asyncio.coroutine def print_status_code(url_q): while True: url = yield from url_q.get() print('URL recieved from q:', url) if url is None: return url = urllib.parse.urlsplit(url) reader, writer = yield from asyncio.open_connection(url.hostname, 80) query = ('GET {url.path} HTTP/1.0\r\n' 'Host: {url.hostname}\r\n' '\r\n').format(url=url) writer.write(query.encode('latin-1')) line = yield from reader.readline() code = line.decode('latin1').split()[0] print((%s) %s, code, url.path) if __name__ == __main__: from bs4 import BeautifulSoup as bs sitemap = urllib.request.urlopen('http://ysar.net/sitemap.xml').read() soup = bs(sitemap) print('soup created') tasks = [] num_coroutines = 10 q = asyncio.Queue() for i in range(num_coroutines): # start 10 tasks tasks.append(asyncio.Task(print_status_code(q))) for loc in soup.find_all('loc'): q.put(loc.string) for i in range(num_coroutines): # Put poison pil. q.put(None) loop = asyncio.get_event_loop() loop.run_until_complete(asyncio.wait(tasks)) This program is supposed to give me status codes for web pages that are found on my sitemap.xml file. But program hangs as Tasks wait for getting something out of the Queue. I think it has something to do with how I am using asyncio.Queue, but I couldn't figure out what am I doing wrong here. Can anyone help me with that? -- http://ysar.net/ -- https://mail.python.org/mailman/listinfo/python-list
Re: asyncip application hangs
2014-07-22 1:19 GMT+03:00 Yaşar Arabacı yasar11...@gmail.com: This program is supposed to give me status codes for web pages that are found on my sitemap.xml file. But program hangs as Tasks wait for getting something out of the Queue. I think it has something to do with how I am using asyncio.Queue, but I couldn't figure out what am I doing wrong here. Can anyone help me with that? Ok, I figured out what was wrong with my code. Since asyncio.Queue.put() is a coroutine, I should have wrapped those with asyncio.Task in order for them to start executing. Therefore, this works; q = asyncio.Queue() loop = asyncio.get_event_loop() for i in range(num_coroutines): # start 10 tasks tasks.append(asyncio.Task(print_status_code(q))) for loc in soup.find_all('loc'): asyncio.Task(q.put(loc.string)) for i in range(num_coroutines): # Put poison pil. asyncio.Task(q.put(None)) print(%i items in queue % q.qsize()) loop.run_until_complete(asyncio.wait(tasks)) -- http://ysar.net/ -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
On 2014-07-21, Lele Gaifax l...@metapensiero.it wrote: Monte Milanuk memila...@invalid.com writes: How hard was it to migrate from a desktop app to what you have now? Well, basically I rewrote everything, there's nothing in common. The original application was written in Delphi, using Paradox tables, no i18n, no multiuser, no PDF printouts... On the other hand, with Python is far easier to get something working, and databasing with SQLAlchemy is a pleasure. On the frontend, ExtJS is impressive, even if it has its own drawbacks. Any hints/opinions on what those drawbacks might be? I know literally almost nothing about JS. I worked thru a short generic tutorial a couple years ago, but nothing like these libraries I see people talking about now like jquery, angular, ext, and so on. Hence my hesitation at adding another learning curve on top of python and the various libraries needed for this first 'real' project. Monte -- https://mail.python.org/mailman/listinfo/python-list
A Pythonista Meets JavaScript™ (was: Network/multi-user program)
Monte Milanuk memila...@invalid.com writes: I know literally almost nothing about JS. At the Melbourne Python Users's Group this year, I gave a presentation URL:http://vimeo.com/album/2855296/video/93691338 on my initial learnings of JavaScript™ (and ECMAScript) from a Python programmer's perspective. Hope that's useful to anyone interested in the intersection of these languages and their cultures. -- \ “If consumers even know there's a DRM, what it is, and how it | `\ works, we've already failed.” —Peter Lee, Disney corporation, | _o__) 2005 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Network/multi-user program
In article mailman.12158.1405983216.18130.python-l...@python.org, Monte Milanuk memila...@invalid.com wrote: Any hints/opinions on what those drawbacks might be? I know literally almost nothing about JS. I worked thru a short generic tutorial a couple years ago, but nothing like these libraries I see people talking about now like jquery, angular, ext, and so on. Hence my hesitation at adding another learning curve on top of python and the various libraries needed for this first 'real' project. In the beginning, there was javascript. It was used to do cutesy little things like animated U/I elements and perform certain actions when your browser detected events like clicking on a button or moving the mouse cursor over an image. But, javascript is a real (if bletcherous) programming language. It's got functions and variables and loops and if statements and classes (OK, it doesn't really have classes, but it has things that we can pretend are classes, if we squint hard). It can talk to the network and generate HTML on the fly. So, people started building a whole new kind of web site. Instead of having an application running on the server which spits out HTML and CSS, and little bits of javascript to tweak those, we've got a full-blown javascript application running in the browser. That application is retrieving data from the server, doing useful things with it, and totally managing the HTML that you see rendered in your browser window. Things like jquery and (even more so) angular, backbone, ember, etc, are frameworks which make it easier to write these applications, in much the same way frameworks like django make it easier to write server-side web applications in Python. The truly sucky part of this picture is that javascript is a horrible language, but you have no choice. It's the only thing that runs in browsers. On the server side, if you don't like Python, you can write your app in Java, or Go, or Ruby, or a host of other languages (even javascript, if you want). On the client side, no so much. -- https://mail.python.org/mailman/listinfo/python-list
async, on-demand lazy rendering for jinja2 possible?
Hi all, Been reading @igrigorik's posts https://www.igvita.com/archives/ I found that flush response as early as possible is crucial for a website performance. I wanna make Time To First Byte (TTTFB) happen as early as possible with a Jinja2 site, Suppose a typical Jinja2 template: htmlhead title{{ site_title }}/title /headbody ul {% for item in items %} liitem/li {% endfor %} /ul /body/html Let's presume site_title is static and known in view function from the start, I wanna flush everything before body to the client as early as possible, then items was a query from db, it's kinda slower, let's flush the everything below body later in a second TCP packet. This looks like impossible at the moment. I searched the Jinja2 docs, the closest thing I've found is the streaming template API jinja2.Template('Hello {{ name }}!').stream(name='foo') Which still requires all variables to be ready before rendering. Is there a way to stream partial template results with partial template variables? This would be great help making faster websites. Other template engine than Jinja2 is welcome as long as it's in python! Thanks in advance! -- https://mail.python.org/mailman/listinfo/python-list
Re: Installing Python 2.6.2 on Ubuntu 12.1
Greetings, The installation went through successfully, however I noticed that some of the _*.so files did not get built under lib/python2.6/lib-dynload/ folder (eg _sha256.so) , which is likely the reason why my setuptools install failed due to the error: I believe you need the developer libraries for that (including the C header files). IIRC sudo apt-get build-dep python should install all the required packages. HTH, -- Miki -- https://mail.python.org/mailman/listinfo/python-list
[issue22020] tutorial 9.10. Generators statement error
New submission from Albert Ho: https://docs.python.org/3/tutorial/classes.html for char in reverse('golf'): I found that reverse didnt work and i check the doc https://docs.python.org/3.4/library/functions.html#reversed reversed(seq)¶ I guess it just forget to change the statement -- messages: 223560 nosy: rt135792005 priority: normal severity: normal status: open title: tutorial 9.10. Generators statement error type: compile error versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22020 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22020] tutorial 9.10. Generators statement error
Ezio Melotti added the comment: The reverse function is defined just above the example that uses it. -- assignee: - docs@python components: +Documentation nosy: +docs@python, ezio.melotti resolution: - not a bug stage: - resolved status: open - closed type: compile error - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22020 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22013] Add at least minimal support for thread groups
Charles-François Natali added the comment: Tin Tvrtković added the comment: For your examples, my first instinct would be to use a thread pool executor. It's a nice high level API and can already do the aggregate join. Indeed, the examples posted don't make much sense: thread/process pools are the way to go. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22013 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21901] test_selectors.PollSelectorTestCase.test_above_fd_setsize reported killed by shell
Charles-François Natali added the comment: rdmurray@pydev:~/python/p34python -c 'import resource; print(resource.getrlimit(resource.RLIMIT_NOFILE))' (1024L, 1048576L) Oh, 1 million files is much bigger than 4 thousand files (4096). The test should only test FD_SETSIZE + 10 files, the problem is to get FD_SETSITE: We could cap it to let's say 2**16, it's larger than any possible FD_SETSIZE (which are usually low since fd_set are often allocated on the stack and select() doesn't scale well behind that anyway). But I don't see anything wrong with the test, it's really the buildbot setting which is to blame: I expect other tests to fail with such a low max virtual memory. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21901 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16778] Logger.findCaller needs to be smarter
Vinay Sajip added the comment: Maybe simply having a class list Thanks, I'm aware of this approach and have considered it. The current patch's skipCallers API seems better than exposing an internal list, but I have held off implementing this in the hope that an approach based on frame annotations can be used. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16778 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX
Ronald Oussoren added the comment: I just confirmed that clang only uses the LSB for _Bool values by looking at the assembly generated for the following code: quote #include stdbool.h #include stdio.h int main(void) { _Bool x; *(unsigned char*)x = 42; printf(%d\n, (int)x); return 0; } /quote The attached patch fixes the issue for me. The new testcase fails without the changes to _struct.c and passes with those changes. -- Added file: http://bugs.python.org/file36010/issue-22012.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22012 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22012] struct.unpack('?', '\x02') returns (False,) on Mac OSX
Ronald Oussoren added the comment: The last draf of ISO C '11: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf. This says that _Bool is large enough to store 0 and 1, and that conversion of any integer data to _Bool results in 0 or 1. If I interpret the document correctly there is no conforming way to create a value of _Bool that has a value other than 0 or 1, and that should mean clang's behavior is not a bug. BTW. I haven't tested my patch on a PPC system yet (where sizeof(bool) != 1), and won't be able to do so until I'm back home (I'm currently at EuroPython) -- keywords: +needs review, patch stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22012 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17695] _sysconfigdata broken with universal builds on OSX
Ronald Oussoren added the comment: Sure... The issue is still present. To demonstrate the problem: arch -i386 ./python.exe Python 3.5.0a0 (default:9b450b19aa11+, Jul 21 2014, 10:03:38) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin Type help, copyright, credits or license for more information. import sys sys.maxsize 2147483647 import sysconfig sysconfig.get_config_var('SIZEOF_LONG') 8 This is on a machine that can run 64-bit code and uses a fat binary with i386 and x86_64 support. The script generating _sysconfigdata.py used the x86_64 code and hence created data that's only valid for the x86_64 binary. It's easy enough to to create a patch that reproduces the preprocessor code in pymacconfig.h in sysconfig.py, but I'm not sure if that is the right fix in particular due to the vagueness of the sysconfig API. A short rant: IMHO the current API of sysconfig is underspecified and tied way to much the arbitrary details of the CPython build system (not the actual function keys, but the set of information that can be retrieved). There is no documentation at all on which keys are present and what there meaning is. As an example, there have been a number of issues in the past where users tried to use the value for key that's only meant to be used at CPython build time and users complained that the value didn't work for them with an installed CPython. -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17695 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22021] shutil.make_archive() root_dir do not work
New submission from Weinan Li: set root_dir do not work output: = Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] on win32 Type copyright, credits or license() for more information. import shutil shutil.make_archive(tmp.tar.gz, gztar, c:/xjtu, c:/tmp) 'C:\\Python34\\tmp.tar.gz.tar.gz' = source code of make_archive() = 756save_cwd = os.getcwd() 757if root_dir is not None: 758if logger is not None: 759logger.debug(changing into '%s', root_dir) 760base_name = os.path.abspath(base_name) 761if not dry_run: 762os.chdir(root_dir) ... ... 782try: 783filename = func(base_name, base_dir, **kwargs) 784finally: = base_name is set before chdir, so the archive always be created in cwd, whether set root_dir or not. so, line 760 should be move below line 762 -- components: Library (Lib) messages: 223568 nosy: DemoHT priority: normal severity: normal status: open title: shutil.make_archive() root_dir do not work type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22021 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22021] shutil.make_archive() root_dir do not work
Ezio Melotti added the comment: Thanks for the report, do you want to provide a patch? (You can check the devguide if you need more information.) -- keywords: +easy nosy: +ezio.melotti, hynek, tarek stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22021 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8706] accept keyword arguments on most base type methods and builtins
Julien Palard added the comment: I think for some builtins it may be usefull to have keyword arguments, in the case they take more than one parameter. Typically, it's impossible to write: self.drop_elements(partial(isinstance, type(lxml.etree.Comment))) Because isinstance take its argument in the other order, we may bypass this using keywords arguments: self.drop_elements(partial(isinstance, type=type(lxml.etree.Comment))) But isinstance refuses keyword arguments, so there is no way to write this without a lambda: self.drop_elements(lambda x: isinstance(x, type(lxml.etree.Comment))) With is cool and work, I agree, it's just an example to explicitly show why keywords argument may be cool: functools.partial. -- nosy: +Julien.Palard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8706 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21901] test_selectors.PollSelectorTestCase.test_above_fd_setsize reported killed by shell
R. David Murray added the comment: That is the only test that fails for lack of memory. And it's not the buildbot, it's my development virtual machine. Having the test suite be killed when I do a full test run is...rather annoying. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21901 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22021] shutil.make_archive() root_dir do not work
R. David Murray added the comment: I believe this is working as designed, although the documentation does not make that clear. root dir is the root directory of the *created archive*, it has nothing to do with where the archive file itself is placed. -- assignee: - docs@python components: +Documentation nosy: +docs@python, r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22021 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21901] test_selectors.PollSelectorTestCase.test_above_fd_setsize reported killed by shell
Charles-François Natali added the comment: Alright, I'll cap the value then (no need to expose FD_SETSIZE). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21901 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22018] signal: accept socket for signal.set_wakeup_fd()
Roundup Robot added the comment: New changeset 6b536f0516ea by Victor Stinner in branch 'default': Issue #22018: Add _testcapi.raise_signal() http://hg.python.org/cpython/rev/6b536f0516ea -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22018] signal: accept socket for signal.set_wakeup_fd()
STINNER Victor added the comment: My worry is that somehow a program has a fd that refers to both a file and a socket. But I agree that changing the API is not a great option either. Well, when I read again my patch and played with it, I saw that it has different issues: - a Windows socket handle is not an int, but a pointer: Python SOCKET_T type should be used instead - when send() fails, we should reuse the code from socketmodule.c to raise an exception: we may need to check GetLastError() on Windows I rewrote my patch to add a new function signal.set_wakeup_socket() instead of trying to guess if the file descriptor is a socket or a file. I adopted a similar approach in the PEP 446 with os.set_inheritable() and os.set_handle_inheritable() for the same reason: support sockets on Windows, socket.socket.set_inheritable() uses os.set_inheritable() on UNIX and os.set_handle_inheritable() on Windows. signal.set_wakeup_socket() now takes a socket.socket object and returns the previous socket object (or None). In the new patch, signal.set_wakeup_fd() and Py_SetWakeupFd() function are unchanged, which is more safer regarding to backward compatibility! The first call to signal.set_wakeup_socket() imports the _socket module. The Visual Studio still needs to be modified to add the dependency to the WinSock library (ws2_32.lib), just for the send() function. -- Added file: http://bugs.python.org/file36011/signal_socket-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16748] Make CPython test package discoverable
Changes by Zachary Ware zachary.w...@gmail.com: -- dependencies: +Make full use of test discovery in test subpackages versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16748 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22002] Make full use of test discovery in test subpackages
Zachary Ware added the comment: Thank you, Brett and David. @Mark: This issue is a continuation of the #16748 effort (#16748 is a meta-issue for this kind of thing) and unrelated to #10572 (though this will add a feature to test.support that can be useful for the scattered test packages). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22002 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22002] Make full use of test discovery in test subpackages
Zachary Ware added the comment: Victor, could you give me a yay or nay on the test_asyncio change? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22002 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22018] signal: accept socket for signal.set_wakeup_fd()
Roundup Robot added the comment: New changeset 42cf963e3ab1 by Victor Stinner in branch 'default': Issue #22018: signal.set_wakeup_fd() now raises an OSError instead of a http://hg.python.org/cpython/rev/42cf963e3ab1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22005] datetime.__setstate__ fails decoding python2 pickle
Edward O added the comment: The code works when using encoding='bytes'. Thanks Tim for the suggestion. So this is not a bug, but is there any sense in having encoding='ASCII' by default in pickle ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22005 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22018] Add a new signal.set_wakeup_socket() function
Changes by STINNER Victor victor.stin...@gmail.com: -- title: signal: accept socket for signal.set_wakeup_fd() - Add a new signal.set_wakeup_socket() function ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22018] Add a new signal.set_wakeup_socket() function
Roundup Robot added the comment: New changeset 7a1737033a23 by Victor Stinner in branch 'default': Issue #22018: Hum, set_wakeup_fd() still raises ValueError on Windows http://hg.python.org/cpython/rev/7a1737033a23 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22018 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
Antoine Pitrou added the comment: Pretty sure this approach is broken. What about the alternative approach of specializing for Bytes? That would certainly sound good enough, to optimize the common case. Also, it would be nice if you could add some tests to the patch (e.g. to stress the bytearray case). Thank you! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
Antoine Pitrou added the comment: As for whether the checking for a readonly view approach is broken, I don't know: that part of the buffer API is still mysterious to me. Stefan, would you have some insight? -- nosy: +skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22013] Add at least minimal support for thread groups
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22013 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
Stefan Krah added the comment: I think checking for a readonly view is fine. The protocol is this: 1) Use the PyBUF_WRITABLE flag in the request. Then the provider must either have a writable buffer or else deny the request entirely. 2) Omit the PyBUF_WRITABLE flag in the request. Then the provider can return a writable or a readonly buffer, but must set the readonly flag correctly AND export the same type of buffer to ALL consumers. It is not possible to ask for a readonly buffer explicitly, but the readonly flag in the Py_Buffer struct should always be set correctly. It is hard to guess the original intention of the PEP-3118 authors, but in practice readonly means immutable here. IMO a buffer provider would be seriously broken if a readonly buffer is mutated in any way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22022] test_pathlib: shutil.rmtree() sporadic failures on Windows
New submission from STINNER Victor: Sometimes, test_pathlib fails because shutil.rmtree() cannot remove a test directory. Example: http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/4833/steps/test/logs/stdio == ERROR: test_touch_common (test.test_pathlib.WindowsPathTest) -- Traceback (most recent call last): File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 477, in rmtree return _rmtree_unsafe(path, onerror) File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 367, in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 376, in _rmtree_unsafe onerror(os.rmdir, path, sys.exc_info()) File C:\buildbot.python.org\3.x.kloth-win64\build\lib\shutil.py, line 374, in _rmtree_unsafe os.rmdir(path) OSError: [WinError 145] The directory is not empty: 'C:\\buildbot.python.org\\3.x.kloth-win64\\build\\build\\test_python_3444\\@test_3444_tmp\\dirB' The error comes from this cleanup function: self.addCleanup(shutil.rmtree, BASE) I don't understand how rmtree() can fail with The directory is not empty. Note: this buildbot runs 4 tests in parallel using the -j4 command line option of regrtest. -- components: Tests, Windows keywords: buildbot messages: 223584 nosy: haypo priority: normal severity: normal status: open title: test_pathlib: shutil.rmtree() sporadic failures on Windows versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22022 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22022] test_pathlib: shutil.rmtree() sporadic failures on Windows
Ned Batchelder added the comment: FWIW, every use of rmtree I have on Windows occasionally fails this way, parallelism seems not to be a factor. -- nosy: +nedbat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22022 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
Stefan Krah added the comment: The original wording in the PEP is this: readonly an integer variable to hold whether or not the memory is readonly. 1 means the memory is readonly, zero means the memory is writable. To me this means that a hypothetical compiler that could figure out at compile time that the readonly flag is set would be allowed to put the buffer contents into the read-only data section. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22005] datetime.__setstate__ fails decoding python2 pickle
Tim Peters added the comment: @eddygeek, I'd still call something so unintuitive a bug - it's hard to believe this is the _intended_ way to get it to work. So I'd keep this open until someone with better knowledge of intent chimes in. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22005 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21822] KeyboardInterrupt during Thread.join hangs that Thread
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21822 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22003] BytesIO copy-on-write
David Wilson added the comment: Stefan, Thanks for digging here. As much as I'd love to follow this interpretation, it simply doesn't match existing buffer implementations, including within the standard library. For example, mmap.mmap(..., flags=mmap.MAP_SHARED, prot=mmap.PROT_READ) will produce a read-only buffer, yet mutability is entirely at the whim of the operating system. In this case, immutability may be apparent for years, until some machine has memory pressure, causing the shared mapping to be be flushed, and refreshed from (say, incoherent NFS storage) on next access. I thought it would be worth auditing some of the most popular types of buffer just to check your interpretation, and this was the first, most obvious candidate. Any thoughts? I'm leaning heavily toward the Bytes specialization approach -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22003 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22022] test_pathlib: shutil.rmtree() sporadic failures on Windows
Zachary Ware added the comment: This looks like a duplicate of #19811, which was closed as a duplicate of #19629. -- nosy: +zach.ware resolution: - duplicate stage: - resolved status: open - closed superseder: - support.rmtree fails on symlinks under Windows ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22022 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19811] test_pathlib: The directory is not empty error on os.rmdir()
Roundup Robot added the comment: New changeset 1db5cde4958f by Victor Stinner in branch '3.4': Issue #19811, #22022: test_pathlib uses support.rmtree() instead of http://hg.python.org/cpython/rev/1db5cde4958f New changeset e405bcbf761c by Victor Stinner in branch 'default': Merge Python 3.4 http://hg.python.org/cpython/rev/e405bcbf761c -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19811 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19629] support.rmtree fails on symlinks under Windows
Roundup Robot added the comment: New changeset 28bb1aa9ca3d by Victor Stinner in branch '3.4': Issue #19629: Fix support.rmtree(), use os.lstat() to check if the file is a http://hg.python.org/cpython/rev/28bb1aa9ca3d New changeset e405bcbf761c by Victor Stinner in branch 'default': Merge Python 3.4 http://hg.python.org/cpython/rev/e405bcbf761c -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19629 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22022] test_pathlib: shutil.rmtree() sporadic failures on Windows
Roundup Robot added the comment: New changeset 1db5cde4958f by Victor Stinner in branch '3.4': Issue #19811, #22022: test_pathlib uses support.rmtree() instead of http://hg.python.org/cpython/rev/1db5cde4958f New changeset e405bcbf761c by Victor Stinner in branch 'default': Merge Python 3.4 http://hg.python.org/cpython/rev/e405bcbf761c -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22022 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20064] PyObject_Malloc is not documented
Zachary Ware added the comment: It appears that PyObject_Realloc and PyObject_Free are also not documented; they should be along with PyObject_Malloc. I also left a couple of comments on Rietveld. -- nosy: +zach.ware stage: needs patch - patch review versions: +Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20064 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22023] PyUnicode_FromFormat is broken on python 2
New submission from Alex Gaynor: http://hg.python.org/cpython/file/2.7/Objects/unicodeobject.c#l840 Specifically it calls PyObject_Str, which will return a PyStringObject * (cast to a PyObject *), and then calls PyUnicode_GET_SIZE, which is of course totally incorrect. This code was originally back-ported from 3.0 - 2.6, so I imagine no one caught the bug then. -- components: Interpreter Core, Unicode messages: 223594 nosy: alex, ezio.melotti, haypo priority: normal severity: normal status: open title: PyUnicode_FromFormat is broken on python 2 versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22023 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com