These are chat archives for ipython/ipython

5th
Jan 2015
Jonathan Frederic
@jdfreder
Jan 05 2015 18:51
@twiecki be careful with that widget, the password is synchronized with the backend using unencrypted json messages. I wouldn't use it for anything serious...
Min RK
@minrk
Jan 05 2015 18:54
@jdfreder @twiecki as with most webpages, it's a good idea to avoid entering a password on any page that's not served via ssl.
Jonathan Frederic
@jdfreder
Jan 05 2015 18:54
IIRC the use case was very specific- someone who was running their notebook locally on a firewalled machine wanted to be able to give presentations without the crowd seeing what they typed into the textbox.
Min RK
@minrk
Jan 05 2015 18:56
ah, ok
I guess the exception is extended a bit further: don't enter passwords on pages unless SSL or localhost on a non-shared machine.
But it's the same as entering a password in an HTML form.
Matthias Bussonnier
@Carreau
Jan 05 2015 19:10
Yeahhh! Us embassy said I should recieve my visa in a few days. Was not that hard.
Min RK
@minrk
Jan 05 2015 19:11
nice
Matthias Bussonnier
@Carreau
Jan 05 2015 19:11
Need to find a place to stay now :-P
Min RK
@minrk
Jan 05 2015 19:11
ha
that would be ideal
<nothing to see here>
Matthias Bussonnier
@Carreau
Jan 05 2015 19:11
under a bridge does not count :-)
Min RK
@minrk
Jan 05 2015 19:11
When are you arriving?
Jessica B. Hamrick
@jhamrick
Jan 05 2015 19:12
Woohoo, congrats @Carreau
Matthias Bussonnier
@Carreau
Jan 05 2015 19:12
I don't have a plane ticket yet, I wasn't sure on how long would my visa take to arrive.
I shoudl be there by end of january I guess.
officialy on my contract I have to .
question is now, undertand the Berkley Housing website.
Min RK
@minrk
Jan 05 2015 19:13
if there's some snag, we can get a telepresence robot and pretend it's you.
Matthias Bussonnier
@Carreau
Jan 05 2015 19:14
:-P
@takluyver was the last to arrive IIRC. How did he got a place to stay ?
Min RK
@minrk
Jan 05 2015 19:15
I'm not sure.
Jonathan Frederic
@jdfreder
Jan 05 2015 19:15
@Carreau padmapper, craigslist, and zillow are all good tools to look for rentals.
Jessica B. Hamrick
@jhamrick
Jan 05 2015 19:15
Yeah, I’ve successfully found places on both padmapper and craigslist
Matthias Bussonnier
@Carreau
Jan 05 2015 19:15
I tried craiglist, but it's full of slang, it took me half an hour to figure out what 1br and 2 br means.
I guess seem obvious to native english :-P
Jessica B. Hamrick
@jhamrick
Jan 05 2015 19:16
There’s a lot of junk on craiglist but if you’re patient and look at it a lot you’ll start to be able to tell what is good and what isn't
Jonathan Frederic
@jdfreder
Jan 05 2015 19:17
@Carreau just be careful, things that look too good to be true are too good to be true.
Matthias Bussonnier
@Carreau
Jan 05 2015 19:17
no kidding !
Jessica B. Hamrick
@jhamrick
Jan 05 2015 19:17
Truth
Matthias Bussonnier
@Carreau
Jan 05 2015 19:18
I also have the small issues that I need to convert ft2 to m2 ...
Jonathan Frederic
@jdfreder
Jan 05 2015 19:18
LOL
Matthias Bussonnier
@Carreau
Jan 05 2015 19:18
and $ to €
Jessica B. Hamrick
@jhamrick
Jan 05 2015 19:18
Though things that are almost too good to be true might still be true :)
Jonathan Frederic
@jdfreder
Jan 05 2015 19:18
Are we going to pay you in €?
;)
Matthias Bussonnier
@Carreau
Jan 05 2015 19:18
No, but to get a feeling of wether it's worth or not.
like if I told you a mac Book Pro is 900€ true or false?
Min RK
@minrk
Jan 05 2015 19:19
Use the Physicist Rounding System: 10ft2=1m2
Jonathan Frederic
@jdfreder
Jan 05 2015 19:20
@minrk I like that :D
Min RK
@minrk
Jan 05 2015 19:20
also, π2=10
lots of things are equal to 10 if you squint hard enough
Matthias Bussonnier
@Carreau
Jan 05 2015 19:21
yeah, I'll try.
Jonathan Frederic
@jdfreder
Jan 05 2015 19:21
@Carreau that's one of the nice things about Zillow, it tells you when something is above or below the mean value for the area.
But I think there are less rentals on Zillow than the other two. Zillow is more useful for home buyers (I think).
Matthias Bussonnier
@Carreau
Jan 05 2015 19:23
anyway, I'll search, but if any of you see interesting things (I guess @jdfreder is a bit far) please tell me :-)
Jonathan Frederic
@jdfreder
Jan 05 2015 19:24
haha yes, you would not want to commute ~3.5 hours to work one way :)
Thomas Kluyver
@takluyver
Jan 05 2015 19:40
@Carreau there's a postdocnet mailing list which lots of people use to request and offer accommodation. I sent one email and had five offers, including one to live on a boat in Berkeley Marina. That's how I found my place. https://calmail.berkeley.edu/manage/list/listinfo/postdocnet@lists.berkeley.edu
Kyle Kelley
@rgbkrk
Jan 05 2015 19:41
You live on a boat?
That's awesome
;)
Thomas Kluyver
@takluyver
Jan 05 2015 19:42
I considered it, but I went with something more conventional
apart from the normal practical concerns, I wasn't sure if US immigration would accept it as my address in the US
Matthias Bussonnier
@Carreau
Jan 05 2015 19:42
Ok, great, I'll do that ! Thanks.
Thomas Kluyver
@takluyver
Jan 05 2015 19:43
but I did seriously consider it ;-)
no worries
Matthias Bussonnier
@Carreau
Jan 05 2015 19:43
I'll just stop looking for today, it stresses me too much.
Thomas Kluyver
@takluyver
Jan 05 2015 19:43
yeah, I hate house hunting
Jonathan Frederic
@jdfreder
Jan 05 2015 19:43
Moving is a PITA
Kyle Kelley
@rgbkrk
Jan 05 2015 19:43
Man, I'd live on a boat. That would be awesome
I would be tempted to set sail though
Thomas Kluyver
@takluyver
Jan 05 2015 19:44
for price reference: I pay $750 per month for a room in a small house with a live in landlady. From what I've seen, that's around the low end of the price range.
Kyle Kelley
@rgbkrk
Jan 05 2015 19:44
That sounds pretty low for that area
Thomas Kluyver
@takluyver
Jan 05 2015 19:44
@rgbkrk sailing was part of the deal. He even offered to teach me to sail if I needed, which I don't
Kyle Kelley
@rgbkrk
Jan 05 2015 19:45
what
aw man
Jonathan Frederic
@jdfreder
Jan 05 2015 19:45
That's almost the same br/price ratio I pay in SLO.
@takluyver
Kyle Kelley
@rgbkrk
Jan 05 2015 19:46
I wish I was young and naive instead of just naive.
Matthias Bussonnier
@Carreau
Jan 05 2015 19:46
:-p
But you are rich.
Kyle Kelley
@rgbkrk
Jan 05 2015 19:46
Ok, kidless so I could live on a boat.
LOL
Jonathan Frederic
@jdfreder
Jan 05 2015 19:46
Don't be hard on yourself, you're not that old!
But you are kidfull
(opposite of kidless)
Matthias Bussonnier
@Carreau
Jan 05 2015 19:49
Ok, I'll cut internet and forgot about flat renting for today, Or I won't sleep.
CU later.
Jonathan Frederic
@jdfreder
Jan 05 2015 19:51
ttyl
Doug Blank
@dsblank
Jan 05 2015 20:37
Is there an easy way to install a system-wide notebook javascript extension?
Jonathan Frederic
@jdfreder
Jan 05 2015 20:42
I've been piggy backing my JS extensions on Python, and relying on Python package managers. I'm not sure that's still the best way to do it, I think @takluyver or @minrk would know.
IOW:
The Python package has a load_js method which using the display system to push the JS to the page.
Andreas Klostermann
@akloster
Jan 05 2015 20:44
is there a good way to download the ipython master branch without cloning it? I'm trying to build useful docker containers, and when I download the master.zip from github, it doesn't include submodules...
and I'd like to avoid the cloning process because it takes forever...
@jdfreder I'm preferring the same thing.
Jonathan Frederic
@jdfreder
Jan 05 2015 20:46
Not that I'm aware of, again one of the others may know of a way.
A quick poke around the net leads me to believe there isn't a quick solution: http://stackoverflow.com/a/12950790/2824256
@akloster
Andreas Klostermann
@akloster
Jan 05 2015 20:49
I'm still finding my way around what to actually do with docker, but currently I'd like to make a jupyter service which can start python2, python3 and possibly R and Julia kernels from the same interface
a big challenge with the docker+python combination for me is that the easiest way to install stuff (even if just on top of anaconda) is pip requirements. And if you aren't very very careful, any change in the Dockerfile or Environment may trigger a full reinstall.
Andreas Klostermann
@akloster
Jan 05 2015 20:58
by the way, how do I specify additional kernels?
Andreas Klostermann
@akloster
Jan 05 2015 21:12
in older versions you would have to start from a different profile, but the current master version has a "new" button which somehow leaves me thinking there could be more than one kernel per Profile
Min RK
@minrk
Jan 05 2015 21:24
@akloster Kernels are not associated with profiles in IPython 3
kernelspecs are directories containing information about how to start a kernel. These can be installed in /usr/share/jupyter/kernels or ~/.ipython/kernels
Andreas Klostermann
@akloster
Jan 05 2015 21:24
@minrk good to hear
Min RK
@minrk
Jan 05 2015 21:25
You can see the R kernel for an example
Andreas Klostermann
@akloster
Jan 05 2015 21:26
@minrk, thanks
Min RK
@minrk
Jan 05 2015 21:26
Mainly it's a json file with an argv that tells how to spawn the kernel. There are other bits of information, but that's the most important.
Andreas Klostermann
@akloster
Jan 05 2015 21:27
@minrk, I think I see... the R kernel wants to add that to the command line ... is there a nicer way?
Min RK
@minrk
Jan 05 2015 21:27
@akloster what do you mean?
Andreas Klostermann
@akloster
Jan 05 2015 21:28
@minrk where do I put the json file?
Min RK
@minrk
Jan 05 2015 21:28
In /usr/share/jupyter/kernels/ir/kernel.json
Andreas Klostermann
@akloster
Jan 05 2015 21:29
@minrk I see, thank you
just to clarify: Does that mean I can put multiple kernels there?
Min RK
@minrk
Jan 05 2015 21:30
a kenrnelspec is a directory that should be placed in one of the two kernels directories I mentioned above
You can have as many kernels as you want.
Andreas Klostermann
@akloster
Jan 05 2015 21:30
ok, thanks
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:32
@akloster in regards to your "every change causing a pip install": check the explanation in the best practices doc
tl; dr:
```dockerfile
oops.... getting too fancy with the markdown...
ADD requirements.txt /tmp/
pip install -r /tmp/requirements.txt
...
ADD . /srv/app
Andreas Klostermann
@akloster
Jan 05 2015 21:34
I think the reinstalls I triggered where unavoidable, because I mucked around with the environment of the app
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:34
turns out you may actually want your ADD . as late as possible
Andreas Klostermann
@akloster
Jan 05 2015 21:34
I mean the "develop the development environment" iterations that where a bit painful, but manageable
I'm also now using miniconda, so that's less stressful too
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:37
oh? does it have a smaller build platform?
Doug Blank
@dsblank
Jan 05 2015 21:37
@takluyver @minrk: @jdfreder said: "I've been piggy backing my JS extensions on Python, and relying on Python package managers. I'm not sure that's still the best way to do it, I think @takluyver or @minrk would know.
IOW:
The Python package has a load_js method which using the display system to push the JS to the page." ... but I don't understand... do you know what he is referring, or is there a better way?
Andreas Klostermann
@akloster
Jan 05 2015 21:37
no, it doesn't build at all
it's a very smart distribution/package manager for python binary packages
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:38
cool. seems like a good fit, if the things you want are in conda...
Andreas Klostermann
@akloster
Jan 05 2015 21:39
some are, some are not. The conda environment let's you use pip, too
Kyle Kelley
@rgbkrk
Jan 05 2015 21:39
Yeah
If you conda install pip you can work in the same conda environment
I wouldn't want to use conda for my deployments
but its handy for user images
Andreas Klostermann
@akloster
Jan 05 2015 21:40
continuum uses conda for everything
Min RK
@minrk
Jan 05 2015 21:40
@dsblank he means putting js on the page with a display call that adds a javascript output
Min RK
@minrk
Jan 05 2015 21:41
rather than installing into nbextensions and loading with require, which requires js configuration
Andreas Klostermann
@akloster
Jan 05 2015 21:41
sorry for the video ....
anyway it is worth watching
Kyle Kelley
@rgbkrk
Jan 05 2015 21:41
I just switched cloudpipe's default image to use miniconda
which is one command away from a full anaconda
Min RK
@minrk
Jan 05 2015 21:42
miniconda is my default Python
Doug Blank
@dsblank
Jan 05 2015 21:42
@minrk So, there isn't a way to, say, install the spell-checker system wide?
Andreas Klostermann
@akloster
Jan 05 2015 21:42
maybe anaconda even tries to eat crocodiles
Min RK
@minrk
Jan 05 2015 21:42
@dsblank there should be, I'm trying to remember if we've implemented that or not. We added /usr/share/jupyter/kernels, and there should be /usr/share/jupyter/nbextensions next to it. I don't think we've added support for it, yet.
Kyle Kelley
@rgbkrk
Jan 05 2015 21:43
lol @akloster
Doug Blank
@dsblank
Jan 05 2015 21:43
@minrk That would be very useful for controlling the student's environment on jupyterhub
Andreas Klostermann
@akloster
Jan 05 2015 21:44
I would recommend making the kernel directory configurable, because in my new setup for example, this /usr/share stuff just doesn't really make sense
but I don't know if there are good reasons for hardcoding the paths
Doug Blank
@dsblank
Jan 05 2015 21:45
@minrk It is a real pain to try to walk new students into installing something like the js spelling checker. It is almost easier to do it as root, and manage their custom.js for them
Andreas Klostermann
@akloster
Jan 05 2015 21:45
also the anaconda distribution might have trouble with IPython 3 because they want to be installable without privileges.... /usr/share/ is usually not user-writeable
Min RK
@minrk
Jan 05 2015 21:45
I'll look into it, should just take a sec
It looks in sys.prefix also, /usr/local is shorthand
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:46
the cleanest (for me) solution i have found for always loading some JS is to hack the templates
Doug Blank
@dsblank
Jan 05 2015 21:47
@bollwyvl Can you point me to an example?
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:47
think i posted one to list... looking....
Andreas Klostermann
@akloster
Jan 05 2015 21:47
@minrk I was looking at the source and I thought it was hardcoded, but I may be missing some transformation there
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:48
@dsblank here it is
Doug Blank
@dsblank
Jan 05 2015 21:50
@bollwyvl Thanks... that might work!
Nicholas Bollweg
@bollwyvl
Jan 05 2015 21:51
might be even cleaner now with #7083...
though i think template_path is one of the things you can't hack after initialize
Doug Blank
@dsblank
Jan 05 2015 21:54
@bollwyvl I see.
Jonathan Frederic
@jdfreder
Jan 05 2015 22:07

@dsblank sorry someone walked into my lab, yes like @minrk said I was talking about using display(javascript(... to push the contents to the page on request. Loading the JS extension is then done via Python, for example:

import myjs
myjs.load_js()

The downside to this approach is that this cell or something similar needs to exist at the top of the notebook.

Andreas Klostermann
@akloster
Jan 05 2015 22:07
@dsblank no, it doesn't
Jonathan Frederic
@jdfreder
Jan 05 2015 22:08
- for that reason it probably won't help much with the confusion in a classroom environment...
Andreas Klostermann
@akloster
Jan 05 2015 22:08
but yes, most of the time that is necessary
Doug Blank
@dsblank
Jan 05 2015 22:08
@jdfreder Yes, looking for something more at the system level
Andreas Klostermann
@akloster
Jan 05 2015 22:08
the additional complexity is that when you load a saved notebook with output, that javascript/css stuff gets loaded into the dom
@dsblank there is a startup directory in the profile... slightly more system level
Doug Blank
@dsblank
Jan 05 2015 22:10
@akloster Yes, and I'd rather not have to have students load JS in each notebook. Yes, the template is looking like the best solution
Jonathan Frederic
@jdfreder
Jan 05 2015 22:11
I think the /usr/share/jupyter/nbextensions idea that @minrk mentions would be even better, when it exists.
Min RK
@minrk
Jan 05 2015 22:11
Working on that now, should be easy enough
Doug Blank
@dsblank
Jan 05 2015 22:11
@jdfreder Yes, I agree.
@minrk Excellent!
Jonathan Frederic
@jdfreder
Jan 05 2015 22:12
Since with his solution you don't have to manage your own template.
@minrk awesome, excited to test it!
I'll probably dump my Python based JS loader from a couple of my IPython JS extensions :)
Doug Blank
@dsblank
Jan 05 2015 22:14
@jdfreder We do have some templates that we are editing, but we have design students working on that. Of course, there will be some teachers that will want some js, and other will want others... but we'll deal with that later
Andreas Klostermann
@akloster
Jan 05 2015 22:14
hm ... now i have python2 and python3 kernels installed in my docker container, but they won't accept commands from the notebook. Strange.
Nicholas Bollweg
@bollwyvl
Jan 05 2015 22:14
yes, would love to get out of that business (and document it in cookiecutter-ipython-widget)
Andreas Klostermann
@akloster
Jan 05 2015 22:15
bollwyvl, btw I tried to create an asset manager to manage coffeescript files some while ago: https://github.com/akloster/nb-assets
Nicholas Bollweg
@bollwyvl
Jan 05 2015 22:16
@jdfreder @minrk: wait, does the mentioned/user/share/jupyter/nbextensions provide a way to load things at startup? i still haven't seen a non-template way to do that...
Jonathan Frederic
@jdfreder
Jan 05 2015 22:17
@dsblank out of curiosity what are you building? Is this a generic tool for notebook based classrooms? Or a specific class that you are teaching? I feel like I should have heard about your project already, but I must have been absent when you announced it :( .
Doug Blank
@dsblank
Jan 05 2015 22:20
@jdfreder Well, I have lots of projects :smile: Specifically, what this is for is just to be able to have whatever nbextensions we want already installed and ready to use. We have the calico-spell-check that is very popular. But I am working on Publish and Handin buttons for student work.
Jonathan Frederic
@jdfreder
Jan 05 2015 22:20
@bollwyvl whether Python or Javascript, I think the point is that the extension would be only loaded by the Notebook.
@dsblank very cool! I think I've used calico-spell-check in the past, but I'm constantly re-imaging etc.., so extensions only exist when needed in the moment :P .
Doug Blank
@dsblank
Jan 05 2015 22:24
@jdfreder Unless you have them installed in the system nbextension folder :smile: .... then they can last forever
Min RK
@minrk
Jan 05 2015 22:24
@bollwyvl you can specify extensions to be loaded by default in custom.js or js config
Installing an extension doesn't load it by default, just like installing a Python package doesn't cause it to be imported by default when you start Python
installing and using exstensions are completely separate things
Jonathan Frederic
@jdfreder
Jan 05 2015 22:25
@dsblank well nbextensions dies too when I re-image (my machine). :) I'd be scared if it didn't.
Doug Blank
@dsblank
Jan 05 2015 22:26
@minrk Hmmm... well getting them installed is half the battle. So, we still need a system-wide config for loading them...
Min RK
@minrk
Jan 05 2015 22:26
That's already in place
Doug Blank
@dsblank
Jan 05 2015 22:27
@minrk What is in place?
Nicholas Bollweg
@bollwyvl
Jan 05 2015 22:27
@minrk right, i just looking towards #6834, or the spell-check stuff, or the workflow stuff... for which nbapp/template customization might still be the jam
Min RK
@minrk
Jan 05 2015 22:27
system-wide config in /etc/ipython
hm, I'm actually not sure it extends to js
I'm not sure it should, either
If you want total control over users, you should probably create and set their IPYTHONDIR
rather than default to $HOME/.ipython
Doug Blank
@dsblank
Jan 05 2015 22:29
@minrk But that would prevent them from having custom things, right?
Min RK
@minrk
Jan 05 2015 22:30
not necessarily
Do you want to control their config?
Nicholas Bollweg
@bollwyvl
Jan 05 2015 22:30
to put it in another perspective: how might we ever get nbextensions into nbviewer in a reasonable fashion?
Doug Blank
@dsblank
Jan 05 2015 22:31
@minrk Maybe I should take a step back and be specific: What is the best way to have all users on jupyterhub have the spell-check nbextension installed and available without them having to do anything?
Min RK
@minrk
Jan 05 2015 22:33
@dsblank right now, I would either:
  1. take control of their IPython directory (or profile)
  2. populate $HOME/.ipython with your default config at first run, and let users modify it after that
@bollwyvl I'm not sure nbextensions should work on nbviewer
few, if any of them make sense
Doug Blank
@dsblank
Jan 05 2015 22:35
@minrk You mean that we provide custom defaults for .ipython/
Min RK
@minrk
Jan 05 2015 22:35
yes
Doug Blank
@dsblank
Jan 05 2015 22:36
@minrk Ok. That involves different system skills, but sounds doable by our team
@minrk We would really like to do what @bollwyvl suggests with nbextensions for nbviewer, but we have our own nbviewer rolled into jupyterhub, so we can do whatever we want
Min RK
@minrk
Jan 05 2015 22:38
what extensions do you have that make sense on nbviewer?
Doug Blank
@dsblank
Jan 05 2015 22:38
@bollwyvl @minrk Being able to hide input via tabs; two column in/out;
@minrk We can provide some of this via custom kernelspec javascript, right? Couldn't anyone define their own kernelspec with custom js?
Min RK
@minrk
Jan 05 2015 22:41
I don't think it's a safe assumption for nbviewer html/js context to be sufficiently similar to the live notebook
@dsblank yes, any kernel can have arbitrary kernel.js
Doug Blank
@dsblank
Jan 05 2015 22:42
And that would be used in nbviewer?
Min RK
@minrk
Jan 05 2015 22:42
no
nbviewer doesn't have kernels
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:43
Hi @minrk
I am trying to pass the image object to the line but I am getting an error
Doug Blank
@dsblank
Jan 05 2015 22:44
Yes, I know that... but I was thinking custom JS would be loaded. So back to @bollwyvl 's question... we can load custom js in cells? Or just CSS?
Min RK
@minrk
Jan 05 2015 22:45
cells can load any html, so js and css
Doug Blank
@dsblank
Jan 05 2015 22:46
@mink Ok. Anyway, for our uses we have our own nbviewer-like code in jupyterhub
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:46
Here is my function code
if  self.TargetFilekepler != '':
             try:
                 if TargetFilekepler.endswith('.txt'):
                     FileToread = open(TargetFilekepler)
                     for line in FileToread.readlines():
                         TempRead += line
                 elif TargetFilekepler.endswith('.png'):
                     TempRead = Image.open(TargetFilekepler)
             except IOError as e:
                 TempRead = "Cannot open output file". format(e)
        else:
            TempRead = "File not found!!"
        return TempRead
Min RK
@minrk
Jan 05 2015 22:46
yup, and you can add whatever you want to the template
Doug Blank
@dsblank
Jan 05 2015 22:46
@mon
@minrk Right. Thanks for all the help!
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:46
And here is my magic function:
line = self.wk.readKeplerOutput(self.TargetFilePath+line)
        self.wk.removeKeplerOutputFile(self.TargetFilePath+line)
        return line
And here is my error:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-440554e57e50> in <module>()
----> 1 get_ipython().magic(u'readoutput netcdf.ArrayPlotter.png')

/Users/hamid/Desktop/ipython/IPython/core/interactiveshell.pyc in magic(self, arg_s)
   2275         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2276         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2277         return self.run_line_magic(magic_name, magic_arg_s)
   2278 
   2279     #-------------------------------------------------------------------------

/Users/hamid/Desktop/ipython/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
   2196                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2197             with self.builtin_trap:
-> 2198                 result = fn(*args,**kwargs)
   2199             return result
   2200 

<string> in readoutput(self, line)

/Users/hamid/Desktop/ipython/IPython/core/magic.pyc in <lambda>(f, *a, **k)
    191     # but it's overkill for just that one bit of state.
    192     def magic_deco(arg):
--> 193         call = lambda f, *a, **k: f(*a, **k)
    194 
    195         if callable(arg):

/Users/hamid/.ipython/profile_default/startup/KeplerMagicFunction.py in readoutput(self, line)
     20         def readoutput(self,line):
     21                 line = self.wk.readKeplerOutput(self.TargetFilePath+line)
---> 22                 self.wk.removeKeplerOutputFile(self.TargetFilePath+line)
     23                 return line
     24         @line_magic

TypeError: coercing to Unicode: need string or buffer, instance found
Would you help me figure it out?
Min RK
@minrk
Jan 05 2015 22:48
@harmonius looks like you need to investigate the API of wk.removeKeplerOutputFile
I don't know what that is
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:49
that one is simply rmoves the file It does not have anything specific in it
Min RK
@minrk
Jan 05 2015 22:49
what is the value of line after L21
what does readKeplerOutput return?
Are you expecting self.TargetFilePath+line to have the same value both of the times you use it?
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:51
It seems without the remove file it returns the same output
it sometimes returns png image and sometime txt
Nicholas Bollweg
@bollwyvl
Jan 05 2015 22:52

@minrk @dsblank so i guess the party line is still:

the notebook is what the notebook ships... if you want it to "be" something else, by definition you are using another app (i.e. subclass/template), though you are free to customize it through normal means (custom, profile)

Hamid Tavakoli
@hamidre13
Jan 05 2015 22:52
self.TargetFilePath+line yes it should has the same value
Min RK
@minrk
Jan 05 2015 22:52
@hamidre13 note that you are changing the value of line between the first and second time you use it
that may be the problem
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:53
when I pass it the text it will work as expected
Nicholas Bollweg
@bollwyvl
Jan 05 2015 22:53
@hamidre13 could it be related to this SO? perhaps line in L21 is coming back as a file handle?
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:53
but when the read output reads an image it throughs an error
Min RK
@minrk
Jan 05 2015 22:54
why are you storing the image in the line input variable?
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:54
In order to show it in the notebook?
Min RK
@minrk
Jan 05 2015 22:55
try storing it in a variable with a different name
e.g. result = self.wk.readKeplerOutput(self.TargetFilePath+line)
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:55
Then how can I display it?
Min RK
@minrk
Jan 05 2015 22:55
return result
Doug Blank
@dsblank
Jan 05 2015 22:55
@bollwyvl The options are a bit complicated... actually, you can stick whatever you want into cells (even by having a special header/footer that is added when saving/loading the notebook)....
Hamid Tavakoli
@hamidre13
Jan 05 2015 22:57
ok
Hamid Tavakoli
@hamidre13
Jan 05 2015 23:06
@minrk Thanks. I ended up using. IPython.display
I just want to make sure, if it is safe to use it in my python liberary?
Min RK
@minrk
Jan 05 2015 23:06
it is safe to use in an IPython session. Not outside IPython.
Hamid Tavakoli
@hamidre13
Jan 05 2015 23:07
Ok, then I guess I am fine since this will be the magic function for ipython
Min RK
@minrk
Jan 05 2015 23:07
yup, definitely safe to use display in a magic
Hamid Tavakoli
@hamidre13
Jan 05 2015 23:07
thanks
Min RK
@minrk
Jan 05 2015 23:12
@dsblank @bollwyvl I think there is going to be an answer for nbextensions on nbviewer at some point. It's extremely complicated, since it probably requires loading extensions from public URLs, since the extensions won't be present on the nbviewer server. And loading extensions from public URLs shouldn't be done in the live notebook for security reasons.
Nicholas Bollweg
@bollwyvl
Jan 05 2015 23:15
sure: raises the point anyway of nbviewer having CDN-first, then local-fallback
in the nearterm, you can push whatever the heck you want with display()
Min RK
@minrk
Jan 05 2015 23:41
Yup. It's a bit of a hack, but it lets people get the functionality they need while we take our time figuring out the 'right' way to do it