These are chat archives for ipython/ipython

31st
Oct 2014
Fernando Perez
@fperez
Oct 31 2014 01:01
hey @takluyver, did something break in terminado?
Thomas Kluyver
@takluyver
Oct 31 2014 01:03
I don't think so, but Jess and I both had some trouble with it this morning
what are you seeing?
Fernando Perez
@fperez
Oct 31 2014 01:03
[E 141030 18:02:23 websocket:306] Uncaught exception in /terminals/websocket/1
Traceback (most recent call last):
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/websocket.py";, line 303, in wrapper
return callback(args, **kwargs)
File "/home/fperez/usr/lib/python2.7/site-packages/IPython/html/terminal/handlers.py", line 39, in open
self.get(
self.open_args, self.open_kwargs)
File "/home/fperez/usr/lib/python2.7/site-packages/IPython/html/terminal/handlers.py", line 28, in get
if not self.get_current_user():
File "/home/fperez/usr/lib/python2.7/site-packages/IPython/html/base/handlers.py", line 70, in get_current_user
self.clear_login_cookie()
File "/home/fperez/usr/lib/python2.7/site-packages/IPython/html/base/handlers.py", line 61, in clear_login_cookie
self.clear_cookie(self.cookie_name)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/web.py";, line 443, in clear_cookie
domain=domain)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/websocket.py";, line 268, in _not_supported
raise Exception("Method not supported for Web Sockets")
Exception: Method not supported for Web Sockets
[E 141030 18:02:23 iostream:344] Uncaught exception, closing connection.
Traceback (most recent call last):
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/iostream.py";, line 341, in wrapper
callback(args)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 302, in wrapped
ret = fn(
args,
kwargs)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/httpserver.py";, line 217, in _on_connection_close
callback()
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 302, in wrapped
ret = fn(args, **kwargs)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/websocket.py";, line 274, in on_connection_close
self.on_close()
File "/home/fperez/.local/lib/python2.7/site-packages/terminado/websocket.py", line 124, in on_close
self.terminal.clients.remove(self)
AttributeError: 'TermSocket' object has no attribute 'terminal'
[E 141030 18:02:23 ioloop:472] Exception in callback <functools.partial object at 0x7f3449ef4838>
Traceback (most recent call last):
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/ioloop.py";, line 458, in _run_callback
callback()
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 302, in wrapped
ret = fn(
args, kwargs)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/iostream.py";, line 341, in wrapper
callback(args)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/stack_context.py", line 302, in wrapped
ret = fn(
args,
kwargs)
File "/home/fperez/usr/opt/lib/python2.7/site-packages/tornado-3.1.1-py2.7.egg/tornado/httpserver.py";, line 217, in _on_connection_close
callback()
File "/home/fperez/usr/opt/lib/python2.7/site-p
I'm running master ipython and master terminado, and trying to open a terminal breaks
wanted to give a demo in ~ 30 minutes :)
Thomas Kluyver
@takluyver
Oct 31 2014 01:04
it didn't get the end of that traceback, try gisting it
Jessica B. Hamrick
@jhamrick
Oct 31 2014 01:05
I think this is the same error I had earlier — I was on tornado 3 as well, upgrading to tornado 4 fixed it for me
Fernando Perez
@fperez
Oct 31 2014 01:06
ah!
ok, then we should add that check in there somewhere.
thx.
will try now
jess, are you here at codeneuro?
Jessica B. Hamrick
@jhamrick
Oct 31 2014 01:07
No, I am unfortunately busy working on a take-home final
Fernando Perez
@fperez
Oct 31 2014 01:07
nope, same error
ah!
have fun with your exam :)
Thomas Kluyver
@takluyver
Oct 31 2014 01:08
Can you stick the traceback in a gist so I can see the end of it?
Fernando Perez
@fperez
Oct 31 2014 01:10
ok, got it
it was indeed the tornado update, I got tricked by a stale copy.
tornado 4 is now a dep.
let's add a check for that.
thx!!
@jhamrick, thanks a ton. CodeNeuro says hi :)
Jessica B. Hamrick
@jhamrick
Oct 31 2014 01:10
No problem! Hope the demo goes well!
Thomas Kluyver
@takluyver
Oct 31 2014 01:11
we wish we could make tornado 4 a dep, unfortunately Phantom doesn't like it
they disagree about Websocket protocols
Fernando Perez
@fperez
Oct 31 2014 01:13
well, then we have a problem. Since t3 doesn't work with the terminal!
or we need to fix the t3 behaivor...
Thomas Kluyver
@takluyver
Oct 31 2014 01:15
yep, we will fix one thing or the other
Fernando Perez
@fperez
Oct 31 2014 01:17
txh
Jason Grout
@jasongrout
Oct 31 2014 15:30
@jdfreder: I'm reviewing your promises PR. Are you around?
Jonathan Frederic
@jdfreder
Oct 31 2014 15:47
Hi @jasongrout yeah I'm here
@jasongrout +1 to your idea of always storing a promise
Jason Grout
@jasongrout
Oct 31 2014 16:02
@jdfreder: pr to your pr coming up
the code is much simpler if you really take advantage of promises
Jonathan Frederic
@jdfreder
Oct 31 2014 16:03
ok
I won't make any changes
I did just address you comments
Jason Grout
@jasongrout
Oct 31 2014 16:03
I did as well
Jonathan Frederic
@jdfreder
Oct 31 2014 16:03
oh ok
Jason Grout
@jasongrout
Oct 31 2014 16:03
sorry, another race condition...
Jonathan Frederic
@jdfreder
Oct 31 2014 16:03
I can pop that commit
one sec
I'll rebase -i
to remove it
ok
it's removed
Jason Grout
@jasongrout
Oct 31 2014 16:05
basically, calling .then() creates a new promise.
so there's no need to explicitly create a new promise
Jonathan Frederic
@jdfreder
Oct 31 2014 16:06
Interesting, I wasn't aware of that
look forward to seeing the PR
Jason Grout
@jasongrout
Oct 31 2014 16:07
try it in Chrome. It's really very nice
Jason Grout
@jasongrout
Oct 31 2014 16:14
@jdfreder: jdfreder/ipython#22
I'll be back soon, if you have any questions.
Jonathan Frederic
@jdfreder
Oct 31 2014 16:16
ok thanks
Jonathan Frederic
@jdfreder
Oct 31 2014 16:41
@jasongrout unfortunately it looks like I can't just pass around console.error like a normal function handle :(
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); }, function(err) { console.error(err); });
yes VM380:3
undefined
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); }, console.error);
undefined
Jason Grout
@jasongrout
Oct 31 2014 17:06
huh?
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); }, function(msg) {console.error(msg);});
Jason Grout
@jasongrout
Oct 31 2014 17:14
You have to use proxies. Apparently the then functions are called with in the Window context by default
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then($.proxy(console.log,console), $.proxy(console.error,console));
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then($.proxy(console.log,console), $.proxy(console.error,console));
(I guess that makes sense; they are just invoked as normal functions)
Jonathan Frederic
@jdfreder
Oct 31 2014 17:15
yeah I guess it does
Jason Grout
@jasongrout
Oct 31 2014 17:44
@jdfreder: are you working more on the promises? I didn't address any of your changes in widget_box
Jonathan Frederic
@jdfreder
Oct 31 2014 18:01
@jasongrout I just pushed the console.error proxy
other than that, no I haven't worked on it sense
since*
Do you want me to wait to merge your PR?
Jason Grout
@jasongrout
Oct 31 2014 18:08
@jdfreder - your set_state also has some issues
basically, Promise.all returns a promise, it doesn't block
Jonathan Frederic
@jdfreder
Oct 31 2014 18:08
because it's delayed?
Jason Grout
@jasongrout
Oct 31 2014 18:08
so set_state will return immediately, but the object state may not be updated for some time
so set_state needs to return a promise, and whoever calls set_state needs to do a .then()
Jonathan Frederic
@jdfreder
Oct 31 2014 18:09
makes sense
well
I think there's still a problem
Jason Grout
@jasongrout
Oct 31 2014 18:09
who calls set_state?
Jonathan Frederic
@jdfreder
Oct 31 2014 18:10
because the states may get set out of sync
Jason Grout
@jasongrout
Oct 31 2014 18:10
oh, I see, it's the _handle_comm_message
Jonathan Frederic
@jdfreder
Oct 31 2014 18:10
so really I think we can't set_state till the last has finished
Jason Grout
@jasongrout
Oct 31 2014 18:10
?
I wish we had a collaborative editing tool, like SageMathCloud, where we could look at the code together :)
Jonathan Frederic
@jdfreder
Oct 31 2014 18:11
so if states 1 & 2 are sent
in order
Jason Grout
@jasongrout
Oct 31 2014 18:11
state 2 may be fulfilled before state 1
Jonathan Frederic
@jdfreder
Oct 31 2014 18:11
and state 1 is delayed because it has some requirejs models
exactly
so
Jason Grout
@jasongrout
Oct 31 2014 18:11
yeah, so maybe we need to maintain a history of states
and every state change does a .then()
Jonathan Frederic
@jdfreder
Oct 31 2014 18:11
yes
just stored a single promise
Jason Grout
@jasongrout
Oct 31 2014 18:11
right, and update it as new states come in
Jonathan Frederic
@jdfreder
Oct 31 2014 18:12
yes
shouldn't be too ugly
Jason Grout
@jasongrout
Oct 31 2014 18:12
var state = state.then(new state change)
yes, that sounds good
Jonathan Frederic
@jdfreder
Oct 31 2014 18:12
that way we don't have to worry about set_state being async
Jason Grout
@jasongrout
Oct 31 2014 18:12
right
how about you change that part of the _handle_comm_message, while I'm working on the set_state function
(we should really set up a SMC project for the two of us, so we can just edit code simultaneously)
or even better, IPython should have collaborative editing :)
Jonathan Frederic
@jdfreder
Oct 31 2014 18:14
yes! :)
what does SMC stand for?
Jason Grout
@jasongrout
Oct 31 2014 18:14
but simultaneous editing on SMC works right now. I worked with my students on it. SMC = sage math cloud
Jonathan Frederic
@jdfreder
Oct 31 2014 18:14
ahhh
Jonathan Frederic
@jdfreder
Oct 31 2014 18:15
I've never seen it abbreviated like that
Jason Grout
@jasongrout
Oct 31 2014 18:16
it's SMC all the time now on the sage lists
Jonathan Frederic
@jdfreder
Oct 31 2014 18:19
@jasongrout ping me when you get that(those) commit(s) pushed and I'll look & merge into my branch
Jonathan Frederic
@jdfreder
Oct 31 2014 18:29

