stata_kernel icon indicating copy to clipboard operation
stata_kernel copied to clipboard

Atom stata language mapping

Open ottovong opened this issue 4 years ago • 7 comments

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.

ottovong avatar Oct 11 '21 19:10 ottovong

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.

kylebarron avatar Oct 11 '21 20:10 kylebarron

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?

ottovong avatar Oct 11 '21 20:10 ottovong

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

kylebarron avatar Oct 11 '21 21:10 kylebarron

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 avatar Oct 12 '21 06:10 ottovong

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?

ottovong avatar Oct 13 '21 08:10 ottovong

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.

kylebarron avatar Oct 14 '21 17:10 kylebarron

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?

ottovong avatar Oct 14 '21 19:10 ottovong