You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and when I run this block of code:
ker = SubprocessKernel()
def MEval (expr, wait = True, kernel = ker) :
" " "MEval evaluates a Mathematica expression in the Mathematica kernel" " "
kernel.drain() # just to make sure things are clen
return kernel.evaluate (expr, wait = wait)
ker.start()
ker.start_evaluator()
I get this error:
MathLinkException Traceback (most recent call last)
in
4 kernel.drain() # just to make sure things are clen
5 return kernel.evaluate (expr, wait = wait)
----> 6 ker.start()
7 ker.start_evaluator()
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in _evaluate(self, expr, wait)
105 self._evaluateExpr(self.M._add_type_hints(expr))
106 if wait:
--> 107 self.waitForAnswer()
108 return self.get()
109
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in waitForAnswer(self)
148 self.__accumulatingPS = [] # some old-ass setting for working with PostScript I assume
149 while True:
--> 150 pkt = self._nextPacket()
151 allowDefaultProcessing = self.notifyPacketListeners(pkt)
152 if allowDefaultProcessing:
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in _nextPacket(self)
1404 mark = LinkMark(self).init()
1405 try:
-> 1406 pkt = self.active_link._nextPacket()
1407 except MathLinkException as e:
1408 if e.name == "UnknownPacket":
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/NativeLink.py in _nextPacket(self)
232 def _nextPacket(self):
233 with self._wrap():
--> 234 return self._call("NextPacket")
235
236 def _endPacket(self):
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/HelperClasses.py in exit(self, type, value, traceback)
465 self.parent.thread_lock.release()
466 if self.checkError:
--> 467 self.parent._check_error(self.check)
468
469 ###############################################################################################
Hi b3m2a1,
I was to follow your guide from:
https://community.wolfram.com/groups/-/m/t/1468475
and when I run this block of code:
ker = SubprocessKernel()
def MEval (expr, wait = True, kernel = ker) :
" " "MEval evaluates a Mathematica expression in the Mathematica kernel" " "
kernel.drain() # just to make sure things are clen
return kernel.evaluate (expr, wait = wait)
ker.start()
ker.start_evaluator()
I get this error:
MathLinkException Traceback (most recent call last)
in
4 kernel.drain() # just to make sure things are clen
5 return kernel.evaluate (expr, wait = wait)
----> 6 ker.start()
7 ker.start_evaluator()
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/SubprocessKernel/SubprocessKernel.py in start(self)
47
48 kernel_open = M.SubprocessKernel_OpenSubprocessNotebook(StartREPL=False)
---> 49 self.evaluate(kernel_open)
50
51 @Property
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in evaluate(self, expr, wait)
112 return self._reader.evaluate(expr, wait = wait)
113 else:
--> 114 return self._evaluate(expr, wait = wait)
115
116 def evaluateString(self, expr, wait=True, **opts):
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in _evaluate(self, expr, wait)
105 self._evaluateExpr(self.M._add_type_hints(expr))
106 if wait:
--> 107 self.waitForAnswer()
108 return self.get()
109
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in waitForAnswer(self)
148 self.__accumulatingPS = [] # some old-ass setting for working with PostScript I assume
149 while True:
--> 150 pkt = self._nextPacket()
151 allowDefaultProcessing = self.notifyPacketListeners(pkt)
152 if allowDefaultProcessing:
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/KernelLink.py in _nextPacket(self)
1404 mark = LinkMark(self).init()
1405 try:
-> 1406 pkt = self.active_link._nextPacket()
1407 except MathLinkException as e:
1408 if e.name == "UnknownPacket":
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/NativeLink.py in _nextPacket(self)
232 def _nextPacket(self):
233 with self._wrap():
--> 234 return self._call("NextPacket")
235
236 def _endPacket(self):
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/HelperClasses.py in exit(self, type, value, traceback)
465 self.parent.thread_lock.release()
466 if self.checkError:
--> 467 self.parent._check_error(self.check)
468
469 ###############################################################################################
~/Library/Mathematica/Paclets/Repository/PJLink-1.1.2/PJLink/NativeLink.py in _check_error(self, allowed)
215 errCode = self._call("Error")
216 if self._isException(errCode, allowed):
--> 217 raise MathLinkException(errCode, self._call("ErrorMessage"))
218
219 def _connect(self):
MathLinkException: MathLinkException 22: MLNextPacket called while the current packet has unread data.
Do you have any idea what I could be doing wrong here?
I'm running this on python 3.7.4 on jupyter notebook
OS: macOS 10.15.2
Thank you for your time
The text was updated successfully, but these errors were encountered: