Cannot import .py file to ipython notebook -


I'm already sorry for the

"I can not get it to work": I have a How do I load? .py file in IPIthon notebook? I want to convert the Python code to Notebook (simple script and later scripts in which nbconvert instructions - see below the included file).

Maybe I'm doing it wrong, but maybe something is wrong with my set-up. When I drag the .py file to the notebook's file list, I get the message

Invalid file type: Uploaded notebook to .ipynb < / Code should be> files.

I have also tried to change the extension on .ipynb (keeping the dragon script unencrypted); To a great extent, I found an error:

Error loading notebook: Bad request

What is wrong with anybody?

System Info: I'm on OS X (10.8, Mountain Lion), using Firefox 28.0 and Anaconda 1.9.2 (x86_64), which provides Python 2.7.6 and iPython 2.0. Anaconda is not on the default path; I add it to a bash session from which I again launch the notebook with ipython notebook , and I usually open and edit the .ipynb files in the browser. I'm able.

But I find some inquisitive behavior: While exporting from notebook as a .py file, I do not get documented control comments , But a simple format, without the version number:

  # coding: UTF-8 # [in:] Print "This is a slide" ## Top-level headline ### Second-level Title ## ## Third-level title # This is some `MarkDown` text # # and some more here   

Any ideas that are happening here?

The same format is generated by ipython nbconvert . However, if I start the notebook server with the ipython notebook --script (which saves every time it is saved then the Python exports to the notebook as a script), the result will be Nbconvert instructions we need to convert back to a notebook!

I had the same problem with the help of this post:

Actually, We have to use the following command in the cell. And the .py file should be in the same directory.

 % load filename.py    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -