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 with 1.2.0 release on Windows #10

Open
cleonello opened this issue Mar 12, 2018 · 12 comments
Open

AttributeError with 1.2.0 release on Windows #10

cleonello opened this issue Mar 12, 2018 · 12 comments

Comments

@cleonello
Copy link

Hi, the latest release (1.1.0) throws an error on Windows 7 under python 3.6.4 and under python 3.5.5. The previous release (1.0.7) does not. Here is the error when running the example code from the readme:

Traceback (most recent call last):
  File "pingtest.py", line 4, in <module>
    mp = MultiPing(["8.8.8.8", "youtube.com", "127.0.0.1"])
  File "C:\ProgramData\Miniconda3x86\envs\graphite\lib\site-packages\multiping\__init__.py", line 119, in __init__
    self._sock6 = self._open_icmp_socket(socket.AF_INET6)
  File "C:\ProgramData\Miniconda3x86\envs\graphite\lib\site-packages\multiping\__init__.py", line 130, in _open_icmp_socket
    else socket.IPPROTO_ICMPV6
AttributeError: module 'socket' has no attribute 'IPPROTO_ICMPV6'
@geokal
Copy link

geokal commented Mar 21, 2018

Hi, I can confirm the same happens in Ubuntu Linux

@jbrendel
Copy link
Contributor

Thank you for reporting this issue. I'll have a look at it.

@jbrendel
Copy link
Contributor

Recently, IPv6 support was added to multi-ping. The issue seems to stem from that. The code works for me as is and the IPPROTO_ICMPV6 symbol is defined for me.

@cleonello and @geokal, since I can't reproduce it here, could you please help me out and run a small test for me? Could you please start a Python shell and import the socket module, then check one attribute value for me?

>>> import socket
>>> socket.has_ipv6

What output do you get?

@geokal, could you please also let me know what version of Ubuntu you are running?

@geokal
Copy link

geokal commented Mar 22, 2018

Hi, @jbrendel in my Windows terminal the output of socket.has_ipv6 is equal to true. But again the result after running the python script located in the readme section:
is the same as @cleonello. I will report back on Ubuntu cause I don't have access right now. Thanks again!!

@alexjacobs08
Copy link

Having the same issue on Windows 10 using python 3.5.2

>>> import socket
>>> socket.has_ipv6

returns True

@mametov
Copy link

mametov commented May 11, 2018

Hi, I can confirm the same happens on Win 10 Python 3.6.5
socket.has_ipv6 returns True

@mametov
Copy link

mametov commented May 11, 2018

This solves the issue:
Open ...\lib\site-packages\multiping_init_.py
Line 129 where IF starts and delete "if ..... " to the end of the line and the line 130.
image

@geostar1024
Copy link

@mametov's solution doesn't work for me under python 3.4.3 on Windows XP (nor does replacing socket.IPPROTO_ICMPV6 with the hardcoded value 58). What does work is to comment out the self._sock6... statements on lines 119 and 120 (effectively removing IPv6 from multiping).

Technically, this shouldn't be a problem, given that Microsoft says that IPPROTO_ICMPV6 should be available on Windows XP. Maybe this has something to do with this bug.

@zachbryant
Copy link

zachbryant commented May 22, 2018

Can confirm @mametov's workaround on win10 3.6.5, but still hoping for a real solution

@jbrendel
Copy link
Contributor

Hello everyone. Thank you for continuing to follow up on this. My apologies for not checking back earlier.

I have just pushed what I believe is a patch for this. In effect, it checks whether the IPPROTO_ICMPV6 attribute is present in socket or not. And if not then it uses the hardcoded value of 58.

I tested this on Ubuntu 14.04, 16.04 and on Windows 10 and it works (no surprise on the Ubuntus, since they have that value available anyway).

I'm concerned about @geostar1024 report, though, since apparently you tried hardocding 58 and it did not work for you? I really don't know what to say to that. This, as patched right now, seems to work. At least with Python3 on Windows 10.

If everyone could give the current version a go, please, and let me know? I don't want to just close this issue without getting your feedback first.

Thank you again!

@jbrendel
Copy link
Contributor

jbrendel commented Jun 8, 2018

If this works for everyone, I will mark this issue as closed...

@geokal
Copy link

geokal commented Jun 10, 2018

@jbrendel thanks a lot will check tomorrow!

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

No branches or pull requests

7 participants