Hi there, I am trying to implement the data streaming feature with my Moku:Go, but am running into some issues in getting connected and whatnot. Here’s my specs:
Moku model: Moku:Go
Operating system: macOS
Software version: 3.0.0
Firmware version: 580
Here’s what I’ve tried, first via the command line:
% mokucli stream --ip-address=[fe80:0000:0000:0000:7269:79ff:feb9:3732%22] --target=- --stream-id=logsink0
zsh: no matches found: --ip-address=[fe80:0000:0000:0000:7269:79ff:feb9:3732%22]
where my IPv6 address is pulled from:
I believe the brackets should be there, and I don’t understand why it can’t connect to it. If I do the same basic idea using the Python API, I have:
from moku.instruments import Datalogger
i = Datalogger(
'[fe80:0000:0000:0000:7269:79ff:feb9:3732%22]',
force_connect=True,
session_trust_env=False,
)
i.start_streaming(duration=10)
data = i.get_stream_data()
# Print out the data
print(data['time'], data['ch1'], data['ch2'])
i.relinquish_ownership()
Where I have to include the session_trust_env=False
kwarg to bypass my workplace proxies (see my previous issue here:
Doing this, I get a different error:
---------------------------------------------------------------------------
ConnectionRefusedError Traceback (most recent call last)
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in _connect(self)
71 client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
---> 72 client.connect(("localhost", self.port))
73 self._socket_rdr = client.makefile('r')
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
/var/folders/5p/tldcvwc96mq_36y25zzh9snw0016_2/T/ipykernel_19991/579061853.py in <module>
6 )
7 i.start_streaming(duration=10)
----> 8 data = i.get_stream_data()
9 # Print out the data
10 print(data['time'], data['ch1'], data['ch2'])
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in get_stream_data(self)
130 raise Exception
131 if not self._running:
--> 132 self._begin_streaming()
133 data = self._socket_rdr.readline()
134 if data:
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in _begin_streaming(self)
91 _start_event.wait()
92 self._running = True
---> 93 self._connect()
94
95 def stream_to_file(self, name=None):
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in _connect(self)
75 except socket.error:
76 if i == 5:
---> 77 raise Exception(f"Cannot connect to port {self.port}")
78 time.sleep(0.5)
79
Exception: Cannot connect to port 57442
So, I’m wondering if there’s any clear issues in what I’m doing. As far as I can tell, I’m following the documentation as well as can be, and this may be an issue simply with proxies from my workplace. I tried using the mokucli
program to run a proxy, doing the following, but it gives me the same “no matches found” error:
% mokucli proxy [fe80:0000:0000:0000:7269:79ff:feb9:3732%22]
zsh: no matches found: [fe80:0000:0000:0000:7269:79ff:feb9:3732%22]
Removing the brackets, it appears to run a proxy:
% mokucli proxy fe80:0000:0000:0000:7269:79ff:feb9:3732%22
Running a proxy from fe80:0000:0000:0000:7269:79ff:feb9:3732%22 to localhost:8090
Here I try to connect to localhost:8090 via both mokucli and the Python API, both giving the following errors:
CLI:
% mokucli stream --ip-address=localhost:8090 --stream-id=logsink0 --target=-
Invalid IP address
Python API:
from moku.instruments import Datalogger
i = Datalogger(
'localhost:8090',
force_connect=True,
session_trust_env=False,
)
i.start_streaming(duration=10)
data = i.get_stream_data()
# Print out the data
print(data['time'], data['ch1'], data['ch2'])
i.relinquish_ownership()
---------------------------------------------------------------------------
ConnectionRefusedError Traceback (most recent call last)
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in _connect(self)
71 client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
---> 72 client.connect(("localhost", self.port))
73 self._socket_rdr = client.makefile('r')
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
/var/folders/5p/tldcvwc96mq_36y25zzh9snw0016_2/T/ipykernel_19991/336347656.py in <module>
6 )
7 i.start_streaming(duration=10)
----> 8 data = i.get_stream_data()
9 # Print out the data
10 print(data['time'], data['ch1'], data['ch2'])
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in get_stream_data(self)
130 raise Exception
131 if not self._running:
--> 132 self._begin_streaming()
133 data = self._socket_rdr.readline()
134 if data:
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in _begin_streaming(self)
91 _start_event.wait()
92 self._running = True
---> 93 self._connect()
94
95 def stream_to_file(self, name=None):
/opt/anaconda3/envs/py310/lib/python3.10/site-packages/moku/instruments/_stream.py in _connect(self)
75 except socket.error:
76 if i == 5:
---> 77 raise Exception(f"Cannot connect to port {self.port}")
78 time.sleep(0.5)
79
Exception: Cannot connect to port 57734
So, I’m a bit at a loss on what to try next, or if there’s any clear reasons why it’s not working. I do plan to try just running it with my non-work computer to see if that’s the issue, so I’ll report back on that front. Any help/insight would be much appreciated, thanks!