TOC
Problem Statement
When you finish working on a Jupyter Notebook (.ipynb
) file, sometimes, it might not be saved in a correct state, so when you later open the file, you see an error which states "Unable to open x.ipynb
. Bad control character in string literal in JSON at position y (line w column z)":
Solution
Solution (taken from this SO answer):
Open the file by clicking on the Open in Text Editor
option shown in the screenshot above.
Then see which lines are causing syntax errors:
Then, make sure these lines end with \n
:
As you can notice by the highlighted lines in yellow, I had duplicated the line ipython = get_ipython()\n
in the wrong place, which was the cause of the error.
A Tip on How to Search for Errors
Initially, I searched for the error like this:
As you can see, the initial results weren't helpful. Moreover, when I asked ChatGPT 3.5 on this error (with minimal prompt engineering), it gave me this result, which wasn't very useful for my case:
However, when I modified my search term to be like this:
It gave me the SO post that solved my issue!
TLDR; knowing small search tricks can save you some time :].
Bonus - autoreload
If you're curious about the context of the code in the screenshots above, check this file :].
Outro
Hit me up if you have any questions ^^ 🙌:
LinkedIn
GitHub
Gmail: ashicsresources@gmail.com
But for now...
Top comments (0)