Bugs That Bite
Published in

Bugs That Bite

SyntaxError: EOL while scanning string literal

Forgot to close a string with quotes in python

In my case, this error was a on overcomplicated way of saying, “You forgot to close a string with a matching double or single quote.”

EOL stands for End of Line. What that means is that the python parser got to the end of a line of code before it found the end single quote or double quote to close a string.

In other words this would cause the error:

filename="File.json

And you need to fix it like this:

filename="File.json"

Or this causes the error:

filename='File.json

And you fix it like this:

filename='File.json'

Sometimes you’ll have an issue where you’re trying to put a single or double quote in a string. In that case, put single quotes around a string with double quotes in it or vise versa.

You can also escape the special character.

More on single and double quotes in python and escaping characters:

Teri Radichel

If you liked this story please clap and follow:

Medium: Teri Radichel or Email List: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests services via LinkedIn: Teri Radichel or IANS Research

© 2nd Sight Lab 2022

____________________________________________

Author:

Cybersecurity for Executives in the Age of Cloud on Amazon

Need Cloud Security Training? 2nd Sight Lab Cloud Security Training

Is your cloud secure? Hire 2nd Sight Lab for a penetration test or security assessment.

Have a Cybersecurity or Cloud Security Question? Ask Teri Radichel by scheduling a call with IANS Research.

Cybersecurity & Cloud Security Resources by Teri Radichel: Cybersecurity and Cloud security classes, articles, white papers, presentations, and podcasts

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store