VSCode Jupyter Notebook-还原缓存版本 [英] VSCode Jupyter Notebook - Restore Cache Version

查看:289
本文介绍了VSCode Jupyter Notebook-还原缓存版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用在Ubuntu 19.10上运行的VSCode(v 1.48.0)创建Jupyter Notebook. VSCode崩溃了,不幸的是我没有保存笔记本,重新启动时它是空的.

我已经能够在〜/.config/Code/User/globalStorage/ms-python.python中的527ed533.ipynb文件中找到笔记本的缓存版本. 文件外观的小样本

查看文件的内容,我可以确定这是我正在使用的笔记本,但是格式看起来有点乱码,

当我尝试在VSCode中打开文件备份时,它只是将其识别为文本.我也尝试过在Jupyter服务器上打开它,并且它也不能将其识别为有效的笔记本.

我尝试对数据进行一些手动编辑,主要是为了删除除单元格"之外的所有内容.但这并不成功.

有什么办法可以从该文件取回笔记本?

解决方案

手动方式:

  • 从临时文件中复制内容.
  • 通过将内容放在此处(在Chrome检查器的控制台中)运行此脚本.

 var fileContent = << paste it just like that >>;   // It's an object
console.log(unescape(fileContent.contents));
 

  • 复制在控制台中登录的内容.
  • 使用.ipynb创建一个新文件,在此处打开并粘贴.

输出:

我确实注意到了此类文件,但是在其他位置,我使用的是Mac.

~/Library/Application Support/Code/User/globalStorage/ms-python.python/4ae407c9.ipynb

I was creating a Jupyter Notebook using VSCode (v 1.48.0) running on Ubuntu 19.10. VSCode crashed and unfortunately I had not saved the notebook, and when I restarted it was empty.

I have been able to find what looks like a cached version of the notebook in ~/.config/Code/User/globalStorage/ms-python.python , in a file called 527ed533.ipynb. Small sample of what the file looks like

Reviewing the contents of the file, I can tell that this is the notebook I was working on, but the format looks a bit garbled,

When I try and open the file back up in VSCode it just recognises this as text. I have tried to open it on Jupyter server too and it also does not recognise this as a valid notebook.

I tried to do a bit of manual editing of the data, mainly to remove everything other than the "cells" but this was not successful.

Is there any way that I can get the notebook back from this file?

解决方案

Manual way:

  • Copy contents from your temp file.
  • Run this script by placing the content here (in Chrome inspector's console).

var fileContent = << paste it just like that >>;   // It's an object
console.log(unescape(fileContent.contents));

  • Copy the contents that are logged in console.
  • Create a new file with .ipynb, open and paste it here.

Output:

I did notice such files but in a different location, I use Mac.

~/Library/Application Support/Code/User/globalStorage/ms-python.python/4ae407c9.ipynb

这篇关于VSCode Jupyter Notebook-还原缓存版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