-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
Can't print sparse vectors/matrices #200
Comments
There are tab characters in the sparse-matrix printed output. @Carreau, would that cause problems with the latest IPython? |
Hum, @minrk is more comfortable for message spec than I am. And it looks like message spec. |
I think JSON (at least Python JSON) escapes tab characters, so In [6]: json.dumps("[2, 2] = true\n\t[1, 4] = true")
Out[6]: '"[2, 2] = true\\n\\t[1, 4] = true"'
v
In [7]: json.loads('"[2, 2] = true\\n\\t[1, 4] = true"')
Out[7]: u'[2, 2] = true\n\t[1, 4] = true'
v
In [8]: json.loads('"[2, 2] = true\\n\t[1, 4] = true"')
ValueError: Invalid control character at: line 1 column 19 (char 18) |
Hmm, that doesn't seem to be the problem: Julia's |
But the message that Python is receiving does not have an escaped tab. Julia is not sending a string with an escaped tab character, it's sending a raw tab character. |
It looks escaped on my machine, with IPython 2.0.0 (where sparse-matrix display works fine ... I haven't tried IPython 2.1 yet). Just ran
Note that this is printing the actual string (rather than the repr as in your examples above), so the backslashes are not doubled. The JSON string contains What would have broken this in IPython 2.1? |
Just tried with IPython 2.1 from Anaconda, and it still works fine for me. Maybe we just need to tag a new JSON release? @lrq3000, can you try |
How can I provide you with more informations on this problem? My install is EDIT: didn't see your edit by mail, I'm trying this right now. 2014-06-23 22:19 GMT+02:00 Steven G. Johnson [email protected]:
|
I tried to Pkg.checkout("JSON") and Pkg.update(), but I was already up-to-date. In the doubt I updated Julia to the last commit, but the same error persists. |
Could you run it |
Ok I activated verbosity but nothing gets printed in the notebook, only in the console:
|
Is there a newline in the
or is that an artifact of how you copied and pasted it? |
This is probably an artifact because I'm using the Windows pseudo-dos console, but I can't resize the window (to my knowledge). I can retry with powershell, to clear things up, this may remove the artifact. |
cc: @quinnj |
I just tried a Windows 8 machine and was able to reproduce the problem. It seems to have been triggered by a recent update to the JSON module. In particular, |
Okay, the problem seems to be that this commit used |
Seems to be fixed (or at least worked around) by JuliaIO/JSON.jl@0f038d9 |
I've just updated and this fixed the issue for me! Thank's a lot Steven! |
After assigning a variable to a sparse vector/matrix, it's only possible to print one entry, but no range nor the whole structure.
With Julia v0.3 prerelease from today, IJulia v0.1.12, Anaconda updated today (IPython v2.1.0) on Windows 7 32-bits.
Eg:
Here is the full error stack for print(A):
The text was updated successfully, but these errors were encountered: