Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

os.system dual behaviour

 
Jump to:  
 
iu2
PostPosted: Wed Sep 03, 2008 3:27 pm    Post subject: os.system dual behaviour
       
Hi guys

I do

os.system('ls &> e')

On one linux machine it emits ls output to the file e as expected.
On another linux machine it emits ls to the standard output, and
nothing to e!
Both machines run Fedora linux.

The command "ls &> e" entered at the shell (no python) behaves ok on
both machines.

Why?? How can I solve this?

Your help will be appreciated.
 

 
Emile van Sebille
PostPosted: Wed Sep 03, 2008 5:35 pm    Post subject: Re: os.system dual behaviour
       
iu2 wrote:
Quote:
Hi guys

I do

os.system('ls &> e')

On one linux machine it emits ls output to the file e as expected.
On another linux machine it emits ls to the standard output, and
nothing to e!
Both machines run Fedora linux.

The command "ls &> e" entered at the shell (no python) behaves ok on
both machines.

Why?? How can I solve this?

Why?? I don't know. But you could try the commands module to work
around it...

open("e",'w').writelines(commands.getoutput('ls'))


HTH,

Emile
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

opony matador Trout o strategii ISO 14001 Portal Miasteczko podlaskie Na szalach Hioba Duchowe wędrówki