@jasongrout I think there's a problem with the way we are using then to chain promises. Running

var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); }, $.proxy(console.error, console));
var c = b.then(function() { console.log('resolve'); }, function() { console.log('reject'); });

yields

yes core-libraries.min.js:2
resolve

I expect

yes core-libraries.min.js:2
reject
This produces the output I expect:
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = new Promise(function(resolve, reject){ a.then(function(msg) { console.log(msg); resolve(); }, function(err) { console.error(err); reject(); }); });
b.then(function() { console.log('resolve'); }, function() { console.log('reject'); });
yields
yes VM1345:3
reject
Jonathan Frederic
@jdfreder
Oct 31 2014 18:39
Never mind, I think I've figure out what was going on
No, I was right, something doesn't work as expected here
I'll post in your PR against mine
Jason Grout
@jasongrout
Oct 31 2014 19:00
okay, I'll try to look into it.
thanks; that might change things.
Jonathan Frederic
@jdfreder
Oct 31 2014 19:01
I posted a better example in your PR
I should open a PR, to your PR, against my PR...
jk..
@jasongrout it may just be that we need a .catch in the chain
Jason Grout
@jasongrout
Oct 31 2014 19:05
ah
Jonathan Frederic
@jdfreder
Oct 31 2014 19:05
.. hmm no that doesn't seem to work either... strange
Jason Grout
@jasongrout
Oct 31 2014 19:06
maybe I need to read (yet again) about promise chaining
maybe I need to read the spec---no substitute for that
Jonathan Frederic
@jdfreder
Oct 31 2014 19:06
well rsvp claims to support it
and rsvp is the library that we'll end up using I think
I'll try the same code with rsvp promises to see how it behaves
Jason Grout
@jasongrout
Oct 31 2014 19:07
ah, okay.
makes sense.
mypromise.then() returns a promise that fulfills to its value.
we basically need to do something similar to yield in a python error handler
I mean, raise in an error handler
to keep passing on the error handler
so:
```javascript
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); }, err => {console.error(err); return Promise.reject('new value')});
var c = b.then(function() { console.log('resolve'); }, function() { console.log('reject'); });
Jonathan Frederic
@jdfreder
Oct 31 2014 19:12
ahh that seems to work
hmmm
too bad it can't be more compact
seems a little lame to have to keep passing error manually
@jasongrout ahh you can do it
using $.proxy
i.e.
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); }, $.proxy(Promise.reject, Promise));
var c = b.then(function() { console.log('resolve'); }, function() { console.log('reject'); });
so the only relevant bit there is : , $.proxy(Promise.reject, Promise));
Jonathan Frederic
@jdfreder
Oct 31 2014 19:19
ok, I added code comments to your PR
Thomas Kluyver
@takluyver
Oct 31 2014 19:50
Woo, we're down to 40 open PRs again
Jason Grout
@jasongrout
Oct 31 2014 19:52
you're not passing the error manually
you're just re-raising it.
it's exactly the same as in python. In an error handler, you've caught the error. If you want to propagate the error, you need to raise it again.
Jonathan Frederic
@jdfreder
Oct 31 2014 19:54
I wasn't thinking .then( was like try
Jason Grout
@jasongrout
Oct 31 2014 19:54
notice here:
var a = new Promise(function(resolve, reject){ reject('yes'); });
var b = a.then(function(msg) { console.log(msg); });
var c = b.then(function() { console.log('resolve'); }, function(msg) { console.error(msg); });
the error propagates just fine past b to c's handler
so you'll see in my rewrite of unpack, I ignore all errors until the very top
and catch it there
Jonathan Frederic
@jdfreder
Oct 31 2014 19:56
I'd think
hmm
Jason Grout
@jasongrout
Oct 31 2014 19:56
by the way, in _handle_comm_msg, what is this init_state_callback thing?
by the way, we like that error handling for the state changes
imagine you have a long sequence of state changes. You want to handle an error in setting state once, and not have it propagate automatically
Jonathan Frederic
@jdfreder
Oct 31 2014 19:58
It's supposed to be a callback that you can register to know when a state push has occurred from the front-end. I think it's there as premature optimization, but when the persistence API gets merged, there will be a request state method which should return a promise (instead of that callback being used).
Jason Grout
@jasongrout
Oct 31 2014 19:59
so...I can take it out?
Jonathan Frederic
@jdfreder
Oct 31 2014 19:59
yes
I added it in the widgets from JS PR
I'll be afk for lunch
ttyl
Jason Grout
@jasongrout
Oct 31 2014 20:46
okay, take a look at my PR to your PR. I think it's all there, but I haven't tested a line of it yet.
Brian E. Granger
@ellisonbg
Oct 31 2014 21:18
Is @takluyver around? I just updated the R kernel stuff and it appears to be broken
I am seeing the following error in the JS console
Thomas Kluyver
@takluyver
Oct 31 2014 21:19
I'll test it now
Brian E. Granger
@ellisonbg
Oct 31 2014 21:22
Thanks! Looks like something is wrong with the kernelspec json
I see a traceback in the terminal that started the notebook as well
Thomas Kluyver
@takluyver
Oct 31 2014 21:23
it's a trailing comma :angry:
Pushing a fix now
Brian E. Granger
@ellisonbg
Oct 31 2014 21:24
OK thanks, which package as the issue? IRkernel
Thomas Kluyver
@takluyver
Oct 31 2014 21:24
yep
Brian E. Granger
@ellisonbg
Oct 31 2014 21:24
OK I see the comma - thanks so much!
Thomas Kluyver
@takluyver
Oct 31 2014 21:25
Pushed a fix - if you redo the last two steps of the installation, it should work
Brian E. Granger
@ellisonbg
Oct 31 2014 21:25
OK, yep we got it working...
Thomas Kluyver
@takluyver
Oct 31 2014 21:28
:)
Brian E. Granger
@ellisonbg
Oct 31 2014 21:45
@takluyver actually thinking more about the kernelspec bug - the effect of that kernelspec JSON problem in the ir kernel caused no kernels to work.
I think we need to make sure that 1 bad kernel spec file doesn't affect other kernels (which today it does)
Thomas Kluyver
@takluyver
Oct 31 2014 21:46
yes, we should probably do some error handling on that
make an issue and assign it to me
Brian E. Granger
@ellisonbg
Oct 31 2014 21:46
OK
Thomas Kluyver
@takluyver
Oct 31 2014 21:46
I'm busy with something else at the moment
Brian E. Granger
@ellisonbg
Oct 31 2014 21:48
OK done #6824
Thomas Kluyver
@takluyver
Oct 31 2014 21:49
thanks
Jason Grout
@jasongrout
Oct 31 2014 22:01
@jdfreder: back from lunch?
Jonathan Frederic
@jdfreder
Oct 31 2014 22:29
Hey @jasongrout yeah I'm here
Jason Grout
@jasongrout
Oct 31 2014 22:39
by the way, I'm tracking down some bugs in the code I wrote
Jonathan Frederic
@jdfreder
Oct 31 2014 22:42
awesome
yeah the code I wrote had some bugs too
I left one comment inline
it may fix a bug you're tracking
Jason Grout
@jasongrout
Oct 31 2014 22:47
I tracked down about 3-4 bugs. You'll see the new small commits at the end of my pr...
at least a simple int slider works now. I've got to run, but I'll talk with you on Monday about this.
Jonathan Frederic
@jdfreder
Oct 31 2014 22:48
ok
ttyl
happy halloween!
Jason Grout
@jasongrout
Oct 31 2014 22:48
my promised pr is resolved now :)
Jonathan Frederic
@jdfreder
Oct 31 2014 22:48
LOL
Jason Grout
@jasongrout
Oct 31 2014 22:51
it says it can't merge now, I assume you can fix that. anyways, talk to you later.
Jonathan Frederic
@jdfreder
Oct 31 2014 22:52
yeah I've got it
ttyl