Skip to content

Commit

Permalink
Update extensions/positron-python/python_files/positron/positron_ipyk…
Browse files Browse the repository at this point in the history
…ernel/positron_ipkernel.py

Co-authored-by: Wasim Lorgat <mwlorgat@gmail.com>
Signed-off-by: Isabel Zimmerman <54685329+isabelizimm@users.noreply.github.com>
  • Loading branch information
isabelizimm and seeM authored Apr 19, 2024
1 parent d9a7688 commit 59989a3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,16 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
# if coming from one of our files, log and don't send to user
positron_files_path = Path("python_files", "positron", "positron_ipykernel")

console_dir = get_tmp_directory()
if str(positron_files_path) in str(filename):
msg = f"{category}: {message}"
logger.warning(msg)
return

# Check if the filename refers to a cell in the Positron Console.
# We use the fact that ipykernel sets the filename to a path starting in the root temporary
# directory. We can't determine the full filename since it depends on the cell's code which
# is unknown at this point. See ipykernel.compiler.XCachingCompiler.get_code_name.
console_dir = get_tmp_directory()
if console_dir in str(filename):
filename = "POSITRON_CONSOLE"

Expand Down

0 comments on commit 59989a3

Please sign in to comment.