Skip to main content
Commonmark migration
Source Link

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]works well

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2]enter image description here [![enter image description here][3]][3]enter image description here

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2] [![enter image description here][3]][3]

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

works well

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

enter image description here enter image description here

So I think this must be the problem. Does this make sense ?

added 3 characters in body
Source Link
xyz
  • 655
  • 4
  • 38
  • 117

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here http://reference.wolfram.com/language/ref/EnterTextPacket.html?q=EnterTextPackethere

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2] [![enter image description here][3]][3]

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here http://reference.wolfram.com/language/ref/EnterTextPacket.html?q=EnterTextPacket

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2] [![enter image description here][3]][3]

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2] [![enter image description here][3]][3]

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

edit original question rather than give a new reply
Source Link
Michael
  • 491
  • 2
  • 9

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here http://reference.wolfram.com/language/ref/EnterTextPacket.html?q=EnterTextPacket

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2] [![enter image description here][3]][3]

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

I am evaluating expression by using KernelLink.

But the kernel will be suspended endless when meets a invalid escape character. a\abc, \[badEscape] for example.

So I have to filter all the invalid escape characters programmingly.

Is there a way to get all valid escape characters in Mathematica? \[Beta],\[Alpha] and so forth.

This is possibly caused by not all packets are read off properly

I will show the Mathematica code bellowd that you could test easily.

I'm using EnterTextPacket function(which communicates through WSTP) to talk with KernelLink. You could find refercence here http://reference.wolfram.com/language/ref/EnterTextPacket.html?q=EnterTextPacket

The first case evaluates 10!, and works well

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]

[![works well][1]][1]

we could see the last LinkRead[link] returned In[2]:= indicates all packages read off.

The next case evaluates \[BadEscape] causes packages returned with endless. LinkRead[link] returned Syntax Err continuously.

link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)

[![enter image description here][2]][2] [![enter image description here][3]][3]

So I think this must be the problem. Does this make sense ? [1]: https://i.sstatic.net/u0AKn.png [2]: https://i.sstatic.net/3Ct36.png [3]: https://i.sstatic.net/RyOsp.png

added 12 characters in body; edited title
Source Link
rhermans
  • 37.4k
  • 4
  • 61
  • 152
Loading
edited tags
Link
Szabolcs
  • 236.5k
  • 31
  • 641
  • 1.3k
Loading
Source Link
Michael
  • 491
  • 2
  • 9
Loading