Fix Jupyter (#1223)

* Call PyErr_Print() in QtResImport()

* Fix Jupyter
This commit is contained in:
Florian Märkl 2019-02-27 14:54:47 +01:00 committed by GitHub
parent 2208d3c134
commit 1f4339bed2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -1,2 +1,3 @@
jupyter jupyter
ipykernel==4.10.0 ipykernel==4.10.0
pyzmq==17.1.2

View File

@ -55,9 +55,13 @@ PyObject *QtResGetCode(const char *name)
PyObject *QtResImport(const char *name) PyObject *QtResImport(const char *name)
{ {
PyObject *codeObject = QtResGetCode(name); PyObject *codeObject = QtResGetCode(name);
if (!codeObject) if (!codeObject) {
return nullptr; return nullptr;
}
PyObject *module = PyImport_ExecCodeModule(name, codeObject); PyObject *module = PyImport_ExecCodeModule(name, codeObject);
if (!module) {
PyErr_Print();
}
Py_DECREF(codeObject); Py_DECREF(codeObject);
return module; return module;
} }

View File

@ -1,12 +1,17 @@
import json import json
from _cutter import * from _cutter import *
try:
from CutterBindings import * from CutterBindings import *
def core():
return CutterCore.instance()
except ImportError:
pass
def cmdj(command): def cmdj(command):
"""Execute a JSON command and return the result as a dictionary""" """Execute a JSON command and return the result as a dictionary"""
return json.loads(cmd(command)) return json.loads(cmd(command))
def core():
return CutterCore.instance()