You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#@title Enable text wrapping in Google ColabfromIPython.displayimportHTML, displaydefset_css():
display(HTML(''' <style> pre { white-space: pre-wrap; } </style> '''))
get_ipython().events.register('pre_run_cell', set_css)
running the notebook in IntelliJ yields
Error in callback <function set_css at 0x1042df380> (for pre_run_cell), with arguments args (<ExecutionInfo object at 10425b500, raw_cell="from IPython.display import HTML, display
def set.." store_history=True silent=False shell_futures=True cell_id=None>,),kwargs {}:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
TypeError: set_css() takes 0 positional arguments but 1 was given
The text was updated successfully, but these errors were encountered:
I see in another notebook in LLMU #@title Enable text wrapping in Google Colab and I need to clarify I am using IntelliJ to run the notebooks. No issues when running in Colab.
Sorry for that issue and thanks for mentioning it.
The error you're seeing probably happens because IntelliJ's Jupyter implementation passes a cell execution event object to the callback function, but the current set_css() function doesn't accept any parameters.
Try changing the set_css() function to accept an optional parameter:
fromIPython.displayimportHTML, displaydefset_css(*args): # Accept variable argumentsdisplay(HTML(''' <style> pre { white-space: pre-wrap; } </style> '''))
get_ipython().events.register('pre_run_cell', set_css)
ThiswayitshouldworkbothinColab (wherenoargumentispassed) andIntelliJ (whereanexecutioneventobjectispassed). The`*args`syntaxallowsthefunctiontoacceptanynumberofpositionalargumentswithoutraisinganerror, evenifwedon'tusethem.
Pleaseletmeknowifthatworksforyou, ifyoudon't mind testing that for me in IntelliJ, and I'llmakethechangeinthisrepo. Letmeknowifyouhaveanyquestions!
source: notebooks/llmu/Introduction_to_RAG.ipynb
running the notebook in IntelliJ yields
The text was updated successfully, but these errors were encountered: