ipynb file does not open anymore - python

I was working on a ipynb in pycharm. And suddenly I'm not able anymore to open that file. I can see raw code with a text editor like sublime and pasting it in online validator I get this error. How can I find a solution? I'm worried that I've lost everythng.

Related

I cannot run python on vscode because my computer believes that my .py file is untrusted

Previously I had python running just fine in VSCode but recently something has gone wrong and I'm not sure how to resolve it.
When I open a .py file (downloaded from an email) in VSCode I get a message saying that this source is not trusted. I then followed through the suggestions and made the file trusted and I get a box saying that all extensions are enabled. However, when I try and run it, the box is still blurred out
This is the error I get when I try and run the whole file, not just the cell.
Does someone know how to get this up and running first? Thanks
See the comment and say it is .ipynb file, you only need to enter the trusted file name on the command line of Jupiter notebook
"$ jupyter trust 'filename'.ipynb"
This is a link to instructions:https://jupyter-notebook.readthedocs.io/en/stable/notebook.html#trusting-notebooks

how to get the JSON code of a .ipynb file?

I have a problem when I try to open an Ipynb file in Jupyter lab, I get this error :
Unreadable notebook [...] NotJSONError("Notebook does not appear to be JSON: ''...")
I get this error even if I create the file with Jupyter lab directly
I already tried to update Jupyter and to update Nodejs but nothing change.
Before I had this problem I didn't even know that ipynb files were made with JSON so I am a bit lost.
does anyone know how I can get the JSON code of my Ipynb file?
You can validate the .ipynb file with a JSON validator: like this one

Saved Jupiter notebook to strange format

I have been learning python for a year. Yesterday I was working on a project for many hours, and I was constantly clicking the save button. In the end, I tried to download the notebook as a pdf file unsuccessfully, but it was very late and gave up.
Today I went to the Jupyter notebook and 2/3 of the work was not there!. It says last checkpoint 19 pm but I went to sleep (and saved the file numerous times) at 4 am.
On the other hand, I am finding a lot of files with format .1 (never seen this before) with the name of the original file, however, when I open them I see endless lines of JSON code of what I believe is the work I was doing yesterday, just in an unworkable format.
THis is a capture of the type of file I saved
Does anybody know what happened here and what I can do to recover the original code?
Thank you so much.
The file in the screenshot looks like a Jupyter file (Jupyter notebooks are saved in the JSON format). Try to change the extension to .ipynb and open it in Jupyter Notebook.

Unreadable Notebook: C:\file path UnicodeDecodeError('utf-8) for Jupyter Notebook

I am trying to open a notebook file that I was working on 3 days ago, however, I get the following error Unreadable Notebook: C:\file path UnicodeDecodeError('utf-8) for Jupyter Notebook. How can I get this file to work again.
I've reinstalled Anaconda and tried opening the file on different computers but it still doesn't work
I just had this problem and this is what worked for me.
Open the problem notebook in a text editor and copy all the text. Open a new file in your text editor and paste in the text, then save the file. In my case the text editor did not have the option to save as a Jupyter Notebook, so I saved as .txt.
Move the file into your Jupyter area. Rename it so the ending is .ipynb and not .txt. Then open the file as a notebook.
As I read through the now-working notebook I saw some comments had what looked like Chinese characters in them. I don't know exactly what happened there to make those appear but if you used Ctrl+/ to comment like I do then it's possible that is where the issue is in your notebook. So if my janky method of converting file types does not work for you and you still really want to save your notebook enough to manually dig through all the markup and text then you can try checking your comments in the file to see if there are odd characters in there.

VS Code turned .ipynb file to binary and cannot open

I was working on a project in python in MS VSCODE and saved a file. When returning to it, the file wouldn't open in the editor and claims
"the file is not displayed in the editor because it is either binary or uses an unsupported text encoding"
Any ideas or help on how to resolve this? And also why this happened? I cannot find any helpful threads any where.

Categories