Skip to content

Commit 136403b

Browse files
committed
This avoids parsing the wrong file to display the error.
Py_CompileString(..., ..., Py_file_input) parses the file to display the traceback error. I don't know why if it cannot get the file, then it uses the inline script import. Thus, it is displaying the wrong traceback, because it is parsing the wrong file. To avoid that, I set the file name to <In [1]>, so when executing codes in Jupyter, it is displaying the error correctly.
1 parent 211a97c commit 136403b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libyt_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ nl::json LibytKernel::execute_request_impl(int execution_counter, const std::str
6868
bool store_history, nl::json user_expressions, bool allow_stdin) {
6969
SET_TIMER(__PRETTY_FUNCTION__);
7070

71-
std::string cell_name = std::string("In [") + std::to_string(execution_counter) + std::string("]");
71+
std::string cell_name = std::string("<In [") + std::to_string(execution_counter) + std::string("]>");
7272

7373
// Find if '%' is the first non-space character, if so, redirect jobs to define command
7474
std::size_t found = code.find_first_not_of("\t\n\v\f\r ");

0 commit comments

Comments
 (0)