Open justin2004 opened 2 years ago
Hey there, @justin2004.
In order for Python to start Py'n'APL, it tries writing a little auxiliary file so that APL knows what port to connect to. It may be that Python doesn't have permission to create said auxiliary file.
Can you check if this is what's happening?
hi @RojerGS
execution does not make it past this line: https://github.com/Dyalog/pynapl/blob/8b17bceda64b182cf89f4c9b7b77580ec9daf2ed/pynapl/APLPyConnect.py#L444
but the FIFOs do get created:
>>> from pynapl import APL
>>> apl=APL.APL(debug=True)
in: /tmp/tmpno0hd1fa
out: /tmp/tmp_fdhz513
and i see them in the /tmp/ directory.
i guess i'll strace
python later to see why it can't open a FIFO it created.
it might also be that dyalog isn't starting:
root@debian-s-1vcpu-1gb-nyc3-01--google-home:~/pynapl# ps -ef | grep dyalog
root 99298 96042 0 16:11 pts/7 00:00:00 grep dyalog
Mind that, when using APL.APL(debug=True)
, the line of code that starts Dyalog ) is skipped:
https://github.com/Dyalog/pynapl/blob/8b17bceda64b182cf89f4c9b7b77580ec9daf2ed/pynapl/APLPyConnect.py#L437
If you don't set debug=True
, does Dyalog start?
i guess i'll strace python later to see why it can't open a FIFO it created. If you could do that, I'd appreciate it.
@RojerGS i got it to work with this patch:
diff --git a/pynapl/RunDyalog.py b/pynapl/RunDyalog.py
index 2166877..1a0572f 100644
--- a/pynapl/RunDyalog.py
+++ b/pynapl/RunDyalog.py
@@ -46,7 +46,7 @@ def posix_dythread(inf,outf, dyalog=b"dyalog"):
path=to_bytes(os.path.dirname(SCRIPTFILE))+b'/Py.dyalog'
# Run the Dyalog instance in this thread
- p=Popen([dyalog, b'-script'], stdin=PIPE, preexec_fn=os.setpgrp)
+ p=Popen([dyalog], stdin=PIPE, preexec_fn=os.setpgrp)
s=script%(pystr(ipcpath),pystr(path),inf,outf)
p.communicate(input=s.encode('utf8'))
my session:
root@debian-s-1vcpu-1gb-nyc3-01--google-home:~/pynapl# ipython3 --TerminalInteractiveShell.editing_mode=vi
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help.
[nav] In [1]: from pynapl import APL
[nav] In [2]: apl=APL.APL()
Dyalog APL/S-64 Version 18.0.40684
Serial number: UNREGISTERED - not for commercial use
+-----------------------------------------------------------------+
| Dyalog is free for non-commercial use but is not free software. |
| A non-commercial licence can be used for experiments and |
| proof of concept until the point in time that it is of value. |
| For further information visit |
| https://www.dyalog.com/prices-and-licences.htm |
+-----------------------------------------------------------------+
Copyright (c) Dyalog Limited 1982-2021
⎕PW←32767
{}2⎕FIX'file:///root/pynapl/pynapl/IPC.dyalog'
{}2⎕FIX'file:///root/pynapl/pynapl/Py.dyalog'
infile←'/tmp/tmpb7d69bix'
outfile←'/tmp/tmp7v_m7rgd'
Py.StartAPLSlave infile outfile
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
[ins] In [3]: apl.eval("⍳ 3")
Out[3]: [1, 2, 3]
How did you come to the conclusion that you should remove b'script'
from there?
And is it working decently, now?
i ran dyalog -script
saw that i got the same error message:
Dyalog APL could not initialise because the script file could not be opened
and started iterating on variations around that. also i didn't even see the -script
option mentioned in the dyalog command line interface guide.
And is it working decently, now?
yup. but i've only done apl.eval() which i think is all i will care about.
the only way i have been able to get this project to work under a linux distro is to apply this patch.
it seems like this project is only used by people using MS windows?
Applying the patch above also fixes the error for me.
Re: Removing the -script
flag, later versions no longer support this flag under Linux. Instead a dyalogscript
bash script is provided.
See Shell Scripts.
dyalog version 18.0.4068 Python 3.9.2 Debian 11
any tips?