The community forums are in BETA and closed to the public.

TCP_KEEPINTVL Error on Mac Osx 10.9.5 and Python 3.4.x

here my python mod : cmd2==0.6.8 pubnub==3.7.1 pubnub-console==3.5.2 pycrypto==2.6.1 Pygments==2.0.2 pyparsing==2.0.3 requests==2.5.3

and the error :

python3 testpubnub.py Traceback (most recent call last): File "testpubnub.py", line 2, in from Pubnub import Pubnub File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/Pubnub.py", line 88, in (socket.IPPROTOTCP, socket.TCPKEEPINTVL, 1), AttributeError: 'module' object has no attribute 'TCP_KEEPINTVL'

Any Idea ?

Are you running a sample app? The TCP_* attributes are not available on osx

How did you think i can set this parameter if i try to run the sample app ? Is any parameter i can disable or set somewhere ?

Hi Alessio,

Pubnub.py works correctly on OS X 10.10 with Python 2.7.9 and Python 3.4.3.

Here are the definitions in tcp.h (from the xnu source code) used in OS X 10.9.5: http://www.opensource.apple.com/source/xnu/xnu-2422.115.4/bsd/netinet/tcp.h

#define TCP_KEEPINTVL    0x101    /* interval between keepalives */
#define TCP_KEEPCNT      0x102    /* number of keepalives before close */

Therefore, it is possible to workaround the issue by defining these two constants the same way socket.TCP_KEEPALIVE is on line 82: https://github.com/pubnub/python/blob/e0f94c137daf482cacf740a55d4dcb4fdfb6c874/Pubnub.py#L82

Here's a patch: https://gist.github.com/parasyte/c1090f81215fd30c9f6f


Comments to this discussion are now closed!