-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BufferStock REMARK do_all.py crashes loading IPython shell #19
Comments
@sbenthall Are you running |
Several times I’ve had people say they can’t get the command line versions
running and it’s because they are trying python rather than ipython from
the command line.
We should add something like:
Pseudocode:
if [environment is python not ipython]:
see whether ipython is available
if so import it and print a mild warning message that the notebook
should be run from the command line via `ipython` not `python`
if ipython can't be imported, error out with a message saying
something like 'this notebook must be run using ipython; please make
ipython available on the command line and retry'
…On Thu, Oct 31, 2019 at 4:29 AM Mridul Seth ***@***.***> wrote:
@sbenthall <https://github.com/sbenthall> Are you running python do_all.py
or ipython do_all.py? These scripts are supposed to work with ipython not
the base python one.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#19?email_source=notifications&email_token=AAKCK7ZKRKJKDNOKEXDGWD3QRKJPRA5CNFSM4JF3Z4MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECW5O2I#issuecomment-548263785>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKCK74TEEJEIS63T6UH5FLQRKJPRANCNFSM4JF3Z4MA>
.
--
- Chris Carroll
|
Ah, you're right. I probably was running it with I see now that in the comments at the start of the file, it says to use This is maybe not the first place one would look. Maybe this note about using https://github.com/econ-ark/REMARK#do_py I think if it were documented, I wouldn't have made the mistake. I think I would find the message proposed by @llorracc confusing because I didn't think the |
The do.py files just run the auto generated BufferStockTheory.py file, so
if the .ipynb master tests for ipython then that will flow through to what
gets run by do_all.py.
On Thu, Oct 31, 2019 at 15:57 Sebastian Benthall ***@***.***> wrote:
Ah, you're right. I probably was running it with python, to ipython.
I see now that in the comments at the start of the file, it says to use
ipython.
This is maybe not the first place one would look. Maybe this note about
using ipython could go in the README section about the do_all.py scripts.
https://github.com/econ-ark/REMARK#do_py
I think if it were documented, I wouldn't have made the mistake.
I think I would find the message proposed by @llorracc
<https://github.com/llorracc> confusing because I didn't think the
do_[].py scripts were notebooks. Is this do_[].py construct specific to
REMARK as a coding pattern?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19?email_source=notifications&email_token=AAKCK73K35F7A6H27L2DG6LQRM2DBA5CNFSM4JF3Z4MKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECZBZWI#issuecomment-548543705>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKCK76SNWS656WA6MYIUMLQRM2DBANCNFSM4JF3Z4MA>
.
--
Sent from Gmail Mobile
|
Ok. I see now that there are a few interwoven issues here.
I wonder if it would be possible to be more thoughtful about how these do_[].py scripts are designed, how that design is enforced when a new REMARK is included in this repository as a submodule, and whether any of the code necessary for complying with those design requirements could be in one place in the REMARK repository, rather than duplicated across every REMARK submodule. |
The solution for this is probably to add something in the first line of the Jupyter notebook that tests whether it is being run using ipython. When the [notebook].py jupytext file is autogenerated, if someone runs it using |
This code will suffice for warning the user if they run a file in
|
I just started to implement this in the BufferStockTheory REMARK, but noticed that the setup cell already contains: from IPython import get_ipython # In case it was run from python instead of ipython which should already be sufficient. (It will presumably halt with an error if ipython is not present). So, could you go back and look again to see if you can figure out what was causing your earlier problems? It sounds like you've fixed it now, but it couldn't have been only the fact of running from the command line... |
Ok, I'm looking into this again. Currently, there are two Both of them now give me this error (I get a similar error whether running in IPython or Python):
I believe this is because:
I'd recommend either:
My preferences is for (1) over (2). I think (3) would be good in any case. |
Closing because issues above are (mostly) resolved. |
Running this
do_all.py
from the command line:https://github.com/llorracc/BufferStockTheory/blob/5ccb22b72cb9fd46245b8954459ce5f44ab3c7ea/Code/Python/do_all.py
gets me the following error in the terminal:
This looks like it's because the
get_ipython()
method returns None when no InteractiveShell instance is registered:https://ipython.readthedocs.io/en/stable/api/generated/IPython.core.getipython.html
(Please let me know if these issues are better tracked to the
BufferStockTheory
repo inllorracc
.)The text was updated successfully, but these errors were encountered: