Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'executing': 0.05; 'raises': 0.07; 'python': 0.07; 'file-like': 0.09; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'exception': 0.12; 'output': 0.12; 'say,': 0.14; 'wrote:': 0.14; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:command': 0.16; 'command': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'solving': 0.22; 'script.': 0.23; 'object': 0.27; 'pass': 0.27; 'raise': 0.29; 'error': 0.29; 'subject:Windows': 0.29; 'operating': 0.30; "won't": 0.30; 'cc:addr:python.org': 0.31; 'subject:working': 0.31; 'tjg': 0.31; 'import': 0.32; 'received:192': 0.34; 'that,': 0.35; 'print': 0.35; 'header:User-Agent:1': 0.35; 'doing': 0.36; 'rather': 0.36; 'received:192.168': 0.37; 'issue': 0.37; 'facing': 0.38; 'but': 0.38; 'unless': 0.38; 'help': 0.39; 'under': 0.39; 'whatever': 0.39; 'messages': 0.40; 'from:addr:mail': 0.60; 'note:': 0.61; 'charset:windows-1252': 0.61; 'covers': 0.65; 'to:none': 0.92; 'generated.': 0.93 Date: Thu, 12 May 2011 15:21:41 +0100 From: Tim Golden User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 CC: python-list@python.org Subject: Re: os.popen command working differently on Windows References: <21581D39FA3BDF40904D75AF9653CE26064FC6D1@blrex.prog.altair.com> In-Reply-To: <21581D39FA3BDF40904D75AF9653CE26064FC6D1@blrex.prog.altair.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305210153 news.xs4all.nl 81476 [::ffff:82.94.164.166]:54730 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5240 On 12/05/2011 15:11, Ayaskanta Swain wrote: > Please help me in solving the following issue I am facing while > executing my python script. Basically I am executing the OS specific > move command to move a file/dir from one location to another. Why? Why not use os.rename or shutil.move which already do whatever is needed under the covers for different Operating Systems? os.popen returns a file-like object from which you can read any error messages generated. You're not doing that, and os.popen won't raise an error itself unless you, say, pass it a number rather than a string. import os output = os.popen ("dir") print output.read () # # But note: # os.popen ("Nonsen*se") # raises no exception TJG