The Cython bindings do not support Params. I do not know about the original python bindings that came from the LCNC fork.
If you have a pin (not param), then you can set it with hal.Pin(‘pinname’).set(value) If the params are needed in a python program, the best way would be to change the params to pins in the components source. From: [email protected] <[email protected]> On Behalf Of Michael Brown Sent: Tuesday, 19 May 2020 02:38 To: Machinekit <[email protected]> Subject: [Machinekit] Re: halcmd setp equivalent in python Here are all the combinations I have tried with cossospoding error messages: hal.Param('hm2_5i25.0.gpio.070.is_output').set(true) AttributeError: 'module' object has no attribute 'Param' hal.set_p("hm2_5i25.0.gpio.070.is_output","true") AttributeError: 'module' object has no attribute 'set_p' hal.setp("hm2_5i25.0.gpio.070.is_output","true") AttributeError: 'module' object has no attribute 'setp' hal.Setp("hm2_5i25.0.gpio.070.is_output","true") AttributeError: 'module' object has no attribute 'Setp' there are 2 python files: '/home/mib/Developer/the-snowwhite_git/machinekit-hal/lib/python/hal.py' '/home/mib/Developer/the-snowwhite_git/machinekit-hal/src/hal/lib/hal.py' containing: class Pin(_ItemWrap): def __init__(self, item): _ItemWrap.__init__(self, item) if not item.is_pin(): raise TypeError("Must be constructed from pin object") class Param(_ItemWrap): def __init__(self, item): _ItemWrap.__init__(self, item) if item.is_pin(): raise TypeError("Must be constructed from param object") However it seems like the python library used is in a different location: hal.Pin('hm2_5i25.0.gpio.070.is_output').set(true) File "hal/cython/machinekit/hal_pin.pyx", line 23, in machinekit.hal._Pin.__cinit__ (hal/cython/machinekit/hal.c:5368) File "hal/cython/machinekit/hal_pin.pyx", line 29, in machinekit.hal._Pin.__cinit__ (hal/cython/machinekit/hal.c:4935) ??? On Sunday, May 17, 2020 at 10:09:47 PM UTC+2, justin White wrote: import hal and: hal.set_p("pinname","value") set_p or "setp" should be universal between pins and parameters. hal.Pin is specifying the Pin class, but you are trying to set a parameter. hal.Param may also work in the same vein as your original attempt on a parameter. On Sunday, May 17, 2020 at 2:31:13 PM UTC-4, Michael Brown wrote: Is it possible to set module parameters directly in python based hal configs without using the shell ? if I attempt doing: hal.Pin('hm2_5i25.0.gpio.018.invert_output').set(true) I get an error about missing pin. So far below construct is all I can get to work: os.system('halcmd setp hm2_5i25.0.gpio.018.invert_output true') . -- website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit --- You received this message because you are subscribed to the Google Groups "Machinekit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/machinekit/013a01d62db2%2430924810%2491b6d830%24%40basdebruijn.com.
