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

Invalid Syntax error on multi-line values #904

Closed
jeremyechols opened this issue Jul 3, 2017 · 4 comments
Closed

Invalid Syntax error on multi-line values #904

jeremyechols opened this issue Jul 3, 2017 · 4 comments

Comments

@jeremyechols
Copy link

Description:

When creating multi-line values, such as a dictionary, I am receiving an 'invalid syntax' error when trying to run Hydrogen within Atom. However, if I run the dictionary as a long single line, Hydrogen runs fine.

I have tested the multi-line code within my Jupyter notebook, and have run the .py file through Terminal with the multi-line code saved and both run just fine. Hydrogen is the only thing that I try to run that is having the issue.

Steps to Reproduce:

  1. Create multi-line value (dictionary in this case).
  2. Run hydrogen (shift+return)

Versions:

Which OS and which version of Hydrogen and Atom are you running?
Mac OS - 10.12.5
Atom - 1.18.0
Hydrogen - 1.18.0

Atom : 1.18.0
Electron: 1.3.15
Chrome : 52.0.2743.82
Node : 6.5.0

You can get this information from copy and pasting the output of atom --version from the command line.

Logs:

Please post any error logs and the output of the developer tools as described in our Debugging Guide.
File "", line 1
'population': [200.4, 143.5, 1252, 1357, 52.98]}
^
SyntaxError: invalid syntax

When using this dictionary:
worldDict = {'country': ['Brazil', 'Russia', 'India', 'China', 'South Africa'],
'capital': ['Brasilia', 'Moscow', 'New Delhi', 'Beijing', 'Pretoria'],
'area': [8.516, 17.10, 3.286, 9.597, 1.221],
'population': [200.4, 143.5, 1252, 1357, 52.98]}
image

@ghost
Copy link

ghost commented Jul 11, 2017

I encounter the same issue with multi-line sections that I try to execute in one shot with Hydrogen.

@jeremyechols
Copy link
Author

I have figured out that when declaring a variable and assigning a value to it, you have to run the code from the top line (seems inconvenient, when I'm wanting to run the code upon completion of typing the values, but I get it).

However, I have not figured out a workflow to make if/elif/else statements run within Hydrogen.

@rgbkrk
Copy link
Member

rgbkrk commented Jul 13, 2017

However, I have not figured out a workflow to make if/elif/else statements run within Hydrogen.

I select all the text I want to run and hit cmd-enter (hydrogen: run command).

@lgeiger
Copy link
Member

lgeiger commented Jul 14, 2017

You can also use cells to run predefined code blocks.

I'm going to close this as a duplicate of #724. Please take a look at #724 for more information.

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