New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orphaned EXCEL32 and pythonw processes after exiting Excel when using the optimized connection #193

Closed
acommendador opened this Issue May 29, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@acommendador

acommendador commented May 29, 2015

While using xlwings 0.3.5 with the xlwings.bas added to an Excel add-in and the optimized connection enabled, exiting Excel with the pythonw process started closes the Excel GUI but leaves the EXCEL32 and pythonw processes running in the background. We've tried the following from a python function with no success: invoking the active workbook application quit method, and invoking sys.exit. We've also tried replacing all instances of ThisWorkbook with ActiveWorkbook within the xlwings.bas.

@acommendador

This comment has been minimized.

acommendador commented May 29, 2015

After some investigation we've found that the problem only occurs when getting a handle to the Workbook object within python. We also found that the the xlwings/server.py serve method never exits when Excel is closed. We were able to force the serve method to return when Excel closes by adding a python method to invoke ctypes.windll.user32.PostQuitMessage(0) (see http://stackoverflow.com/questions/6023172/ending-a-program-mid-run) and by invoking the method via a VBA module method named auto_close.

@fzumstein fzumstein added the bug label Jun 1, 2015

@fzumstein

This comment has been minimized.

Member

fzumstein commented Jun 19, 2015

This has been introduced with 0.3.3. Reason for it is this line: https://github.com/ZoomerAnalytics/xlwings/blob/master/xlwings/main.py#L145 - just comment it out for now. I wanted to get rid of it anyways to make the API consistent with the other classes.

@fzumstein

This comment has been minimized.

Member

fzumstein commented Jun 20, 2015

closed by f9a7ca3

@fzumstein fzumstein closed this Jun 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment