Using paste/type with extended characters

Asked by Michael A. Phillips

I'm trying to do something like this:

paste("Name: Michael\nLocation:NC USA\n356mm (14" Zambuto)")

There's plenty of words in there that are highlighted as special functions or characters. How can I mask the text to be pasted? Right now it errors off with this:

[error] Stopped [error] An error occurs at line 1 [error] Error message: SyntaxError: ('mismatched character \'\\n\' expecting \'"\'', ('/tmp/sikuli-tmp8146918372984068098.py', 1, 120, 'paste("Name: Michael\\nLocation: NC USA\n'))

Thanks,

Mike

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
eliteSKL
Solved:
Last query:
Last reply:
Revision history for this message
Best eliteSKL (camaro70s) said :
#1

paste("Name: Michael\nLocation:NC USA\n356mm (14" Zambuto)")
..........................................................................^ the quote there needs to be escaped.

try below:

paste("Name: Michael\nLocation:NC USA\n356mm (14\" Zambuto)")

you are probably trying to put quotes in side a string is the problem. see escape charaters
http://docs.python.org/reference/lexical_analysis.html#string-literals

Revision history for this message
eliteSKL (camaro70s) said :
#2

or delete the quote.

Revision history for this message
Michael A. Phillips (maphilli14) said :
#3

Wonderful! Thanks! I was also worried that some of the text to be pasted was spotted as a keyword and had different actions, but miscolored words didn't impact the text!

Thanks!

Mike

Revision history for this message
Michael A. Phillips (maphilli14) said :
#4

Thanks eliteSKL, that solved my question.