0

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

hmn Falahi
  • 730
  • 5
  • 22
Wong jacky
  • 11
  • 1
  • Please add the full traceback message to your question. The tiny fragment of the error message that you've showed us isn't sufficient to tell exactly where the problem occurred. – jasonharper Sep 19 '21 at 04:21
  • may I ask what you mean by traceback message, I am willing to show but I don't know what you mean – Wong jacky Sep 19 '21 at 04:28
  • @Wongjacky traceback refers to all the verbose that comes with the error – The Singularity Sep 19 '21 at 05:39
  • 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 – Wong jacky Sep 19 '21 at 06:00
  • This is my traceback error for rec_pyobj – Wong jacky Sep 19 '21 at 06:01

0 Answers0