Skip to content

'float' object has no attribute 'to' #468

Closed

Description

@serrapha

When trying to use the command inst.setpoint = 31.0, I receive:

value = int(round(value.to("degC").magnitude * 10, 0)) 

AttributeError: 'float' object has no attribute 'to'

I'm currently using NumPy 1.26.4

Activity

  1. scasagrande commented on Jan 16, 2026

    @scasagrande
    Contributor

    can you please post the entire traceback

  2. serrapha commented on Jan 16, 2026

    @serrapha
    Author

    Yes!

    Traceback (most recent call last):
      File "c:\Users\Principal\Documents\Teste-Forno\.venv\main.py", line 24, in <module>
        inst.setpoint = 31.0
        ^^^^^^^^^^^^^
      File "C:\Users\Principal\Documents\Teste-Forno\.venv\Lib\site-packages\instruments\hcp\tc038d.py", line 141, in setpoint
        value = int(round(value.to("degC").magnitude * 10, 0))
                          ^^^^^^^^
    AttributeError: 'float' object has no attribute 'to'
    
  3. scasagrande commented on Jan 16, 2026

    @scasagrande
    Contributor

    ah, looks like we have a typo

    this line should have value.to replaced with number.to https://github.com/instrumentkit/InstrumentKit/blob/main/src/instruments/hcp/tc038d.py#L141

  4. scasagrande commented on Jan 16, 2026

    @scasagrande
    Contributor

    or maybe it needs a little more than that? I'll try to fix that

  5. serrapha commented on Jan 16, 2026

    @serrapha
    Author

    I'm trying to change it in my own codebase. Will return as soon as I have results.

  6. serrapha commented on Jan 16, 2026

    @serrapha
    Author

    The change from "value.to" to "number.to" still gives the same error here.

  7. scasagrande commented on Jan 16, 2026

    @scasagrande
    Contributor

    can you try the change in #469

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions