-
Notifications
You must be signed in to change notification settings - Fork 561
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
Export to .py should add 'import's #54
Comments
There is no hidden import in notebook, nor in terminal. Do you have a custom config ? (the ipython/nbconvert is indeed legacy code with have for historical reasons) |
Hi Matthias! Thanks for your response.
import cProfile
import datetime
from functools import reduce
import itertools
import math
import pstats, io
from subprocess import check_output, call
import sys
import time
import warnings
import cairocffi
The first 10 or so are definitely core python packages (I admit that Thanks, Inon Sharony Quoting Matthias Bussonnier notifications@github.com:
|
Well, no, none of the above packages are imported implicitely by default. you import them by doing Magics are non python syntax, so no magic will ever be valid in Python script.
It does not really help you though as most of the magic need access to a ipython shell to work, but can at least make the syntax valid. Feel free to continue asking if you have more questions, |
|
Here is (roughly) what
The problem with writing loud and clear what not to do, is that people will not remember why it's wrong and what the issues are, they will just remember they can do it. |
The .ipnb to .py translation works wonderfully, except that some imports are taken for granted when working in an IPython notebook. For the exported .py script to work properly, the packages and modules used should be explicitly 'imported' at the top of the .py file.
I'm pretty sure this issue has to do with Jupyter more than IPython, seeing that nbconvert under the IPython repo has been inactive for a couple of years
The text was updated successfully, but these errors were encountered: