Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1601.1280974847.1673.python-l...@python.org, David Robinow wrote: Lawrence, you've been asking a lot of off-topic questions about Microsoft Windows. You’ve got to be kidding. Look at the number of Windows-specific questions this groups is already full of. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: You’ve got to be kidding. Look at the number of Windows-specific questions this groups is already full of. Are you really unable to tell the difference between questions about Windows-related modules and snarky, off-topic sniping at Windows itself? -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1445.1280767895.1673.python-l...@python.org, David Robinow wrote: As an admittedly stupid comparison, I have 1579 DLLs in my \windows\system32 directory. Some number of these have been upgraded by Windows Update. What about the ones that aren’t? How do you maintain those? -- http://mail.python.org/mailman/listinfo/python-list
Re: Package management (was: Why is there no platform independent way of clearing a terminal?)
In message 87aap44mc7.fsf...@benfinney.id.au, Ben Finney wrote: Sadly, Python's package management is rather lacking by these standards. The Distutils legacy assumption of “package recipient, system administrator, and end user are all the same person”, among other design decisions, makes it unusually difficult to have the necessary separation of concerns between OS packaging, system administration, and end user. Doesn’t matter. I’m pretty sure Debian has a way of automatically turning a distutils build into a .deb package with all the right dependencies. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Wed, Aug 4, 2010 at 6:47 PM, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message mailman.1445.1280767895.1673.python-l...@python.org, David Robinow wrote: As an admittedly stupid comparison, I have 1579 DLLs in my \windows\system32 directory. Some number of these have been upgraded by Windows Update. What about the ones that aren’t? How do you maintain those? Lawrence, you've been asking a lot of off-topic questions about Microsoft Windows. I think it's wonderful that you're so open to new ideas, but suggest that you take it to a Windows group, where I'm sure you'll get a friendly response. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In messagemailman.1383.1280649150.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In messagemailman.1382.1280646210.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) I run Debian Unstable, which has new goodies coming out on a weekly basis. The last time I checked for updates, there were over 500 packages I had installed for which updates were available. It only took a command like the above to upgrade them all. How many .msi files would you have to click on to achieve the Windows equivalent? ... I simply couldn't cope with over 500 installed packages. Precisely my point. Go back to playing with your .msi toys. Oh, andhttp://dilbert.com/strips/comic/1995-06-24/. Repeating what was obviously deliberately snipped. No idea, but your mental capacity is clearly infinitely higher than mine, as I simply couldn't cope with over 500 installed packages. What do they all do, make your lunch and fetch the beer from the fridge amongst other things? How does any user or an admin cope with 500 packages? Can Python help here, assume an eight hour working day? c:\Python31\Libpython Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. 8*60*60/500 57.6 So every working day you have 57.6 seconds to use each package. Strangely I don't think anyone will get too much done. Am I in cloud cuckoo land or are you? As it happens, I'm also not a windows fan, did most of my work on VMS. Which to repeat myself stands for Very Much Safer. Thinking of which did *nix ever get around to providing proper clustering, or does VMS still rule? Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Mon, Aug 2, 2010 at 8:21 AM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In messagemailman.1383.1280649150.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In messagemailman.1382.1280646210.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) I run Debian Unstable, which has new goodies coming out on a weekly basis. The last time I checked for updates, there were over 500 packages I had installed for which updates were available. It only took a command like the above to upgrade them all. How many .msi files would you have to click on to achieve the Windows equivalent? ... I simply couldn't cope with over 500 installed packages. Precisely my point. Go back to playing with your .msi toys. Oh, andhttp://dilbert.com/strips/comic/1995-06-24/. Repeating what was obviously deliberately snipped. No idea, but your mental capacity is clearly infinitely higher than mine, as I simply couldn't cope with over 500 installed packages. What do they all do, make your lunch and fetch the beer from the fridge amongst other things? How does any user or an admin cope with 500 packages? Can Python help here, assume an eight hour working day? c:\Python31\Libpython Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. 8*60*60/500 57.6 So every working day you have 57.6 seconds to use each package. Strangely I don't think anyone will get too much done. Am I in cloud cuckoo land or are you? You seem to be mistaken as to what a package is. Python : * python * python-minimal * python2.6 * libbz2 * libc6 * libdb4.8 * libncursesw5 * libreadline6 * mime-support * python2.6-minimal * libssl0.9.8 * zlib1g * debconf * perl-base * dpkg * coreutils * lzma * libacl1 * libattr1 * libselinux1 * libgcc1 * libstdc++6 * gcc-4.4-base * libncurses5 * readline-common So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop environment, the window manager, the terminal, and whatever else you want running. In my fairly clean Ubuntu VM (I use it almost exclusively for testing), I have close to 1500 packages installed. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 02/08/2010 16:41, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 8:21 AM, Mark Lawrencebreamore...@yahoo.co.ukwrote: On 01/08/2010 12:10, Lawrence D'Oliveiro wrote: In messagemailman.1383.1280649150.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In messagemailman.1382.1280646210.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) I run Debian Unstable, which has new goodies coming out on a weekly basis. The last time I checked for updates, there were over 500 packages I had installed for which updates were available. It only took a command like the above to upgrade them all. How many .msi files would you have to click on to achieve the Windows equivalent? ... I simply couldn't cope with over 500 installed packages. Precisely my point. Go back to playing with your .msi toys. Oh, andhttp://dilbert.com/strips/comic/1995-06-24/. Repeating what was obviously deliberately snipped. No idea, but your mental capacity is clearly infinitely higher than mine, as I simply couldn't cope with over 500 installed packages. What do they all do, make your lunch and fetch the beer from the fridge amongst other things? How does any user or an admin cope with 500 packages? Can Python help here, assume an eight hour working day? c:\Python31\Libpython Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. 8*60*60/500 57.6 So every working day you have 57.6 seconds to use each package. Strangely I don't think anyone will get too much done. Am I in cloud cuckoo land or are you? You seem to be mistaken as to what a package is. Python : * python * python-minimal * python2.6 * libbz2 * libc6 * libdb4.8 * libncursesw5 * libreadline6 * mime-support * python2.6-minimal * libssl0.9.8 * zlib1g * debconf * perl-base * dpkg * coreutils * lzma * libacl1 * libattr1 * libselinux1 * libgcc1 * libstdc++6 * gcc-4.4-base * libncurses5 * readline-common So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop environment, the window manager, the terminal, and whatever else you want running. In my fairly clean Ubuntu VM (I use it almost exclusively for testing), I have close to 1500 packages installed. -- http://mail.python.org/mailman/listinfo/python-list I'll stick with my msi files and/or windows update then, unless I have the luck to get back to VMS. As I said earlier it strikes me that this *nix stuff is simply archaic. Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan benjamin.kap...@case.edu wrote: ... So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop environment, the window manager, the terminal, and whatever else you want running. In my fairly clean Ubuntu VM (I use it almost exclusively for testing), I have close to 1500 packages installed. As an admittedly stupid comparison, I have 1579 DLLs in my \windows\system32 directory. Some number of these have been upgraded by Windows Update. This is XP Service Pack 3. I'm not sure if this means that Windows is better because it has more packages or that it is worse because it's got too many. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Mon, Aug 2, 2010 at 9:51 AM, David Robinow drobi...@gmail.com wrote: On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan benjamin.kap...@case.edu wrote: ... So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop environment, the window manager, the terminal, and whatever else you want running. In my fairly clean Ubuntu VM (I use it almost exclusively for testing), I have close to 1500 packages installed. As an admittedly stupid comparison, I have 1579 DLLs in my \windows\system32 directory. Some number of these have been upgraded by Windows Update. This is XP Service Pack 3. I'm not sure if this means that Windows is better because it has more packages or that it is worse because it's got too many. :) -- A package is usually more than one file. http://packages.ubuntu.com/lucid/amd64/linux-image-2.6.32-21-generic/filelist http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 02/08/2010 19:14, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 9:51 AM, David Robinowdrobi...@gmail.com wrote: On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan benjamin.kap...@case.edu wrote: ... So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop environment, the window manager, the terminal, and whatever else you want running. In my fairly clean Ubuntu VM (I use it almost exclusively for testing), I have close to 1500 packages installed. As an admittedly stupid comparison, I have 1579 DLLs in my \windows\system32 directory. Some number of these have been upgraded by Windows Update. This is XP Service Pack 3. I'm not sure if this means that Windows is better because it has more packages or that it is worse because it's got too many. :) -- A package is usually more than one file. http://packages.ubuntu.com/lucid/amd64/linux-image-2.6.32-21-generic/filelist http://mail.python.org/mailman/listinfo/python-list This is all very well, but what is the unladen airspeed velocity of a swallow in flight? Answers on a postcard please, given that I expect both direction and speed! Kindest regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Package management (was: Why is there no platform independent way of clearing a terminal?)
Mark Lawrence breamore...@yahoo.co.uk writes: How does any user or an admin cope with 500 packages? Operating systems with good package management come with tools that help the administrator do this job easily. Also, operating systems with good package management encourage the small-pieces-loosely-joined philosophy to apply to packages also: the packages tend to be smaller and more focussed, and fit together in more well-defined ways, than those on other OSen. This isn't automatic, but the support of a good package management system allows a robust policy to be implemented by the vendor for good quality packages in the OS. So “installing 500 packages” is not an unusual nor onerous thing to do on such an OS. The job of making them all work well together is delegated upstream, to one's distribution vendor. But the fact that they're small pieces, loosely joined, means that if any one of them is causing a problem, it's far more likely that a motivated administrator can do something about it locally, rather than being at the mercy of the vendor. Can Python help here, assume an eight hour working day? Sadly, Python's package management is rather lacking by these standards. The Distutils legacy assumption of “package recipient, system administrator, and end user are all the same person”, among other design decisions, makes it unusually difficult to have the necessary separation of concerns between OS packaging, system administration, and end user. There have been great strides in recent years to improve the Distutils shortcomings (see the Distutils forum archives for the details), but the changes are in part backward-incompatible, and it will be some time before Python is on a par with, e.g., Perl in this area. So every working day you have 57.6 seconds to use each package. Your mistaken assumption is that one would use these packages separate from each other. That's like assuming that the limit of usefulness of modules in a Python program is how much one can use each of them separate from all the others. In both cases, they're not used separately most of the time; they're used in conjunction, and their distinction is more to enable the people responsible for maintaining them to do so as distinct pieces when it makes sense to do so, and as larger aggregate collections when that makes sense. OS packages are not only applications. They are any discrete, coherent “piece” of an operating system; applications usually encompass one or several packages, and most packages are not applications. -- \ “We must respect the other fellow's religion, but only in the | `\ sense and to the extent that we respect his theory that his | _o__) wife is beautiful and his children smart.” —Henry L. Mencken | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Mark Lawrence wrote: On 02/08/2010 19:14, Benjamin Kaplan wrote: On Mon, Aug 2, 2010 at 9:51 AM, David Robinowdrobi...@gmail.com wrote: On Mon, Aug 2, 2010 at 11:41 AM, Benjamin Kaplan benjamin.kap...@case.edu wrote: ... So these are the packages needed just to run Python in Ubuntu. It doesn't include the packages required for the kernel, the desktop environment, the window manager, the terminal, and whatever else you want running. In my fairly clean Ubuntu VM (I use it almost exclusively for testing), I have close to 1500 packages installed. As an admittedly stupid comparison, I have 1579 DLLs in my \windows\system32 directory. Some number of these have been upgraded by Windows Update. This is XP Service Pack 3. I'm not sure if this means that Windows is better because it has more packages or that it is worse because it's got too many. :) -- A package is usually more than one file. http://packages.ubuntu.com/lucid/amd64/linux-image-2.6.32-21-generic/filelist http://mail.python.org/mailman/listinfo/python-list This is all very well, but what is the unladen airspeed velocity of a swallow in flight? Answers on a postcard please, given that I expect both direction and speed! African or European? :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 01/08/2010 06:17, Tim Harig wrote: On 2010-08-01, Lawrence D'Oliveirol...@geek-central.gen.new_zealand wrote: In messagei2q3sk$3p...@speranza.aioe.org, Tim Harig wrote: It would be rewarding as it would make writing cross-platform charactor mode applications possible. I thought Windows users were allergic to command lines. To the best of my knowledge, there have never been any documentated cases of computer software related alleries. There are however several chemicals used in the process of constructing computer hardware componets which have been linked to allergy illnesses. Maybe Windows users are simply allergic to their computers. Windows users biggest allergy is to this strange world that involves make on other boxes, whatever that is, it strikes me as rather archaic. Personally I find double clicking on an msi file rather easier. Regards. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1382.1280646210.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) I run Debian Unstable, which has new goodies coming out on a weekly basis. The last time I checked for updates, there were over 500 packages I had installed for which updates were available. It only took a command like the above to upgrade them all. How many .msi files would you have to click on to achieve the Windows equivalent? -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In messagemailman.1382.1280646210.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) I run Debian Unstable, which has new goodies coming out on a weekly basis. The last time I checked for updates, there were over 500 packages I had installed for which updates were available. It only took a command like the above to upgrade them all. How many .msi files would you have to click on to achieve the Windows equivalent? No idea, but your mental capacity is clearly infinitely higher than mine, as I simply couldn't cope with over 500 installed packages. What do they all do, make your lunch and fetch the beer from the fridge amongst other things? Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Lawrence D'Oliveiro wrote: How many .msi files would you have to click on to achieve the Windows equivalent? Don't you just leave the machine on overnight and wait for Microsoft to download all the stuff they think you should be using? -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message 8bkosifpi...@mid.individual.net, Gregory Ewing wrote: Don't you just leave the machine on overnight and wait for Microsoft to download all the stuff they think you should be using? That’s fine, but it doesn’t handle the non-Microsoft stuff. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-08-01, Mark Lawrence breamore...@yahoo.co.uk wrote: On 01/08/2010 06:17, Tim Harig wrote: On 2010-08-01, Lawrence D'Oliveirol...@geek-central.gen.new_zealand wrote: In messagei2q3sk$3p...@speranza.aioe.org, Tim Harig wrote: It would be rewarding as it would make writing cross-platform charactor mode applications possible. I thought Windows users were allergic to command lines. To the best of my knowledge, there have never been any documentated cases of computer software related alleries. There are however several chemicals used in the process of constructing computer hardware componets which have been linked to allergy illnesses. Maybe Windows users are simply allergic to their computers. Windows users biggest allergy is to this strange world that involves make on other boxes, whatever that is, it strikes me as rather archaic. Personally I find double clicking on an msi file rather easier. I work with several thousand computers located on three different continents. Few of them have mice attached to them. If you think double clicking is a better method, be my guest; but, you need to get a package installed and configured on all of them before lunch. Its also kind of funny that I couldn't get the msi to work with a large percentage of the systems that I work with. Make works on all but one out of the box, and potentially on the last with the addition of SFU or Cygwin. With all that said, I am still not sure what the make/msi question has anything to do with packing a backup, cross platform, implementation of curses that allows the curses module to give Python a cross platform method of character mode manipulation. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1383.1280649150.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 08:18, Lawrence D'Oliveiro wrote: In messagemailman.1382.1280646210.1673.python-l...@python.org, Mark Lawrence wrote: On 01/08/2010 07:50, Lawrence D'Oliveiro wrote: In messagemailman.1381.1280643817.1673.python-l...@python.org, Mark Lawrence wrote: Personally I find double clicking on an msi file rather easier. Easier than apt-get dist-upgrade? I'm sorry but I only do English, could you please translate. :) I run Debian Unstable, which has new goodies coming out on a weekly basis. The last time I checked for updates, there were over 500 packages I had installed for which updates were available. It only took a command like the above to upgrade them all. How many .msi files would you have to click on to achieve the Windows equivalent? ... I simply couldn't cope with over 500 installed packages. Precisely my point. Go back to playing with your .msi toys. Oh, and http://dilbert.com/strips/comic/1995-06-24/. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In article i33hiu$rs...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message 8bkosifpi...@mid.individual.net, Gregory Ewing wrote: Don't you just leave the machine on overnight and wait for Microsoft to download all the stuff they think you should be using? Thatâs fine, but it doesnât handle the non-Microsoft stuff. You've apparently never worked in a big company. Your IT department downloads whatever *they* think you should be using. Eventually, your machine is so slow, you can't get any work done. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1203.1280235285.1673.python-l...@python.org, Daniel Fetchinson wrote: Sure, there are many different terminals and many different operating systems but in many areas python managed to hide all these complexities behind a well defined API. Once upon a time, there were indeed many different kinds of actual physical terminals. However, they are all extinct now. All that’s left is software emulations. And the one emulation they all have in common is the DEC VT100. So just assume you’re displaying on one of those: sys.stdout.write(\x1b[2J) -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message i2q3sk$3p...@speranza.aioe.org, Tim Harig wrote: It would be rewarding as it would make writing cross-platform charactor mode applications possible. I thought Windows users were allergic to command lines. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
In message mailman.1261.1280330578.1673.python-l...@python.org, Emile van Sebille wrote: If all else fails, repeating 24 (or 40,60?) lines feeds clears the screen cross platform. Depending on the height of the terminal window... -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-08-01, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message i2q3sk$3p...@speranza.aioe.org, Tim Harig wrote: It would be rewarding as it would make writing cross-platform charactor mode applications possible. I thought Windows users were allergic to command lines. To the best of my knowledge, there have never been any documentated cases of computer software related alleries. There are however several chemicals used in the process of constructing computer hardware componets which have been linked to allergy illnesses. Maybe Windows users are simply allergic to their computers. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Neil Cerutti wrote: Perhaps emailing the tests to yourself would be a good solution. Every tme the tests ran, you'd get a new email containing the results. Nice idea, only that it's even less portable and requires manual setup... ;^) Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Daniel Fetchinson wrote: After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? There are two kinds of programs: 1. Those that process input to output. If one of those suddenly started by clearing my screen, I'd just dump it. Also, if output is redirected to a file or piped into another program, that is basically useless or even hurting, since you then end up with control sequences in the file. 2. Those that provide a text-based interactive UI. Those typically not only clear the screen, but also control its whole layout and content, so there you don't only need ways to clear the screen but also to position the cursor or draw boxes etc. In that case you need a full curses library. Summary: No, I don't see the need for such an API. Cheers! Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Jul 28, 8:08 am, Ulrich Eckhardt eckha...@satorlaser.com wrote: Daniel Fetchinson wrote: After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? There are two kinds of programs: 1. Those that process input to output. If one of those suddenly started by clearing my screen, I'd just dump it. Also, if output is redirected to a file or piped into another program, that is basically useless or even hurting, since you then end up with control sequences in the file. 2. Those that provide a text-based interactive UI. Those typically not only clear the screen, but also control its whole layout and content, so there you don't only need ways to clear the screen but also to position the cursor or draw boxes etc. In that case you need a full curses library. Summary: No, I don't see the need for such an API. Cheers! Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 I don't know much, but just in case the following is useful to anyone: There is a Windows program called 'ansicon', which when installed (run with '-i'), will modify all future Windows cmd shells to correctly intercept and interpret ANSI escape codes for colors, cursor movement, and: \e[#J ED: Erase Display which I presume is what is under discussion here. I understand there are other historical ANSI drivers which were responsible for achieving a similar thing under Windows, but this is the method I currently use (on XP) and am very happy with. Also, and probably less usefully, personally I do wish Python provided a cross platform mechanism for simple terminal control like clearing and colored text. Since ANSI codes are used everywhere except Windows, it would make sense to base such a system on them. So I started a pure Python implementation of a crude ANSI driver, on PyPI as 'colorama'. It does nothing on non-windows systems, but on Windows it patches sys.stdout with a stream-like object, in order to filter out ANSI codes and convert them into Win32 terminal control calls. It currently only works with colors and brightness, but I would love to extend it to cover other ANSI codes such as 'clear screen'. It is doubtless riddled with errors and misunderstandings, and I would love any feedback helping me do a better job. Best regards, Jonathan -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? There are two kinds of programs: 1. Those that process input to output. If one of those suddenly started by clearing my screen, I'd just dump it. Also, if output is redirected to a file or piped into another program, that is basically useless or even hurting, since you then end up with control sequences in the file. 2. Those that provide a text-based interactive UI. Those typically not only clear the screen, but also control its whole layout and content, so there you don't only need ways to clear the screen but also to position the cursor or draw boxes etc. In that case you need a full curses library. Summary: No, I don't see the need for such an API. Okay, that makes perfect sense, thanks for the exaplanation! I'll just live with the platform.system( ) check for this particular problem then. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? I don't know much, but just in case the following is useful to anyone: There is a Windows program called 'ansicon', which when installed (run with '-i'), will modify all future Windows cmd shells to correctly intercept and interpret ANSI escape codes for colors, cursor movement, and: \e[#J ED: Erase Display which I presume is what is under discussion here. I understand there are other historical ANSI drivers which were responsible for achieving a similar thing under Windows, but this is the method I currently use (on XP) and am very happy with. Also, and probably less usefully, personally I do wish Python provided a cross platform mechanism for simple terminal control like clearing and colored text. Since ANSI codes are used everywhere except Windows, it would make sense to base such a system on them. So I started a pure Python implementation of a crude ANSI driver, on PyPI as 'colorama'. It does nothing on non-windows systems, but on Windows it patches sys.stdout with a stream-like object, in order to filter out ANSI codes and convert them into Win32 terminal control calls. It currently only works with colors and brightness, but I would love to extend it to cover other ANSI codes such as 'clear screen'. It is doubtless riddled with errors and misunderstandings, and I would love any feedback helping me do a better job. Thanks, I didn't know about 'colorama' before but it surely looks promising! I'll look into it for future reference, once in a while I like having pretty output without the hassle of 'curses' or other complicated stuff. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 7/28/2010 4:23 AM Daniel Fetchinson said... Okay, that makes perfect sense, thanks for the exaplanation! I'll just live with the platform.system( ) check for this particular problem then. If all else fails, repeating 24 (or 40,60?) lines feeds clears the screen cross platform. Emile -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Jul 28, 8:08 am, Ulrich Eckhardt eckha...@satorlaser.com wrote: Daniel Fetchinson wrote: After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? There are two kinds of programs: 1. Those that process input to output. If one of those suddenly started by clearing my screen, I'd just dump it. Also, if output is redirected to a file or piped into another program, that is basically useless or even hurting, since you then end up with control sequences in the file. 2. Those that provide a text-based interactive UI. Those typically not only clear the screen, but also control its whole layout and content, so there you don't only need ways to clear the screen but also to position the cursor or draw boxes etc. In that case you need a full curses library. Summary: No, I don't see the need for such an API. Cheers! Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 Hey, Your point seems good and I don't mean to contradict, but out of interest, what do you think about an example like the following: I want to write a quick script which, notices whenever I save my source code, and re-runs the unit tests, displaying the output. I think I'd like it to clear the terminal before each re-run of the tests, so that it's immediately obvious what is output from the current run, as opposed to previous runs. Then I can keep my editor focussed, but leave that running in a terminal and trust it to simply display the current output from my tests. I did dash off a quick and dirty version of this once which did a system 'clear' or 'cls' depending on the platform, but to my dismay I found that on Windows this caused focus to jump briefly to the terminal every time it ran 'clear' (!), making it extremely annoying in use. So I wished there had been a simple cross-platform way to clear the terminal. (this, and printing colored text, was my initial use case for starting 'colorama') Is this a silly desire of mine, or simply an uncommon edge case that therefore isn't really significant? Best regards, Jonathan -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Jul 28, 4:45 pm, Jonathan Hartley tart...@tartley.com wrote: On Jul 28, 8:08 am, Ulrich Eckhardt eckha...@satorlaser.com wrote: Daniel Fetchinson wrote: After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? There are two kinds of programs: 1. Those that process input to output. If one of those suddenly started by clearing my screen, I'd just dump it. Also, if output is redirected to a file or piped into another program, that is basically useless or even hurting, since you then end up with control sequences in the file. 2. Those that provide a text-based interactive UI. Those typically not only clear the screen, but also control its whole layout and content, so there you don't only need ways to clear the screen but also to position the cursor or draw boxes etc. In that case you need a full curses library. Summary: No, I don't see the need for such an API. Cheers! Uli -- Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 Hey, Your point seems good and I don't mean to contradict, but out of interest, what do you think about an example like the following: I want to write a quick script which, notices whenever I save my source code, and re-runs the unit tests, displaying the output. I think I'd like it to clear the terminal before each re-run of the tests, so that it's immediately obvious what is output from the current run, as opposed to previous runs. Then I can keep my editor focussed, but leave that running in a terminal and trust it to simply display the current output from my tests. I did dash off a quick and dirty version of this once which did a system 'clear' or 'cls' depending on the platform, but to my dismay I found that on Windows this caused focus to jump briefly to the terminal every time it ran 'clear' (!), making it extremely annoying in use. So I wished there had been a simple cross-platform way to clear the terminal. (this, and printing colored text, was my initial use case for starting 'colorama') Is this a silly desire of mine, or simply an uncommon edge case that therefore isn't really significant? Best regards, Jonathan Oh, plus, while we're on this subject: Am I right that curses in Python stdlib doesn't work on Windows, and there is currently no simple way to fix this? Also, is it crazy to imagine that if colorama was pushed through to completion (ie. to support a majority of the relevant ANSI codes) then Python's stdlib curses module, unmodified, would suddenly just work on Windows? (after a call to 'colorama.init()') I presume these ideas are oversimplifications or just plain wrong. If anyone would care to correct my misunderstandings, I'd be very grateful. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-07-28, Jonathan Hartley tart...@tartley.com wrote: I want to write a quick script which, notices whenever I save my source code, and re-runs the unit tests, displaying the output. I think I'd like it to clear the terminal before each re-run of the tests, so that it's immediately obvious what is output from the current run, as opposed to previous runs. Then I can keep my editor focussed, but leave that running in a terminal and trust it to simply display the current output from my tests. Perhaps emailing the tests to yourself would be a good solution. Every tme the tests ran, you'd get a new email containing the results. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 07/28/2010 06:01 PM, Jonathan Hartley wrote: Oh, plus, while we're on this subject: Am I right that curses in Python stdlib doesn't work on Windows, and there is currently no simple way to fix this? Also, is it crazy to imagine that if colorama was pushed through to completion (ie. to support a majority of the relevant ANSI codes) then Python's stdlib curses module, unmodified, would suddenly just work on Windows? (after a call to 'colorama.init()') I presume these ideas are oversimplifications or just plain wrong. If anyone would care to correct my misunderstandings, I'd be very grateful. Correct: it's not THAT simple. Python's curses module is a (I'm not sure how thin) wrapper around the good old UNIX curses (ncurses, ...) library. This is written in C, not Python, so it doesn't use Python's sys.stdout object to do I/O. I haven't had a look at colorama, but it sounds like it hooks into sys.stdout, or Python file objects anyway. Far, far above the layer curses does I/O on. So, if you ported a normal curses library to Windows, colorama wouldn't help you a bit. It might be possible to write a curses-compatible library that works with cmd.exe. Maybe. But, even if it's possible, I don't think it's easy, and I especially don't think it would be particularly rewarding. Also, I just stumbled upon http://adamv.com/dev/python/curses/ -- this is probably the only reasonable way to get a useful curses API on Windows: forget the DOS box. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Jul 28, 5:47 pm, Thomas Jollans tho...@jollans.com wrote: On 07/28/2010 06:01 PM, Jonathan Hartley wrote: Oh, plus, while we're on this subject: Am I right that curses in Python stdlib doesn't work on Windows, and there is currently no simple way to fix this? Also, is it crazy to imagine that if colorama was pushed through to completion (ie. to support a majority of the relevant ANSI codes) then Python's stdlib curses module, unmodified, would suddenly just work on Windows? (after a call to 'colorama.init()') I presume these ideas are oversimplifications or just plain wrong. If anyone would care to correct my misunderstandings, I'd be very grateful. Correct: it's not THAT simple. Python's curses module is a (I'm not sure how thin) wrapper around the good old UNIX curses (ncurses, ...) library. This is written in C, not Python, so it doesn't use Python's sys.stdout object to do I/O. I haven't had a look at colorama, but it sounds like it hooks into sys.stdout, or Python file objects anyway. Far, far above the layer curses does I/O on. So, if you ported a normal curses library to Windows, colorama wouldn't help you a bit. It might be possible to write a curses-compatible library that works with cmd.exe. Maybe. But, even if it's possible, I don't think it's easy, and I especially don't think it would be particularly rewarding. Also, I just stumbled uponhttp://adamv.com/dev/python/curses/-- this is probably the only reasonable way to get a useful curses API on Windows: forget the DOS box. ncurses ... is written in C, not Python, so it doesn't use Python's sys.stdout object to do I/O. Ah, I should have spotted that. Of course. Thanks for the enlightenment. And Neil Cerutti, I think I'll just email the whole source tree to myself, and have a script that scans my inbox, unzips source trees and runs their tests. Much nicer. :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 07/28/2010 07:02 PM, Jonathan Hartley wrote: On Jul 28, 5:47 pm, Thomas Jollans tho...@jollans.com wrote: On 07/28/2010 06:01 PM, Jonathan Hartley wrote: Oh, plus, while we're on this subject: Am I right that curses in Python stdlib doesn't work on Windows, and there is currently no simple way to fix this? Also, is it crazy to imagine that if colorama was pushed through to completion (ie. to support a majority of the relevant ANSI codes) then Python's stdlib curses module, unmodified, would suddenly just work on Windows? (after a call to 'colorama.init()') I presume these ideas are oversimplifications or just plain wrong. If anyone would care to correct my misunderstandings, I'd be very grateful. Correct: it's not THAT simple. Python's curses module is a (I'm not sure how thin) wrapper around the good old UNIX curses (ncurses, ...) library. This is written in C, not Python, so it doesn't use Python's sys.stdout object to do I/O. I haven't had a look at colorama, but it sounds like it hooks into sys.stdout, or Python file objects anyway. Far, far above the layer curses does I/O on. So, if you ported a normal curses library to Windows, colorama wouldn't help you a bit. It might be possible to write a curses-compatible library that works with cmd.exe. Maybe. But, even if it's possible, I don't think it's easy, and I especially don't think it would be particularly rewarding. Also, I just stumbled uponhttp://adamv.com/dev/python/curses/-- this is probably the only reasonable way to get a useful curses API on Windows: forget the DOS box. ncurses ... is written in C, not Python, so it doesn't use Python's sys.stdout object to do I/O. Ah, I should have spotted that. Of course. Thanks for the enlightenment. And Neil Cerutti, I think I'll just email the whole source tree to myself, and have a script that scans my inbox, unzips source trees and runs their tests. Much nicer. :-) use version control! Use mercurial, commit often, and add a commit-hook that runs tests. Then you can even set up a separate repository that your script automatically pushes your changes to if they pass the tests cleanly. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-07-28, Jonathan Hartley tart...@tartley.com wrote: And Neil Cerutti, I think I'll just email the whole source tree to myself, and have a script that scans my inbox, unzips source trees and runs their tests. Much nicer. :-) Don't forget to clear the screen, though. That ties the whole program together. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-07-28, Thomas Jollans tho...@jollans.com wrote: It might be possible to write a curses-compatible library that works with cmd.exe. Maybe. But, even if it's possible, I don't think it's easy, and I especially don't think it would be particularly rewarding. http://pdcurses.sourceforge.net/ It would be rewarding as it would make writing cross-platform charactor mode applications possible. Using curses for the interface makes a lot of sense because it is already supported by almost every Unix/POSIX platorm, so re-implementation is only required for those odd platforms (Windows) where it does not exist natively,; because well documented on the internet and in print; and because a huge number of people are already familiar with its API. If licensing permits, I don't think it would be too difficult difficult to embed something like pdcurses into the existing curses module to use as a backup for platforms where curses does not already exist. If not, there cannot be much difference to writing a terminal emulator that runs inside the windows console and there are a *huge* number of terminal emulators available for ansi/vt100 terminals. Add a termcap database mechanism and an embedded emulator can easily convert the excape codes into actions for the console. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Wed, 28 Jul 2010 09:01:38 -0700, Jonathan Hartley wrote: Also, is it crazy to imagine that if colorama was pushed through to completion (ie. to support a majority of the relevant ANSI codes) then Python's stdlib curses module, unmodified, would suddenly just work on Windows? (after a call to 'colorama.init()') Curses was originally built on top of termcap, a much simpler and more primitive library. Its abilities are: - read the termcap database to find and load the capability list of the terminal identified as the TERM environment variable. - write a named capability to the screen. If the capability isn't defined for the current terminal its silently ignored. - fill in x, y and write the cursor movement string - thats about it. Its easy enough to find termcap databases. They're just text files containing a block of attribute values for each terminal, normally including ANSI terminals, Linux consoles, X-terms etc. They are also fairly easy to parse, even in vanilla C, so parsing one on Python should be a breeze. Termcap format specs and lists of standard attribute names are easy enough to find too. IOW, if you extend colorama to read its codes from a termcap database you'll have a basic but easily portable character console handler that can at least clear the screen, move the cursor and, if the screen has the capability, change the colour of characters or make them bold/dim/blink etc. To give you an idea of how complex this is, I've re-implemented termcap in Java for my own purposes. It amounts to 1100 lines of fairly well spaced and commented Java or about 340 statements, which were estimated by counting lines containing semicolons. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | -- http://mail.python.org/mailman/listinfo/python-list
Why is there no platform independent way of clearing a terminal?
Hi folks, If I'm only interested in linux and windows I know I can do import os import platform if platform.system( ) == 'Linux': clear = 'clear' else: clear = 'cls' os.system( clear ) or something equivalent using os.name and friends, but was wondering why there is no platform independent way (i.e. the platform dependence is taken care of by the python stdlib) of clearing a terminal. Sure, there are many different terminals and many different operating systems but in many areas python managed to hide all these complexities behind a well defined API. Why was clearing a terminal left out? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Daniel Fetchinson a écrit : Hi folks, If I'm only interested in linux and windows I know I can do import os import platform if platform.system( ) == 'Linux': clear = 'clear' else: clear = 'cls' os.system( clear ) or something equivalent using os.name and friends, but was wondering why there is no platform independent way (i.e. the platform dependence is taken care of by the python stdlib) of clearing a terminal. Sure, there are many different terminals and many different operating systems but in many areas python managed to hide all these complexities behind a well defined API. Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). And the shell is not necessarily part of the OS itself (there's no shortage of shells for unices / linux systems), so it doesn't belong to the os or platform modules. FWIW, I can't tell for sure since I never used any other shell than bash, but I'm not sure your above code is garanteed to work on each and any possible unix shell. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-07-27, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Daniel Fetchinson a ?crit : Hi folks, If I'm only interested in linux and windows I know I can do import os import platform if platform.system( ) == 'Linux': clear = 'clear' else: clear = 'cls' os.system( clear ) or something equivalent using os.name and friends, but was wondering why there is no platform independent way (i.e. the platform dependence is taken care of by the python stdlib) of clearing a terminal. Sure, there are many different terminals and many different operating systems but in many areas python managed to hide all these complexities behind a well defined API. Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). No, what he's talking about is clearing a terminal (or a terminal emulator). They both work the same, the only difference is whether the terminal software is running on dedicated hardware or on general-purpose hardware. And the shell is not necessarily part of the OS itself (there's no shortage of shells for unices / linux systems), so it doesn't belong to the os or platform modules. True, but clearing a terminal or terminal emulator has nothing to do with the shell. It's done using an in-band control/escape sequence that's indepedent of the shell being used. His example accomplishes this using an executable named 'clear' which knows how to use terminfo/termcap (I forget which one) to send the proper escape sequence to the terminal. FWIW, I can't tell for sure since I never used any other shell than bash, but I'm not sure your above code is garanteed to work on each and any possible unix shell. Again, the shell is irrelevent. -- Grant Edwards grant.b.edwardsYow! Zippy's brain cells at are straining to bridge gmail.comsynapses ... -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Grant Edwards a écrit : On 2010-07-27, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Daniel Fetchinson a ?crit : (snip) Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). No, what he's talking about is clearing a terminal (or a terminal emulator). They both work the same, the only difference is whether the terminal software is running on dedicated hardware or on general-purpose hardware. (snip) I stand corrected. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On Tue, 27 Jul 2010 16:02:23 +0200, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Daniel Fetchinson a écrit : Hi folks, If I'm only interested in linux and windows I know I can do import os import platform if platform.system( ) == 'Linux': clear = 'clear' else: clear = 'cls' os.system( clear ) or something equivalent using os.name and friends, but was wondering why there is no platform independent way (i.e. the platform dependence is taken care of by the python stdlib) of clearing a terminal. Sure, there are many different terminals and many different operating systems but in many areas python managed to hide all these complexities behind a well defined API. Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). And the shell is not necessarily part of the OS itself (there's no shortage of shells for unices / linux systems), so it doesn't belong to the os or platform modules. FWIW, I can't tell for sure since I never used any other shell than bash, but I'm not sure your above code is garanteed to work on each and any possible unix shell. Sorry, but that is completely wrong - the shell is irrelevant. clear is just a normal command line program that queries the termcap/terminfo database (possibly via the curses library) for the terminal specific sequence of characters that will clear the screen. It then writes those characters to stdout. The terminal, or (more usually these days) terminal emulator, then interprets those characters and takes the appropriate action. I'm not sure what the POSIX status of the clear command is, but I'd be surprised if it wasn't present on a UNIX/Linux system of any vintage. Phil -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
Hi folks, If I'm only interested in linux and windows I know I can do import os import platform if platform.system( ) == 'Linux': clear = 'clear' else: clear = 'cls' os.system( clear ) or something equivalent using os.name and friends, but was wondering why there is no platform independent way (i.e. the platform dependence is taken care of by the python stdlib) of clearing a terminal. Sure, there are many different terminals and many different operating systems but in many areas python managed to hide all these complexities behind a well defined API. Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). And the shell is not necessarily part of the OS itself (there's no shortage of shells for unices / linux systems), so it doesn't belong to the os or platform modules. FWIW, I can't tell for sure since I never used any other shell than bash, but I'm not sure your above code is garanteed to work on each and any possible unix shell. Sorry, but that is completely wrong - the shell is irrelevant. clear is just a normal command line program that queries the termcap/terminfo database (possibly via the curses library) for the terminal specific sequence of characters that will clear the screen. It then writes those characters to stdout. The terminal, or (more usually these days) terminal emulator, then interprets those characters and takes the appropriate action. I'm not sure what the POSIX status of the clear command is, but I'd be surprised if it wasn't present on a UNIX/Linux system of any vintage. After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 7/27/2010 7:44 AM, Bruno Desthuilliers wrote: Grant Edwards a écrit : On 2010-07-27, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Daniel Fetchinson a ?crit : (snip) Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). No, what he's talking about is clearing a terminal (or a terminal emulator). They both work the same, the only difference is whether the terminal software is running on dedicated hardware or on general-purpose hardware. (snip) I stand corrected. I immediately thought of using the curses module, but that's UNIX-only, or at least it's not in the ActiveState Python distro. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-07-27, Daniel Fetchinson fetchin...@googlemail.com wrote: After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? I write a lot of command-line programs, and I can't remember the last time time I wanted to clear a terminal. But then again, pretty much all of my programs are designed so that they can be used as filters. About 10 years ago I did need to do a text-mode UI (menus, popups, text-entry, etc.), and I used newt. -- Grant Edwards grant.b.edwardsYow! Is a tattoo real, like at a curb or a battleship? gmail.comOr are we suffering in Safeway? -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 7/27/2010 12:58 PM, Daniel Fetchinson wrote: After getting the technicalities out of the way, maybe I should have asked: Is it only me or others would find a platform independent python API to clear the terminal useful? One problem is, Where would you put it? The OS module is for system calls, mostly based on posix. The system call involved in clearing a terminal is a write string call. *nix puts terminal control in a separate library. Another is, what next? clear_line? Pretty soon, we are back to curses. Still another problem is that most of us do not have terminals; we have screens and use them as such. OS-independent full-screen graphics/game libraries have clear screen commands. Similary, GUI systems have means of clearing text and canvas widgets, but should not be able to clear the whole screen. The turtle module has a clear command for its canvas, which would be the same regardless of underlying gui. So we already have several OS independent clear commands. On Windows, the DOS clr command only works withing a text-mode command window (once called a dos window). The same thing (os.system('clr') within an IDLE shell uselessly flashes a blank command window, which then disappears. Yeah, it is too bad windows did not use the obvious 'clear' like everyone? else. If command windows still imitate or can be set to imitate ansi terminals, then I would think curses is your best bet. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Why is there no platform independent way of clearing a terminal?
On 2010-07-27, John Nagle na...@animats.com wrote: On 7/27/2010 7:44 AM, Bruno Desthuilliers wrote: Grant Edwards a écrit : On 2010-07-27, Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote: Daniel Fetchinson a ?crit : (snip) Why was clearing a terminal left out? What you're talking about is a shell, not a terminal (a terminal is a physical device). No, what he's talking about is clearing a terminal (or a terminal emulator). They both work the same, the only difference is whether the terminal software is running on dedicated hardware or on general-purpose hardware. (snip) I stand corrected. I immediately thought of using the curses module, but that's UNIX-only, or at least it's not in the ActiveState Python distro. pdcurses: http://pdcurses.sourceforge.net/ is a cross platform curses implementation that is available for Windows. I wonder how difficult it would be to embed into the Python curses module as a backup for systems where curses is not natively available. This would allow Python to provide cross platform charactor mode manipulation. -- http://mail.python.org/mailman/listinfo/python-list