I am using VsCode to write my .ipynb codes, and GitHub Desktop to push the files to repositories in GitHub.
When opening the code file in VsCode I can see both input and output cells. Meanwhile after pushing the files to GitHub I can see all input cells and some output cells only when they contain figures or tables, otherwise the output cells are not shown.
For example when the input cell contains (print command) I can see the result printed on VsCode in an output cell, but in Github the output cell will be either empty or does not exist.
Previously I did not face this problem, and I do not recall changing anything in the settings in GitHub, VsCode, GitHub Desktop.
Anyone has an idea what could be the problem ? Thanks alot in advance.
I'll attach some screenshots :
1-1- Input and output in VsCode:
1-2- same input cell in GitHub with no output cell at all!
2-1- Anthore input and output cell at VsCode:
2-2 - Same input cell in GitHub with empty output cell :
I cut a ticket with GitHub for the same issue. They have confirmed it to be a bug with their renderer. You can verify it's the same problem by checking the raw notebook file for an output block. If text is there but not rendered, GitHub say they have a few reports of the problem and are working on a fix.
Related
I've googled a bit but everything points to the Jupyter notebook, not vscode and was just wondering if there are any resources available on how to use these cell tags in VSCode. Simply copying a tag in doesnt seem to do anything in my notebook.
So basically 2 questions:
How do you use this tab?
What do cell tags do?
I'm used to hitting the R key in jupyter to change it to raw NbConvert type which deactivates it, but I don't see that option in the shortcuts for vscode. Is there a way to change a cell to raw nbconvert in vscode, or some equivalent way of preventing a cell from accidentally being run? raw format is perfect because it's easy to tell
apparently (from what I know) there's no shortcut key to change a cell to raw. However it's possible to change a cell to raw NbConvert from the GUI.
From the picture above, you can see that this Python/raw is shown at the bottom right of a cell. Just simply click on the Python word and choose raw from the pop out selection and boom. You get a raw NbConvert cell. Hope this helps! :)
I was trying to copy from GitHub the following file: https://github.com/vineodd/PIMSim/blob/master/GEM5Simulation/gem5/configs/common/MemConfig.py
I have tried using git clone, downloading directly from the website and also copying and pasting. I have done this in four different text editors: sublime text, atom, textWrangler and Spyder. In Spyder it gives me the following message:
Contains mixed end-of-line characters.
Every time, when I open the file the indentation is wrong in a lot of places, what is a problem because it is a Python file. You can see it for example in the line 280. In GitHub all appears to be fine. Can I do something to fix this? Has this happened to anyone before? Any help would be appreciated. Thanks in advance!
I have already figured it out what was happening here. The file was combining spaces and tabs for indentation. GitHub displays tabs as 8 columns (spaces), but in the text editors it was equivalent to 4 columns. So to fix it I opened a new file where I just wrote a tab. I copied it and used it to replace all tabs for 8 columns.
If you're using intellij/Android studio, you can 'Paste as Plain Text'
I have issues on jupyter notebook conversion. It looks fine on jupyter notebook. However if I convert it to html or upload to github, it displays like photo above.
Instead of vertical(scroll up and down), I have to scroll left and right and each cell are really narrowed.
Any suggestion?
Thanks in advance!
This is typical of a library you use emitting invalid HTML. I would suggest opening an issue or contacting the Jupyter mailing list to help you debug this as StackOverflow will not be the right place to have a back and forth.
You should be able to narrow down which library does that by:
- backup your notebook.
- Delete cells one and until notebook looks normal. (tip use nbconvert locally instead of uploading, and use python -m http.server)
- the last cell you delete have a issue.
It may be a bug in nbconvert but I doubt it.
I'm working on a jupyter notebook (from a local installation of jupyterhub) that I want to be able to copy and distribute to my coworkers. Some of them are a little 'code-phobic' so I want to be able to portions of the code from them.
I can use the hide input extension to very prettily hide the code in my own notebook, however when I make a copy the cell meta-data for hide input reverts to "hide_input": false, and the code is all automatically visible.
Is there a way to keep cell meta data in the copying process?
I can find a lot of online discussions/documentation about keeping hide input functionality with nbconvert, however I don't want to convert to html because I still need the users to be able to actually run code.
Is there a way to use nbconvert to make a copy of a notebook and not actually convert it?
Thanks.
I'm confused - because for me cell metadata is preserved when copied. Are you sure you are actually saving the notebook after you have changed the cell metadata?
Regardless, you can use nbconvert to "convert" a notebook into a notebook; use the command:
jupyter nbconvert --to notebook --execute mynotebook.ipynb
From the docs: https://nbconvert.readthedocs.io/en/latest/usage.html#notebook-and-preprocessors
If you use the Toggle selected cell input button or individually edit cell metadata the individual cell hide input status was not preserved. But when I used the Hide codecell inputs to hide the input of all the cells; then it was preserved after copying.