Python3 and linuxcnc returned NULL without setting an exception

I am writing small script in python3 using linuxcnc libs

import time
import linuxcnc

i = 0
s = linuxcnc.stat()
while i < 3:
  try:
    r = s.poll()
    print('homed=', getattr(s, 'homed'))
    c = linuxcnc.command()
    c.abort()
    c.mode(linuxcnc.MODE_MANUAL)
    c.wait_complete()
    c.home(i)
  except Exception as detail:
    print("Error:", detail)
  i += 1
  time.sleep(2)  # Wait for 2 second

But I am getting this error

method 'poll' of 'linuxcnc.stat' objects> returned NULL without setting an exception

How can I solve this

  • Maybe you need to check if LinuxCNC and all dependencies are correctly installed.

    – 

  • Yes all dependencies are properlly installed. Linuxcnc is also running good with machine.

    – 

Leave a Comment