So I have been trying to use the ZMQ module to make a publisher subscriber model I downloaded the library in Pycharm, made sure that it is the latest version. And when I try to use things like ".setsockopt" it keeps saying "unresolved attribute reference setsockopt for class "Socket" and ask me to add a method to the class "Socket" This is exteremly annoying and I have no idea how to solve this. I went online to read tutorials and all they did is just "import zmq" and everything is fine. Please help me=(
Its not only setsockopt, I have been trying things like .send_pyobj and it doesn't work too! Here I literally copy and paste a code from youtube: youtube.com/watch?v=-_CXA8SZsOs
please go to time 5:58, I copy that code and my pycharm say that on line15: socket.send_pyobj has error and say the same thing "unresolved attribute reference setsockopt for class "Socket" Somebody please help me your help means a lot to me
The youtube code:
import zmq
from time import sleep
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind('tcp://127.0.0.1:2000')
messages = [100,200,300]
curMsg = 0
while(True):
sleep(1)
socket.send_pyobj({curMsg:messages[curMsg]})
if (curMsg == 2):
curMsg = 0
else:
curMsg = curMsg +1
I have the following traceback error incase you are wondering note that it is for rec_obj which is pretty much the same issue with send_obj and also setsockopt. Basically it is missing for no reasons File "C:\Users\jacky\PycharmProjects\testing_the_send_data_and_receive_data_thing\venv\lib\site-packa ges\zmq\sugar\attrsettr.py", line 44, in getattr raise AttributeError( AttributeError: Socket has no such option: REC_PYOBJ