pyAPT icon indicating copy to clipboard operation
pyAPT copied to clipboard

Python3 controller.info() error

Open dorox opened this issue 5 years ago • 3 comments

Exception has occurred: TypeError ord() expected string of length 1, but int found

I can contribute to solve that as soon as the owner is still working on it

dorox avatar Mar 05 '19 16:03 dorox

Hi @dorox can you provide more information? On which line does the error occur?

freespace avatar Mar 07 '19 07:03 freespace

Hi, see below. There are some other issues, which are solved in @yuriy-kozlov fork. However, neither master, nor forks solve another issue I have with LTS150 not returning status message (get_status.py, goto.py), even when correct request message was sent: it seems like there is nothing returning. At the same time move.py command returns status upon move completion. I'll try to work it out since I need to log movement velocity profile, should I create a fork (I'm new to GitHub)?

  File "~/controller.py", line 491, in info
    fwverminor = ord(fwver[0])
TypeError: ord() expected string of length 1, but int found

Here is the quick workaround I've written:

info = st.unpack('<I 8s H 3b x 48s 12s HHH', getmsg.datastring)
sn, model, hwtype, fwvermajor, fwverinterim, fwverminor, notes, _, hwver, modstate, numchan = info
fwver = '%d.%d.%d' % (fwvermajor, fwverinterim, fwverminor)
return (sn, model.decode().strip('\x00'), hwtype, fwver, notes.decode().strip('\x00'), hwver, modstate, numchan)

dorox avatar Mar 07 '19 10:03 dorox

These issues may be related if the controller is not responding to request/get appropriately. I assume the controller works as expected using thorlab's own software.

If you can perhaps get me a sample of getmsg.datastring from line 487 of controller.py we could do some testing. Unfortunately I don't have any APT hardware at the moment and so can not do any testing.

freespace avatar Mar 07 '19 11:03 freespace