From: Dennis van Oosterhout on
Hello Arno,

thanks for the explanation! I have one more question: on the python
site it says it's better to replace the system commands by subprocess
and Popen.
Now I searched for some good example for my specific case (as I have
no idea how it should work and I don't get it any clearer by reading
http://docs.python.org/3.0/library/subprocess.html#module-subprocess)
and I found this:

> import subprocess
> def clear():
> subProcess.Popen('clear')

But it just doesn't seem to work. Would you have any idea how it would work?

Once more thanks for the first answer,

Devilly


2008/12/25 Python <python(a)rgbaz.eu>
>
> On 25 dec 2008, at 11:22, Dennis van Oosterhout wrote:
>
>> Hi there! I was searching for a way to clear the 'DOS screen'/command screen etc. and found that os.system('cls') works for this. I was just wondering where I can find al the commands which can be used for os.system(). I searched with google but I didn't find an answer. In the official python tutorial it says os.system('command') executes the command, but it doesn't say which commands exist (or I'm just blind).
>>
>> Does anyone have an answer for this question?
>>
>> Thanks,
>>
>> Devilly
>
> Hey Deville,
>
>
> os.system() executes commands that you usually use in a shell outside python.
> so in the case of you being a windows user, you replace 'command' with any DOS
> command.
>
> gr
> Arno
From: Dennis van Oosterhout on
Btw...does that mean that system('cls') only works on Windows...or to
say it otherwise: the program isn't platform independant?

2008/12/25 Dennis van Oosterhout <de.slotenzwemmer(a)gmail.com>:
> Hello Arno,
>
> thanks for the explanation! I have one more question: on the python
> site it says it's better to replace the system commands by subprocess
> and Popen.
> Now I searched for some good example for my specific case (as I have
> no idea how it should work and I don't get it any clearer by reading
> http://docs.python.org/3.0/library/subprocess.html#module-subprocess)
> and I found this:
>
>> import subprocess
>> def clear():
>> subProcess.Popen('clear')
>
> But it just doesn't seem to work. Would you have any idea how it would work?
>
> Once more thanks for the first answer,
>
> Devilly
>
>
> 2008/12/25 Python <python(a)rgbaz.eu>
>>
>> On 25 dec 2008, at 11:22, Dennis van Oosterhout wrote:
>>
>>> Hi there! I was searching for a way to clear the 'DOS screen'/command screen etc. and found that os.system('cls') works for this. I was just wondering where I can find al the commands which can be used for os.system(). I searched with google but I didn't find an answer. In the official python tutorial it says os.system('command') executes the command, but it doesn't say which commands exist (or I'm just blind).
>>>
>>> Does anyone have an answer for this question?
>>>
>>> Thanks,
>>>
>>> Devilly
>>
>> Hey Deville,
>>
>>
>> os.system() executes commands that you usually use in a shell outside python.
>> so in the case of you being a windows user, you replace 'command' with any DOS
>> command.
>>
>> gr
>> Arno
>
From: Python on

On 25 dec 2008, at 11:22, Dennis van Oosterhout wrote:

> Hi there! I was searching for a way to clear the 'DOS screen'/
> command screen etc. and found that os.system('cls') works for this.
> I was just wondering where I can find al the commands which can be
> used for os.system(). I searched with google but I didn't find an
> answer. In the official python tutorial it says os.system('command')
> executes the command, but it doesn't say which commands exist (or
> I'm just blind).
>
> Does anyone have an answer for this question?
>
> Thanks,
>
> Devilly

Hey Deville,


os.system() executes commands that you usually use in a shell outside
python.
so in the case of you being a windows user, you replace 'command' with
any DOS
command.

gr
Arno
From: Python on

On 25 dec 2008, at 12:56, Dennis van Oosterhout wrote:

> Hello Arno,
>
> thanks for the explanation! I have one more question: on the python
> site it says it's better to replace the system commands by subprocess
> and Popen.
> Now I searched for some good example for my specific case (as I have
> no idea how it should work and I don't get it any clearer by reading
> http://docs.python.org/3.0/library/subprocess.html#module-subprocess)
> and I found this:
>
>> import subprocess
>> def clear():
>> subProcess.Popen('clear')
>
never used it myself either, but from reading the manual
i think you need

import subprocess
subprocess.Open('cls')


what you did is create a function that you need to call to execute it
(and a capital P typo in subprocess)

'clear' is for *nix systems
it won;t work in DOS i think
(I'm don;t have windows here...)


> But it just doesn't seem to work. Would you have any idea how it
> would work?
>
> Once more thanks for the first answer,
>>

you;re welcome :)
From: D'Arcy J.M. Cain on
On Thu, 25 Dec 2008 13:11:09 +0100
"Dennis van Oosterhout" <de.slotenzwemmer(a)gmail.com> wrote:
> Btw...does that mean that system('cls') only works on Windows...or to
> say it otherwise: the program isn't platform independant?

Exactly - sort of. Unless, of course, you have a program called "cls"
installed on other platforms. The "system" method is platform
independent in that it runs system commands on all platforms but it has
no control over what system commands happen to exist on your system.
Depending on the command you run it may not even be portable to another
Windows system of exactly the same version.

BTW, "os.system('clear') will clear the screen on many Unix systems.

--
D'Arcy J.M. Cain <darcy(a)druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.