# Sockets using Mender State scripts

**URL:** <https://hub.mender.io/t/sockets-using-mender-state-scripts/2396>\
**Category:** General Discussions\
**Created:** [September 7, 2020, 4:07am UTC](https://hub.mender.io/t/sockets-using-mender-state-scripts/2396 "2020-09-07T04:07:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamanRatna](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@SamanRatna](https://hub.mender.io/u/SamanRatna)\
**Post date:** [September 7, 2020, 4:07am UTC](https://hub.mender.io/t/sockets-using-mender-state-scripts/2396/1 "2020-09-07T04:07:28Z")

</div>

Hello,

I want to connect to sockets from Mender state scripts. I am using ZeroMQ for that right now. Basically, A socket will be waiting to be connected in raspberry pi and state script will need to connect to that socket and send message to the very socket when executed in ArtifactInstall\_Enter state.

The update fails when I do so. Is there anything I need to do to bind to the socket? And, where do the state scripts reside in my raspberry pi device after an update ?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [September 7, 2020, 6:54am UTC](https://hub.mender.io/t/sockets-using-mender-state-scripts/2396/2 "2020-09-07T06:54:32Z")

</div>

That should work. 🙂

---

<div class="post-metadata">

**Author:** ![SamanRatna](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@SamanRatna](https://hub.mender.io/u/SamanRatna)\
**Post date:** [September 7, 2020, 11:31am UTC](https://hub.mender.io/t/sockets-using-mender-state-scripts/2396/3 "2020-09-07T11:31:24Z")

</div>

the log file shows that ‘zmq : no module found’.

And, when I try the same script in my system, it works on python3 my\_script.py but not on python my\_script.py.

What could be the problem ?

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [September 8, 2020, 8:12pm UTC](https://hub.mender.io/t/sockets-using-mender-state-scripts/2396/4 "2020-09-08T20:12:59Z")

</div>

You probably only have the python2 version of zmq installed and not the python3 version.
