Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to start when position is NaN #1

Open
ddkohler opened this issue Jun 15, 2022 · 0 comments
Open

Fails to start when position is NaN #1

ddkohler opened this issue Jun 15, 2022 · 0 comments

Comments

@ddkohler
Copy link
Contributor

@ksunden

When the position is NaN (e.g. fresh install) the code fails by raising an exception in __init__ and thus does not get to even creating the state file that could then be edited:

Relevant lines of stack trace:

  File "C:\Users\john\miniconda3\lib\site-packages\yaqd_pmc\_pmc.py", line 36, in __init__
    self.reset_to_known_position(self._state["position"])
  File "C:\Users\john\miniconda3\lib\site-packages\yaqd_pmc\_pmc.py", line 106, in mm_to_steps
    return round((self._state["hw_limits"][1] - mm) * self.counts_per_mm)
SystemExit: cannot convert float NaN to integer

One solution is to say "I don't care about the NaN case, lets just make the default 0, then it can't get into this in the first place"

Another is to try/except or otherwise avert this exception.

This was likely introduced after these daemons were first implemented on the table, but just now the state files were found to be corrupted (all null bytes) and had to be deleted and treated (from a state file perspective) as a brand new install.

I've worked around this on the lab machine for the time being, but this should be fixed moving forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant