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

%help magic does not work for Stata commands #426

Open
arnonerba opened this issue Apr 26, 2022 · 4 comments
Open

%help magic does not work for Stata commands #426

arnonerba opened this issue Apr 26, 2022 · 4 comments

Comments

@arnonerba
Copy link

The %help magic does not currently seem to work for Stata commands. Built-in commands like %help magics work, but Stata-specific queries like %help histogram do not. The cell is marked as [*] in JupyterLab and never returns any output.

I can confirm this behavior on an Ubuntu 20.04 system running Stata 17 and on a Windows system running Stata 15. The stata_kernel debug log is empty.

@mcaceresb
Copy link
Collaborator

mcaceresb commented Apr 26, 2022

Just to confirm, do you have internet? (i.e. while running the kernel)

@arnonerba
Copy link
Author

Yep, I have Internet access, and help commands work properly in the Stata app itself (at least on the Ubuntu 20.04 machine).

@poisoners
Copy link

Modify the code in stata_magics.py located in \Lib\site-packages\stata_kernel.

Original code:

reply = urllib.request.urlopen(self.html_help.format(cmd))
html = reply.read().decode("utf-8")

Change it to:

reply = requests.get(self.html_help.format(cmd))
html = reply.text

@poisoners
Copy link

Also need to add import requests at the beginning.

I'm not sure why, but using requests to fetch the webpage works fine, while using urllib does not.

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

3 participants