Problem solved! (I think.)
In j.py, after the ctypes.CDLL() call, for each API in libj, you need set
libj.<API>.restype and libj.<API>.argtypes accordingly (I pulled down the
jsource code and matched them). Once you do that, it runs.
~/experiment/python3> python3
Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018, 12:04:33)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import j
>>> j.init()
>>> j.do("a =: i. 5")
0
>>> print(j.get("a"))
[0 1 2 3 4]
Type matching is important. For example, in j.get(), dt/dr/ds/dd should be
using c_longlong(), not c_ulonglong().
Thanks for the add-on! It is wonderful.
Maurice
> On Feb 18, 2018, at 3:44 AM, More Rice <[email protected]> wrote:
>
> It is faulting on the do() method call after JInit() on j.py:39 for me as
> well.
> Segmentation fault: 11
>
> My J version is
> Engine: j806/j64/darwin
> Release: commercial/2017-11-06T10:20:33
> Library: 8.06.09
> Qt IDE: 1.6.2s/5.6.3
> Platform: Darwin 64
> Installer: J806 install
>
> thanks.
>
> Maurice
>
>> On Feb 17, 2018, at 10:54 PM, J. Patrick Harrington <[email protected]>
>> wrote:
>>
>> Eric,
>> I'm interested in this. Python is the fastest growing language
>> with astronomers -- the astropy package has really useful routines.
>> I don't really understand much about this, but I put j.py and j_config.py
>> into my python3 directory & edited the paths in j_config.py.
>>
>> Starting python3, I get
>>
>> Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
>> [GCC 7.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import j
>>>>> j.init()
>> Segmentation fault (core dumped)
>>
>> Any suggested diagnostics?
>>
>> My J version is
>> Engine: j806/j64/linux
>> Release: commercial/2017-11-06T09:54:01
>> Library: 8.06.09
>> Qt IDE: 1.6.2/5.3.2
>> Platform: Linux 64
>> Installer: J806 install
>>
>> Thanks for your efforts on this api
>>
>> Patrick
>>
>> On Sat, 17 Feb 2018, Eric Iverson wrote:
>>
>>> I have just added a python3 folder to the addons api family.
>>>
>>> The python scripts in the addon make it easy to use J from python3.
>>>
>>> The popularity of python, combined with easy use of J, might open some
>>> doors.
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm