MokuLab IPv6 connection via Python

Hello,
i am using an Moku:Lab which is connected via a USB Hub to the computer. It runs correctly in the Moku software. If i rightclick on the shown Moku:Lab in Moku Software, i can copy the IP which gives me an IPv6 string. I can also see the serial number of my device.

I tried to connect to the device by:

from moku.instruments import LockInAmp
i = LockInAmp("fe80::7269:79ff:feb7...")

and get the error message:
---------------------------------------------------------------------------AttributeError
Traceback (most recent call last)File c:\Users.….env\Lib\site-packages\urllib3\util\url.py:423, in parse_url(url)
422 auth = auth or None
→ 423 host, port = _HOST_PORT_RE.match(host_port).groups() # type: ignore[union-attr]
424 if auth and normalize_uri: AttributeError: ‘NoneType’ object has no attribute ‘groups’ The above exception was the direct cause of the following exception: LocationParseError
Traceback (most recent call last)File c:\Users.….env\Lib\site-packages\requests\models.py:433, in PreparedRequest.prepare_url(self, url, params)
432 try:
→ 433 scheme, auth, host, port, path, query, fragment = parse_url(url)
434 except LocationParseError as e: File c:\Users.….env\Lib\site-packages\urllib3\util\url.py:449, in parse_url(url)
448 except (ValueError, AttributeError) as e:
→ 449 raise LocationParseError(source_url) from e
451 # For the sake of backwards compatibility we put empty
452 # string values for path if there are any defined values
453 # beyond the path in the URL.
454 # TODO: Remove this when we break backwards compatibility.

439 f"Invalid URL {url!r}: No scheme supplied. "
440 f"Perhaps you meant https://{url}?"
441 ) InvalidURL: Failed to parse: http://fe80::7269:79ff:…/api/moku/claim_ownership
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings…

and when trying to connect via the serial number:
i = LockInAmp(serial = "00178..")

i get this error message:

---------------------------------------------------------------------------MokuNotFound
Traceback (most recent call last)File c:\Users.…\MokuLabLockIn.py:14
1 #%%
2 # moku example: Basic Lock-in Amplifier
3 # (…)
9 # (c) 2022 Liquid Instruments Pty. Ltd.
10 #
12 from moku.instruments import LockInAmp
—> 14 i = LockInAmp(serial = “0017…”)
15 # i = LockInAmp(ip = “192.168.69.2”,force_connect=True)
16 # i = LockInAmp(ip=“fe80::7269:79ff:…”, force_connect=True)
17 # i = LockInAmp(ip=“http://[fe80::7269:79ff:…]/api/moku/claim_ownership”)
18 # i = LockInAmp(serial = “001784”, force_connect=True)
19 # i = LockInAmp(ip = “fe80:0000:0000:0000:7269:79ff:feb7:…”)
File c:\Users.….env\Lib\site-packages\moku\instruments_lockinamp.py:42, in LockInAmp.init(self, ip, serial, force_connect, ignore_busy, persist_state, connect_timeout, read_timeout, slot, multi_instrument, **kwargs)
40 raise MokuException(“IP (or) Serial is required”)
41 if serial:
—> 42 ip = find_moku_by_serial(serial)
44 super().init(
45 ip=ip,
46 force_connect=force_connect, (…)

10 if len(result) > 0:
11 return result[0].ipv4_addr
—> 12 raise MokuNotFound()
MokuNotFound:

Does anybody know how to set up the connection with python?
Since it works with moku software, i assume there should be a way.

Best
Ramon

Issue solved,
there was a firmware update to 6.01 needed.

1 Like