kylebarron / stata_kernel

A Jupyter kernel for Stata. Works with Windows, macOS, and Linux.
https://kylebarron.dev/stata_kernel/
GNU General Public License v3.0
266 stars 57 forks source link

Atom stata language mapping #403

Open ottovong opened 3 years ago

ottovong commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

ottovong commented 3 years ago

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 commented 3 years ago

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_kernelmain.py", line 2, in from . import StataKernel ImportError: cannot import name 'StataKernel' from 'stata_kernel' (C:\Users\GATS\anaconda3\lib\site-packages\statakernelinit.py) What should I do to fix it?

kylebarron commented 3 years ago

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 commented 3 years ago

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?