Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'interpreter': 0.05; 'happen.': 0.09; 'ide': 0.09; 'imply': 0.09; 'python': 0.11; 'itself.': 0.14; 'mostly': 0.14; 'changes': 0.15; 'windows': 0.15; '(either': 0.16; 'cleaner': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'program?': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'tjg': 0.16; 'tying': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'first.': 0.19; 'starts': 0.20; 'seems': 0.21; 'code,': 0.22; 'header:User-Agent:1': 0.23; 'certainly': 0.24; "i've": 0.25; 'script': 0.25; 'possibly': 0.26; 'excel': 0.26; 'header:In-Reply- To:1': 0.27; 'external': 0.29; 'thus': 0.29; "doesn't": 0.30; "i'm": 0.30; 'josh': 0.31; 'file': 0.32; 'run': 0.32; 'text': 0.33; 'open': 0.33; 'running': 0.33; 'raw': 0.33; 'subject:the': 0.34; 'could': 0.34; 'created': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; 'idle': 0.36; 'subject:?': 0.36; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'track': 0.38; 'little': 0.38; 'launch': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'new': 0.61; "you're": 0.61; 'back': 0.62; 'more': 0.64; 'situation': 0.65; 'within': 0.65; 'close': 0.67; 'determine': 0.67; 'lose': 0.68; '100%': 0.77; 'yourself': 0.78; 'from:addr:mail': 0.83; 'closes': 0.84; 'excel,': 0.84; 'killing': 0.84; 'notepad,': 0.84; 'pdfs.': 0.84; 'acrobat': 0.91; 'opens': 0.91 Date: Sat, 07 Jun 2014 21:24:43 +0100 From: Tim Golden User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: os.startfile hanging onto the launched app, or my IDE? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1402172663 news.xs4all.nl 2911 [2001:888:2000:d::a6]:56918 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72929 On 06/06/2014 21:34, Josh English wrote: > I have been using os.startfile(filepath) to launch files I've created > in Python, mostly Excel spreadsheets, text files, or PDFs. > > When I run my script from my IDE, the file opens as I expect. But if > I go back to my script and re-run it, the external program (either > Excel, Notepad, or Acrobat Reader) closes all windows and restarts > the program. This can, unfortunately, close other files I am working > on and thus I lose all my changes to those files. > > This is happening on Windows 7. > > I am not sure if it is Python (2.7.5) or my IDE (PyScripter 2.5.3). > > It seems like Python or the IDE is keeping track of things created by > the os.startfile call, but the docs imply this doesn't happen. > > Is this a quirk of os.startfile? Is there a cleaner way to get > Windows to open files without tying back to my program? I'm not 100% sure what your scenario is, but you can certainly help yourself and us by running the same test on the raw interpreter and then under PyScripter to determine if the behaviour is to do with IDLE or with Python itself. My half-guess is that PyScripter starts a new process to run your code, possibly killing any pre-existing process first. That's if I've understood the situation you're describing. Could you come back with a little more detail? Specifically: whether what you're seeing happens only from within PyScripter, or only not from within PyScripter, or something else? TJG