os.startfile hanging onto the launched app, or my IDE?

Josh English Joshua.R.English at gmail.com
Mon Jun 9 18:21:52 EDT 2014


On Saturday, June 7, 2014 1:24:43 PM UTC-7, Tim Golden wrote:
>
> 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?
> 

I think you're right about PyScripter controlling the process. I don't run scripts through the command line as a matter of practice. 

But I just tried running my script through the command line, with Excel closed, and it opened the Excel file just as I expected. Then I went back to the command line and ran it again, and it didn't close Excel. It gave me the error I was expecting from zipfile not being able to access the file (because it is currently open).

I even left it open and ran another script that also creates and launches an Excel workbook, and it again did not close Excel.

So this quirk is coming from PyScripter, which is a shame, because I don't think it's under development, so it won't be fixed.

Josh




More information about the Python-list mailing list