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
Using nbstata for my normal work a few times has turned up a few further quirks of pystata.stata.run.
By the way, nbstata's getting pretty complicated due to my stubborn insistence on the "noecho" mode, so it's really nice that pystata_kernel also exists, as a simpler kernel that passes each code cell pretty directly to pystata.stata.run. (Actually, if I were you, I would remove the echo=None config option to better keep things simple.) That way, if something unexpected happens, the user can at least trace the issue directly back to the behavior of pystata.stata.run.
Single- vs. multi-line code cells
Single-line input (to pystata.stata.run, and thus to pystata_kernel) is processed like Stata's interactive mode, whereas multi-line code is processed via running a do-file. This has a number of implications (beyond echo) that may be surprising to the unsuspecting user of pystata_kernel unless they read the fine print in the pystata docs linked above:
Inline comments (// or /* ... */) work in multi-line code but trigger an error in single-line code.
#delimit ; works in a multi-line code cell (only for that one cell--and I'd now suggest keeping it that way for pystata_kernel) but placing `#delimit ;' in a single-line cell will cause an error.
More than one graph command in a cell will only result in one graph being displayed unless you give the additional graphs unique names. (This is only noted in the pystata docs for the %stata magic.)
edit: Contrary to my original assertions, there are no single- vs. multi-line issues with locals or the version command (and maybe no issues not already flagged somewhere in the pystata docs). The issues I was having with those turned out to only apply to the "noecho" mode which runs multi-line code as a program. (If you maintain that mode in pystata-kernel (contrary to my recommendation above), you may want to address those issues, though, perhaps just by acknowledging them in the README, for starters.)
The text was updated successfully, but these errors were encountered:
The 'noecho' mode is off by default, and stripping it out completely seems a bit excessive. Perhaps I can just add a note saying that this feature is incomplete?
Right, definitely. Maybe "experimental" is what I should have called it all along.
Sorry, rereading my post, it sounds more demanding than I was intending. My intention is just to be helpful in an informative way. It's no big deal either way. :)
Uh oh!
There was an error while loading. Please reload this page.
Continuing the discussion from #16:
Preface
Using
nbstata
for my normal work a few times has turned up a few further quirks ofpystata.stata.run
.By the way, nbstata's getting pretty complicated due to my stubborn insistence on the "noecho" mode, so it's really nice that
pystata_kernel
also exists, as a simpler kernel that passes each code cell pretty directly topystata.stata.run
. (Actually, if I were you, I would remove theecho=None
config option to better keep things simple.) That way, if something unexpected happens, the user can at least trace the issue directly back to the behavior ofpystata.stata.run
.Single- vs. multi-line code cells
Single-line input (to pystata.stata.run, and thus to
pystata_kernel
) is processed like Stata's interactive mode, whereas multi-line code is processed via running a do-file. This has a number of implications (beyond echo) that may be surprising to the unsuspecting user ofpystata_kernel
unless they read the fine print in thepystata
docs linked above://
or/* ... */
) work in multi-line code but trigger an error in single-line code.#delimit ;
works in a multi-line code cell (only for that one cell--and I'd now suggest keeping it that way forpystata_kernel
) but placing `#delimit ;' in a single-line cell will cause an error.pystata
docs for the %stata magic.)edit: Contrary to my original assertions, there are no single- vs. multi-line issues with locals or the
version
command (and maybe no issues not already flagged somewhere in thepystata
docs). The issues I was having with those turned out to only apply to the "noecho" mode which runs multi-line code as a program. (If you maintain that mode inpystata-kernel
(contrary to my recommendation above), you may want to address those issues, though, perhaps just by acknowledging them in the README, for starters.)The text was updated successfully, but these errors were encountered: