Jupyter bugs: Out of sync source code
See original GitHub issueBug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
- Run long execution code like Keras neural networking training
- Editing cells as code being executed while enabling autosaves
- Sometimes code blocks show on vscode notebook is different than code blocks store on disk.
- Have to close and reopen the file to see actual editing that occurs
Description
I encounter a problem with Jupyter notebook where source code on display in vscode is different that source code on disk(I assume this is the code executed by the kernel). I need to reopen the ipynb file to see the updated code. The problem usually occurs when cells are being executed and I make some editing to the code. For example, if I comment out multiple lines of code, it looks correct in vscode but it will throw a syntax error when I execute the cell. Upon reopening the ipynb file, the “#” is being inserted in the middle of a line instead of at the beginning like what vscode shown previously. Enable “Auto Save” causes the bug to occur more often. I started to have this problem two patches ago.
Actual behavior
VSCode Notebook before edit:
fc_model.add(layers.Dense(2500, activation="relu"))
fc_model.add(layers.Dense(2000, activation="relu"))
fc_model.add(layers.Dense(1500, activation="relu"))
fc_model.add(layers.Dense(1000, activation="relu"))
fc_model.add(layers.Dense(500, activation="relu"))
VSCode Notebook after edit:
# fc_model.add(layers.Dense(2500, activation="relu"))
# fc_model.add(layers.Dense(2000, activation="relu"))
# fc_model.add(layers.Dense(1500, activation="relu"))
# fc_model.add(layers.Dense(1000, activation="relu"))
# fc_model.add(layers.Dense(500, activation="relu"))
Code stored on disk after edit:
fc_model.add(lay#ers.Dense(2500, activation="relu"))
fc_model.add(layers.Dense(2000#, activation="relu"))
fc_model.add(layer#s.Dense(1500, activation="relu"))
fc_model.a#dd(layers.Dense(1000, activation="relu"))
fc_model.add(laye#rs.Dense(500, activation="relu"))
Expected behavior
VSCode Notebook before edit:
fc_model.add(layers.Dense(2500, activation="relu"))
fc_model.add(layers.Dense(2000, activation="relu"))
fc_model.add(layers.Dense(1500, activation="relu"))
fc_model.add(layers.Dense(1000, activation="relu"))
fc_model.add(layers.Dense(500, activation="relu"))
VSCode Notebook after edit:
# fc_model.add(layers.Dense(2500, activation="relu"))
# fc_model.add(layers.Dense(2000, activation="relu"))
# fc_model.add(layers.Dense(1500, activation="relu"))
# fc_model.add(layers.Dense(1000, activation="relu"))
# fc_model.add(layers.Dense(500, activation="relu"))
Code stored on disk after edit:
# fc_model.add(layers.Dense(2500, activation="relu"))
# fc_model.add(layers.Dense(2000, activation="relu"))
# fc_model.add(layers.Dense(1500, activation="relu"))
# fc_model.add(layers.Dense(1000, activation="relu"))
# fc_model.add(layers.Dense(500, activation="relu"))
Your Jupyter and/or Python environment
Please provide as much info as you readily know
- Jupyter server running: Local
- Extension version: 2020.3.69010
- VS Code version: 1.43.2
- Setting python.jediEnabled: true
- Python and/or Anaconda version: 3.6 and 4.8.2
- OS: Windows
- Virtual environment: conda
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (7 by maintainers)
Top GitHub Comments
After a few more test I don’t get the error every time, but it happens often with the current version. I didn’t menage to get the same errors with the insider version.
Yes the model updating was different then. It was actually at a different level this problem would manifest itself.