The script is simple, but it is not a simple string. It must be cleaned-up before comparing.
Here is your working script:
*** Test Cases ***
Compare
${abc1}= Set Variable 1\n2
${abc2}= Set Variable 12
Run Keyword If "${abc1.replace('\n','').strip()}" != "${abc2.replace('\n','').strip()}" Log 1234
An EOL (End of Line) error indicates that the Python interpreter expected a particular character or set of characters to have occurred in a specific line of code, but that those characters were not found before the end of the line . This results in Python stopping the program execution and throwing a syntax error . The error eol while scanning string literal error in python occurs when while scanning a string of a program the python hit the end of the line due to the following reasons:
Missing quotes
Strings spanning multiple lines
Python is particularly prone to this type of error, since Python ends statements with newlines/line breaks , whereas most other programming languages have a character such as a semicolon ( , which means that other programming languages work more easily with multi-line statements out of the box.