問題
你運行一個Python筆記本,它失敗了AssertionError:顏色格式錯誤消息。
一個堆棧跟蹤的例子:
文件"/local_disk0/tmp/1599775649524-0/PythonShell.py",第39行,在<模塊> from ipython .nbconvert. filtering .ansi import ansi2html File "_bootstrap>",第983行,in _find_and_load File "<凍結importlib. txt . txt "_bootstrap>",第963行,in _find_and_load_unlocked File "<凍結importlib. txt_bootstrap>", line 902, in _find_spec File "<凍結importlib。“/databricks/python/lib/python3.7/site-packages/IPython/utils/shimmodule.py”,第36行,in find_module mod = import_item(mirror_name) File "/databricks/python/lib/python3.7/site-packages/IPython/utils/importstring.py",第31行,in import_item module = __import__(package, fromlist=[obj]) File "/databricks/python/lib/python3.7/site-packages/nbconvert/__init__.py",第4行,"/databricks/python/lib/python3.7/site-packages/nbconvert/exporters/__init__.py",第4行,在from .slides import slidesexporters File "/databricks/python/lib/python3.7/site-packages/nbconvert/exporters/slides.py",第12行,在 from ..preprocessors. "base import預處理器文件"/databricks/python/lib/python3.7/site-packages/nbconvert/preprocessors/__init__.py",第7行,在<模塊> from .csshtmlheader import CSSHTMLHeaderPreprocessor File "/databricks/python/lib/python3.7/site-packages/ jupyterlab_pylanguages import JupyterStyle File "/databricks/python/lib/python3.7/site-packages/ jupyterlab_pylanguages /__init__.py",第4行,在<模塊> from .csshtmlheader import CSSHTMLHeaderPreprocessor File "/databricks/python/lib/python3.7/site-packages/ jupyterlab_pylanguages /__init__.py"在<模塊> from .style import JupyterStyle File "/databricks/python/lib/python3.7/site-packages/ jupyterlab_pylings / Style .py",第10行,在<模塊>類JupyterStyle(Style): File "/databricks/python/lib/python3.7/site-packages/ pylings / Style .py",第101行,在__new__ ndef[0] = colorformat(styledef) File "/databricks/python/lib/python3.7/site-packages/ pylings / Style .py",第58行,in colorformat assert False, "錯誤的顏色格式%r" % text AssertionError:錯誤的顏色格式'var(——jp-mirror-editor-variable-color)'
導致
的不兼容版本造成的nbconvert圖書館。如果你沒有nbconvert如果沒有固定到正確的版本,那麼通過PyPI安裝一個不兼容的版本是有可能的。
解決方案
手動安裝nbconvert集群上的版本為6.0.0rc0。這將覆蓋可能已安裝的庫的任何不正確版本。
- 單擊側邊欄中的集群圖標。
- 單擊集群名稱。
- 單擊庫選項卡。
- 點擊安裝新.
- 在庫源按鈕列表中,選擇PyPi.
- 輸入nbconvert = = 6.0.0rc0在包字段。
- 點擊安裝.