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

Atom stata language mapping #403

Open
ottovong opened this issue Oct 11, 2021 · 7 comments
Open

Atom stata language mapping #403

ottovong opened this issue Oct 11, 2021 · 7 comments

Comments

@ottovong
Copy link

ottovong commented Oct 11, 2021

Hi,

I'm a beginner in code. I've installed Atom few month ago to learn python. And now for my new studies, I have to work with Stata. I've see that it's possible to use atom as a do-file for stata.
I've installed language stata and hydrogen packages as it's explain here. Atom recognize the language but the run command (crtl-enter) dosen't work. An error message come :
"No kernel for grammar Stata found
Check that the language for this file is set in Atom, that you have a Jupyter kernel installed for it, and that you have configured the language mapping in Hydrogen preferences."

Can anybody help me to write the correct language mapping?

Atom is really good but without the run command that's not useful for me.

Thank you in advance for your answers.

@kylebarron
Copy link
Owner

kylebarron commented Oct 11, 2021

Make sure you've gone through these steps: https://kylebarron.dev/stata_kernel/getting_started/ and then make sure that the console works outside of Atom, like in Jupyter Notebook.

@ottovong
Copy link
Author

ottovong commented Oct 11, 2021

Yes. I followed all these steps. But... the console should works outside of Atom? I just opened a new file in Atom. What does I make different. I'm sorry, I realize that really I have a beginner's level and i never tried Jupyter. Do I have to download jupyter too or is hydrogen enough for Atom?

@kylebarron
Copy link
Owner

You need to set up Jupyter. It needs to be able to run outside atom in order to run inside it

@ottovong
Copy link
Author

ottovong commented Oct 12, 2021

Ok. I've download Jupyterlab and python kernel. In Atom, shift-enter works now with python (only when i launch from console) but doesn't work with stata language and the same error message with language mapping appear.
Should I install the stata_kernel in the folder of atom or of hydrogen package?

@ottovong
Copy link
Author

ottovong commented Oct 13, 2021

It seems to come better. Now atom recognize stata kernel but I receive the following error message :

Your Hydrogen config is broken: languageMappings
SyntaxError: Unexpected token { in JSON at position 27

Stata
Traceback (most recent call last): File "C:\Users\GATS\anaconda3\lib\runpy.py", line 194, in run_module_as_main return run_code(code, main_globals, None, File "C:\Users\GATS\anaconda3\lib\runpy.py", line 87, in run_code exec(code, run_globals) File "C:\Users\GATS\anaconda3\lib\site-packages\stata_kernel__main.py", line 2, in from . import StataKernel ImportError: cannot import name 'StataKernel' from 'stata_kernel' (C:\Users\GATS\anaconda3\lib\site-packages\stata_kernel__init.py)_
What should I do to fix it?

@kylebarron
Copy link
Owner

Your Hydrogen config is broken: languageMappings SyntaxError: Unexpected token { in JSON at position 27

This implies the configuration field languageMappings is invalid in the Hydrogen settings.

ImportError: cannot import name 'StataKernel' from 'stata_kernel'

I think there are some issues about this already on this repo. You might need to edit your config file manually to fix the path to Stata.

@ottovong
Copy link
Author

Thanks for the answer.
Do you know where I can found the valid code to fill the configuration field languageMappings?
And, about which repo do you talk?

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