Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Golden Newsgroups: comp.lang.python Subject: Re: .py file won't open in windows 7 Date: Thu, 4 Feb 2016 13:18:27 +0000 Lines: 34 Message-ID: References: <56B34D71.1070308@timgolden.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de fszt0EQg4xx++/xF9ih/PwwjIk196yZW5kEYUPxHKJNA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '"""': 0.05; 'sys': 0.05; '__name__': 0.07; 'plenty': 0.07; 'subject:file': 0.07; 'advice.': 0.09; 'runs,': 0.09; 'python': 0.10; 'def': 0.13; "'__main__':": 0.16; '.py': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'main():': 0.16; 'message- id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'seconds.': 0.16; 'subject:windows': 0.16; 'tjg': 0.16; 'wrote:': 0.16; 'basically': 0.18; 'result,': 0.18; '(in': 0.18; 'windows': 0.20; 'to:name :python-list@python.org': 0.20; 'to:2**1': 0.21; 'ones.': 0.22; 'this:': 0.23; 'import': 0.24; 'tim': 0.24; 'header:In-Reply- To:1': 0.24; 'header:User-Agent:1': 0.26; 'error': 0.27; 'dos': 0.27; 'url:moin': 0.27; 'prints': 0.29; 'repair': 0.29; 'starts': 0.29; 'program,': 0.29; 'url:wiki': 0.30; 'code': 0.30; 'window': 0.30; 'run': 0.33; 'url:python': 0.33; 'open': 0.33; 'case,': 0.34; 'file': 0.34; 'something': 0.35; 'but': 0.36; 'list,': 0.36; 'there': 0.36; 'url:org': 0.36; 'closing': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'environment.': 0.37; 'itself': 0.38; "won't": 0.38; 'stuff': 0.38; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'url:3': 0.60; 'your': 0.60; 'charset:windows-1252': 0.62; 'within': 0.64; 'from:addr:mail': 0.70; 'happened.': 0.84; 'others:': 0.84; 'ships': 0.91 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 In-Reply-To: <56B34D71.1070308@timgolden.me.uk> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc1 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102492 On 04/02/2016 13:09, Tim Golden wrote: > On 04/02/2016 12:52, Yossifoff Yossif wrote: >> Hallow, >> I try to open a .py file (attached), but what I get is a windows DOS window opening and closing in a couple of seconds. Ran repair of the program, nothing happened. >> I cannot see error messages and don't know where to look for ones. >> Would appreciate your piece of advice. > > Attachments won't make it through to the list, Yossif. But your code is > basically something like this: > > """ > import sys > > def main(): > # calculate stuff > print(stuff) > > if __name__ == '__main__': > sys.exit(main()) > """ > > In that case, the program starts (in a console window), runs, prints the > result, and then closes. You've got a few simple ways of seeing the output: ... or run within a development environment. Python itself ships with IDLE: https://docs.python.org/3/library/idle.html but there are plenty of others: https://wiki.python.org/moin/IntegratedDevelopmentEnvironments TJG