ticoneva / pystata-kernel

Jupyter kernel for Stata based on pystata
GNU General Public License v3.0
13 stars 6 forks source link

Error handling: program temp_pystata_kernel_program_name already defined #24

Closed gaksaray closed 1 year ago

gaksaray commented 1 year ago

Running a cell with an error twice throws the error instead of the original error:

program temp_pystata_kernel_program_name already defined
r(110);

To demonstrate, say I want to create a table:

Screen Shot 2023-03-24 at 10 08 23 PM

Here I intentionally specified delimiter option incorrectly, which produces the error as expected. Then I ran the cell again. This time it produces a different (incomprehensible to end user) error:

Screen Shot 2023-03-24 at 10 08 35 PM

In fact, if I force delete that "program", it reverts back to the original Stata error:

Screen Shot 2023-03-24 at 10 09 14 PM

Expected behavior is that it produces the same error r(198) as before.

hugetim commented 1 year ago

For "echo = None" mode, nbstata is more robust in this and other ways. Compare: https://github.com/ticoneva/pystata-kernel/blob/main/pystata-kernel/helpers.py#L158 and https://github.com/hugetim/nbstata/blob/master/nbstata/stata_more.py#L90

ticoneva commented 1 year ago

Fixed in the version 0.3.1.