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

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

Related

Getting a data set tar file to run in Python Jupyter notebooks in Watson Studio

I am trying to upload a dataset that is a compressed tar file in jupyter notebooks in Watson Studio but it keeps giving me an error when I try to add (insert to code) the data to the python jupyter notebook. I noticed that the add data asset is not giving me a insert to code pandas data frame option like other CSV files, but it is giving me a streaming data option instead. Is there anyone that can help me solve this missing step? Thanks!

How to access the JSON of a (non-saved) Jupyter notebook from within it?

How can the (JSON) contents of a Jupyter notebook (i.e. what would be saved in a .ipynb file) be accessed programmatically from within the notebook?
There is the option of forcing the notebook to be saved and then reading back the .ipynb file, but I prefer to not clobber the current .ipynb. Maybe there is a way of at least saving it under another path? That would not be ideal, but that would work.
According to #krassowski in the comments to the question, accessing the JSON of a Jupyter Lab notebook from within itself is not currently doable.

Unable to save dataframe in Jupyterlab to CSV/Excel

I'm trying to export a dataframe in Jupyterlab. The command runs but I don't see the file on my desktop.
I'm trying this but I don't find the file. I've even tried to_excel version but that doesn't work either. Any help, pls.
df_busu.to_csv(r'C:\Users\Admin\Desktop\app_play_store.csv')
try to save without raw string format and inverting the "" to "/".
`df_busu.to_csv("C:/Users/.../file.csv"; sep=";")`
that's how a export a file to csv from pandas in Win10.

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.

what's the problem to my file extentions (.ipynb , .py)

I changed the extension of the file after working on the jupyter notebook.
(.ipynb -> .py)
After that I got a problem.
I can not go back to try to go back to the .ipynb with strange files.
How can someone help me? :j
If you mean changing just the extension then it wont..it's like saving the features of ipynb notebook to .py file. Instead you can download the IPYNB as PY file on Jupyter notebook itself..

Categories