Atom for ghPython: unexpected EOF while parsing

Hi there,
I’m trying to use atom as a external IDE for rhino ghPython, because the editor inside ghPython on Mac is really limited, so I connected a *.py file to the ‘code’ input parameter in ghPython component, but i found some basic script is not work , as shown below:


very simple line, which work normally in Atom itself, but ‘unexpected EOF while parsing’ show up in ghPython, I dont know how to deal with that.

1 Like

Hi @zoeyma1988,

from your screenshot it looks like your file reading component is set to ReadLines, meaning it outpust a list of strings for every line in your file. So Error in the python component makes perfect sense as only the first line is ever parsed.

Try setting your file reading component to read the whole content of the file, not individual lines

1 Like

you perfectly fix my problem, thank you!
can’t believe I’v been stuck for 2days :mask:

Hi, I have the same problem .When I want to write a code in python I have EOF while parsing error . Do you have any idea what the problem can be ? I did not understand how to use the path and read file components to solve this .
Thanks

Hi @nilofarzaker your problem is more of a general python question, I would advise you to go through some beginner tutorials for python first before jumping into rhinopython.

Try the tutorials here: https://www.learnpython.org/

To answer your specific question: You are trying to append to the list a. Functions in Python are called like so:

myList.append(someItem)

You forgot to supply an argument to the append function in your sample, also you never close the brackets which is why you get the EOF error.

Hope to help

1 Like

Thanks for your answer @lando.schumpich .But my Problem is exactly that . The reason you see I did not write the whole code is that I wanted to show you before testing the code and while writing the code I got this error . Otherwise I know that I should complete the syntax .
When I complete the code I do not have this error.
But I used to work with python and I did not have any error while writing the code .

Python is an interpreted language, meaning, if you give the parser an incomplete code, it will complain. If you just google for your error you will find many examples.

https://stackoverflow.com/questions/43189302/syntaxerror-unexpected-eof-while-parsing#:~:text=6%20Answers&text=The%20SyntaxError%3A%20unexpected%20EOF%20while,that%20should%20be%20in%20it.

I’m curious as to how you can run the code you showed as a stand-alone (without Rhino) and not get any errors

1 Like

I interpreted his post that the error showed up while typing the code and not after he pressed the Test button to actually run the code. My speculation of course, but if that’s the case and repeatable, it is a bug in the editor. The MacRhino GH Python editor is still in the construction stage AFAIK.

1 Like