Forum Replies Created

  • This has to do with the fact that PyKX uses a few environment variables to stop certain pieces from being loaded twice if it is reimported. The parent process loads PyKX and the env vars are set, when the child process is created these env vars are passed along to the child process, which causes PyKX in the child process to only partially load and segfault.

    This can be fixed by loading PyKX in the parent process after the child process is spawned.

    parent.py

     

    print("parent start")   
    import subprocess  
    proc=subprocess.Popen(     ['/a/stor164ncs2.new-york.ms.com/sc34770/s180992/hodgidav/myenv/bin/python','child.py'],     stdout=subprocess.PIPE,     stderr=subprocess.PIPE ) 
    import pykx # import PyKX after spawning the child process 
    proc.communicate() 
    print(proc.wait())  
    print("parent end")  
    import sys  
    sys.exit(69)

     

  • kshepherd

    Member
    July 29, 2022 at 12:00 am in reply to: How to make two referencing sub-projection works?
    f:{[xF] 
        g:{[h;xG] $[xG < 0; xG; h[.z.s; xG - 2] + 20]}; 
        h:{[g;xH] $[xH < 0; xH; g[.z.s; xH - 3] + 30]}; 
        g[h; xF] }; 
    f[10];

    Another option is to use .z.s to refer to the calling function when calling the other function.