Skip to content
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

How to make jupyter automatically close the stata session #425

Open
Gritbadger opened this issue Apr 14, 2022 · 1 comment
Open

How to make jupyter automatically close the stata session #425

Gritbadger opened this issue Apr 14, 2022 · 1 comment

Comments

@Gritbadger
Copy link

Hi,thank you for writing stata_kernel, which is very convenient to use. I can use python's powerful data functions and stata's powerful statistical functions at the same time.

But there is a problem, that is, whenever I use jupyterlab to create a new stata notebook, execute the stata command, and finally close the stata notebook, but jupyter will not automatically close the stata process, I have to enter the Windows task window every time, and manually close the stata process, which makes me Very convenient. Is there a way to fix this?

@kylebarron
Copy link
Owner

kylebarron commented Apr 15, 2022

Looks like this is supposed to be handled through do_shutdown. We do call self.stata.shutdown()

self.stata.shutdown()

which tries to run exit, clear in Stata:
if config.get('execution_mode') == 'automation':
self.automate('DoCommandAsync', 'exit, clear')

Not sure off the top of my head why that wouldn't work in Windows. Maybe config.get('execution_mode') isn't set properly on Windows. We could switch that to if is_windows() or config.get('execution_mode') == 'automation':

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants