has2k1 / gnuplot_kernel

A Jupyter/IPython kernel for gnuplot
BSD 3-Clause "New" or "Revised" License
83 stars 25 forks source link

Windows path 7 Error: End Of File #22

Open damistry opened 4 years ago

damistry commented 4 years ago

Sorry if the title isn't that useful.

Im using windows. I installed the gnuplot_kernel and tried to run plot sin(x) and I get the error "Error: gnuplot not found" In a python kernel running

from jupyter_client.kernelspec import KernelSpecManager
ksm = KernelSpecManager()
ksm.find_kernel_specs()

I get an output of

{'gnuplot': 'C:\\Users\\deves\\AppData\\Roaming\\jupyter\\kernels\\gnuplot',
 'python3': 'C:\\ProgramData\\Anaconda3\\share\\jupyter\\kernels\\python3'}

Looking at the kernel.json it gives the expected {"argv": ["/usr/bin/python", "-m", "gnuplot_kernel", "-f", "{connection_file}"], "display_name": "gnuplot", "language": "gnuplot", "name": "gnuplot"}

If I copy gnuplot.exe to C:\WINDOWS\ then gnuplot is found but then I get an error of:

Error: End Of File (EOF).
<pexpect.popen_spawn.PopenSpawn object at 0x000001CC7CC52240>
searcher: searcher_re:
    0: re.compile('\\w*> $')
    1: re.compile('PEXPECT_PROMPT_')
    2: re.compile('PEXPECT_PROMPT+')

Any ideas on whats going on? If someone can give me a pointer on where to start then I'll give it a go at working out whats wrong too. Cheers!

has2k1 commented 4 years ago

I cannot tell what is happening. Try this out from a python kernel.

import pexpect

spawn_cmd = 'path/to/gnuplot'
cmd = 'print "Testing"'
child = pexpect.spawn(spawn_cmd, encoding='utf-8')
child.sendline(cmd)
child.readline()
print(child.buffer) # result

It is a bare-bones test of the communication between python and gnuplot. i.e. gnuplot_kernel stripped to the bone.

damistry commented 4 years ago

Okay, I'll have to do some digging. Windows doesn't have pexpect.spawn() (https://pexpect.readthedocs.io/en/stable/overview.html#pexpect-on-windows).

I'll get back to you..

has2k1 commented 4 years ago

Try this

from metakernel.pexpect import spawn

spawn_cmd = 'path/to/gnuplot'
cmd = 'print "Testing"'
child = spawn(spawn_cmd, encoding='utf-8')
child.sendline(cmd)
child.readline()
print(child.buffer) # result
damistry commented 4 years ago

Only an empty string comes back

has2k1 commented 4 years ago

Can you go to the command prompt, start gnuplot and take a screen shot. Something like

gnuplot-repl

I do not have access to a windows machine and I have not used gnuplot on windows. I want to confirm that the text and prompt are just about the same. Specifically, is the prompt gnuplot>, with the space after >?

damistry commented 4 years ago

2020-06-23 17_05_33-Command Prompt - gnuplot Here you go. Yeah there is a space after the '>'