Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'MSG_WAITALL' #53

Closed
donpellegrino opened this issue Oct 4, 2016 · 4 comments
Closed

Comments

@donpellegrino
Copy link

donpellegrino commented Oct 4, 2016

When attempting the examples in README.md, an "AttributeError: 'module' object has no attribute 'MSG_WAITALL'" is generated.

$ python test.py
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    coll = sess.collections.get('/TestZone01/projects')
  File "C:\Python27\lib\site-packages\irods\manager\collection_manager.py", line 15, in get
    result = query.one()
  File "C:\Python27\lib\site-packages\irods\query.py", line 217, in one
    results = self.execute()
  File "C:\Python27\lib\site-packages\irods\query.py", line 169, in execute
    with self.sess.pool.get_connection() as conn:
  File "C:\Python27\lib\site-packages\irods\pool.py", line 22, in get_connection
    conn = Connection(self, self.account)
  File "C:\Python27\lib\site-packages\irods\connection.py", line 22, in __init__
    self._server_version = self._connect()
  File "C:\Python27\lib\site-packages\irods\connection.py", line 82, in _connect
    version_msg = self.recv()
  File "C:\Python27\lib\site-packages\irods\connection.py", line 41, in recv
    msg = iRODSMessage.recv(self.socket)
  File "C:\Python27\lib\site-packages\irods\message\__init__.py", line 41, in recv
    rsp_header_size = _recv_message_in_len(sock, 4)
  File "C:\Python27\lib\site-packages\irods\message\__init__.py", line 19, in _recv_message_in_len
    buf = sock.recv(size_left, socket.MSG_WAITALL)
AttributeError: 'module' object has no attribute 'MSG_WAITALL'
@adetorcy
Copy link
Contributor

adetorcy commented Oct 4, 2016

Is this the same issue as iPlantCollaborativeOpenSource/python-irodsclient/issues/10?

@donpellegrino
Copy link
Author

donpellegrino commented Oct 5, 2016

Yes, this looks like the same issue.

In researching the issue I found https://bugs.launchpad.net/myconnpy/+bug/437972 which appears to describe an analogous issue in another Python library. In their work-around they note that "MSG_WAITALL not available on windows."

@adetorcy
Copy link
Contributor

adetorcy commented Oct 5, 2016

The workaround (keep receiving data from socket until a given length has been read) looks like what _recv_message_in_len(sock, size) is already doing, so you might not need the MSG_WAITALL flag here.
In your file C:\Python27\lib\site-packages\irods\message__init__.py, line 19 please replace
buf = sock.recv(size_left, socket.MSG_WAITALL)
with
buf = sock.recv(size_left)
Is that helping?

@donpellegrino
Copy link
Author

That change to line 19 resolves the issue. Thanks!

If MSG_WAITALL is doing something useful on non-Windows platforms perhaps a conditional to not apply it on Windows work would in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants