[Python] PYKX not allowing to change Python attribute

Discussão em 'Python' iniciado por Stack, Maio 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to do the following:

    import pykx
    old=":host:port:user:eek:ld"
    pykx.q.my_handle=old

    new=":host:port:user:new"
    pykx.q.my_handle=new



    The above works as expected. If I then try to access vía Python or directly from Q memory I would get the string in the new var.

    print(pykx.q.my_handle)
    print(pykx.q('string .my_handle'))


    However, if I access the attribute (for any reason) before setting It to new value then something weird happens:

    import pykx
    old=":host:port:user:eek:ld"
    pykx.q.my_handle=old

    print(f"my handled: {pykx.q.my_handle}")

    new=":host:port:user:new"
    pykx.q.my_handle=new

    #prints old
    print(pykx.q.my_handle)

    #prints new
    print(pykx.q("string .my_handle"))



    Anyone knows why?

    Note my handle has to be refreshed with new password/token whenever needed, in theory I vannot think about a use case, yet, where I need the Python attribute to be updated, since accesses from Q memory are working fine, however It feels veeery wrong.

    Continue reading...

Compartilhe esta Página