-
Notifications
You must be signed in to change notification settings - Fork 108
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
json-read: JSON readtable error with python 3.6.3 #135
Comments
I had this problem and had to downgrade. Can we have a section in README that mentions the latest version of python this has been tested on? |
Neither downgrading with |
Oh I meant downgrade ob-ipython. I haven't tried with python 3.5 |
Can someone who's using the latest ob-ipython please comment with versions of python / ipython / jupyter they're using? |
I think I figured this out, at least on my system (latest version of
I think the reason this happens is because it uses jupyter to get a JSON output of the kernels, but it runs that via This is probably a documentation problem moreso than a code problem, as I'm not sure how you're supposed to be able to divine where the |
Hmm... I've always had Is there a way to see the string |
We must have different errors with the same error message. Can you try invoking |
@nicholas-miklaucic Thanks! Using
Once I comment the line that makes bash throw a warning, things work! @gregsexton Maybe a regexp to select the bit that begins with |
This isn't working at all for me. Using Python 3.6.2 and getting the same JSON read table error. This is me trying to run the example: Debugger entered--Lisp error: (json-readtable-error)
There are also seem to be problems with it killing the jupyter process. I have to kill it manually otherwise I get errors from ZMQ saying the port is already in use. |
Try invoking |
You'll also want to make sure that jupyter isn't writing any warnings also. I had to remove those too. |
I get a buffer called
|
@georgek That's how it looks like when it works. Set EDIT: Not sure that will work actually but you can try. I found the second answer here helpful: https://stackoverflow.com/questions/3257480/how-to-debug-elisp#3258205 |
I've tried using edebug and stepping through. The difficulty seems to be that in |
OK, I finally figured it out. It's not easy to debug something that uses I succumbed to installing jupyter/ipython within each virtualenv and now there is no error and it works. |
Any news about this bug? |
Hi everybody, |
@ludicludo you can use |
Following the instructions in PR #148 I got: If I execute
So, that doesn't seem to fix the problem |
Can you try doing the |
@nicholas-miklaucic After
|
Also, I am getting two buffers:
|
I have jupyter 4.3.0. Perhaps that's important? If it is, this belongs as a
separate bug.
…On Tue, Dec 26, 2017 at 6:53 PM Adolfo De Unánue ***@***.***> wrote:
Also, I am getting two buffers: ob-ipython-out (empty) and
*ob-ipython-kernel-default* with the following:
Jupyter console 5.2.0
Python 3.6.2 (default, Dec 6 2017, 13:55:54)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]:
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#135 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZLD8c82XnZ93FbotCIfng5NqX54lJcYks5tEYcCgaJpZM4QMIhv>
.
|
Actually my |
5.2., my bad: didn't realize the version counters were different.
…On Wed, Dec 27, 2017 at 1:04 AM Adolfo De Unánue ***@***.***> wrote:
Actually my jupyter version is 4.4.0, the jupyter-console is 5.2.0 Which
is your jupyter-console version? @nicholas-miklaucic
<https://github.com/nicholas-miklaucic>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#135 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZLD8RtXC9uuF6VHfI8QfbIaFHUAhgFYks5tEd3rgaJpZM4QMIhv>
.
|
I am so confused with this error... could you share with me your configuration files for org-mode ? Maybe the problem is there, or maybe is the |
@nanounanue You could replace |
@dcherian What do you mean? Could you be more specific? |
You can set ob-ipython-command to the path of jupyter. e,g |
@aayusuff I am using |
Hi everyone, I'm trying to use ob-ipython in a virtualenv environment. And I get this error too.
After you execute code in ob-ipython, you get the error
And I print the buffer when using
And there are some strange characters I think the problem is here. Json can't load the temp buffer because of there strange characters. So I hack these code.
or
I got the result
There is a little hack. Now you can use any virtualenv package which set The problem is the strange characters. Any hack like this or some code that clean the characters will solve the problem. |
output (e.g. warnings) from getting mixed with the client output, and then breaking the json parser. Aims to partially fix issue gregsexton#135
Hello everyone, when I use ob-ipython in Emacs launched from a shell with an active virtualenv (using pyenv) I get the same json-readtable error. My code runs on the kernel though, I could verify it by using the interactive session with C-c C-v C-z. However I don't get any output in the result block. Now when I launch Emacs from my basic system environment and then use pyen-mode-set to activate the exact same virtualenv from within Emacs, everything works fine. I am happy with that but still curious to understand what exactly is going wrong.
Thus when reading this message, ob-ipython--collect-json returns an error number being the first letter encountered in the error message in decimal form. (In my case error 47 corresponds to the "/" character) This explains why this number is so random and cryptic. As I see it the problem is not only virtualenvs, but also the way ob-ipython handles outputs coming from the kernel. This non json message should clearly be redirected to the error/warning buffer. Maybe there should be a filter ? Is there already such a function somewhere else in the code ? How are error messages normaly handled @gregsexton ? Of course the simplest way would be to just run pyenv or get the PATH from the shell and not have any error message, but this wouldn't make the program more robust. Who knows if the next version of Jupyter doesn't throw wierd stuff on our poor json-read ? |
Hello everyone, Currently, my ob-ipython setup returned to having similar error as discussed in this issue when I attempt to run a ipython code block from within a org mode file. If others think I should open a new issue, I will do so; however, after reading the comments under this issue I felt that my error was similar enough to warrant posting a comment here. Now to the actual error message I am seeing:
When toggling debug on error, I get the following backtrace:
Furthermore, the following is additional information regarding package versions in my current setup:
I have the most recent version of If anyone has any ideas for how I can fix this issue I am experiencing, I would appreciate the help. |
@jchkoch your error seem to be different, but the problem might be the same. The problem is that this error message doesn't tell a lot about where the problem reside. Generally though it is a problem of the way ob-ipython and your python environment interact. Have you checked if the env is well set in your org file ? You can try shell-command RET python --version RET and the others. If there is a problem here, using pyenv and its emacs plugin might be a solution. To address your problem more specifically, I advice you to use this hack dangirsh@df13b94 to be able to have a look at the json and understand what in it causes the reader to crash. I also had good results using edebug. It is implemented in Emacs and allows you to follow step by step the program in the elisp source code, knowing what data is coming in and out of each step. You could thus see more precisely where it crashes in the json-read function. But my guess is just that the json is badly formatted, have a look a it first :) Good luck ! |
The json-readtable error that I reported 2 days ago (#135 (comment)) disappeared when I restarted emacs today. So far, I have not ascertained why the issue disappeared. Anyway, thanks for the reply @theottm and I will keep this in mind if the error ever comes back. |
glad to hear it ! |
org-ipython has been temporary disabled because of: gregsexton/ob-ipython#135
I was seeing the same error. #135 (comment) worked. Thank you! |
I was getting a similar problem, but using edebug revealed that I was getting extra messages after the JSON response rather than before. I extended the solution in #135 (comment) to remove anything around or between top-level JSON objects in the response, which seems to be working for me: ; kill extraneous content in ipython returns between top-level JSON objects
(advice-add 'ob-ipython--collect-json :before
(lambda (&rest args)
(let ((start (point)))
(set-mark (point))
(while (re-search-forward "{" nil t)
(backward-char)
(kill-region (region-beginning) (region-end))
(re-search-forward "}\n" nil t)
(set-mark (point)))
(end-of-buffer)
(kill-region (region-beginning) (region-end))
(goto-char start)))) |
We I use python 3.6.2 and 3.6.2, when execute, occur json-read: JSON readtable error, but when use python 3.5.2, all is ok
The text was updated successfully, but these errors were encountered: