chuckablack / python-52-weeks

repository for teaching python
MIT License
107 stars 76 forks source link

ip normalization doesn't work at Win10 #3

Open kimjw001 opened 3 years ago

kimjw001 commented 3 years ago

In win 10 ,

PS C:\Python37\Practices\quokka> & C:/Python37/python.exe c:/Python37/Practices/quokka/m01_basics/l_13.normalize_data.py

Normalization tests

--String lower() normalization works --String casefold() normalization works --MAC address normalization works Traceback (most recent call last): File "c:/Python37/Practices/quokka/m01_basics/l_13.normalize_data.py", line 79, in if IPv4Address(ip_addr_1) == IPv4Address(ip_addr_2) == IPv4Address(ip_addr_3): File "C:\Python37\lib\ipaddress.py", line 1327, in init self._ip = self._ip_int_from_string(addr_str) File "C:\Python37\lib\ipaddress.py", line 1166, in _ip_int_from_string raise AddressValueError("%s in %r" % (exc, ip_str)) from None ipaddress.AddressValueError: Ambiguous (octal/decimal) value in '010' not permitted in '010.00.01.001' PS C:\Python37\Practices\quokka>

kimjw001 commented 3 years ago

In Linux , It works .

chuckablack commented 3 years ago

Are the Python version you are running, Python 3.7.x? I notice the directory is C:\Python37\lib... . I mention this because the issue seems to be in the IPv2Address package, and perhaps that has been updated?

On my development system, which is Ubuntu, I'm using Python 3.8.5. Perhaps it will behave differently with a newer version of Python on your Windows 10 system?

It may not, I'm just speculating. It is complaining about the strange IP addresses I'm attempting to pass in - with leading zeros - so if still isn't working, you can safely delete or comment out that line with the leading zeros.

chuckablack commented 3 years ago

I ran this on my Windows 10 host, with Python 3.8 in PyCharm, and it runs fine. I also ran it in Windows 10 from the command line, where it is running Python 3.9.1, and it also runs fine. So I'm suspecting that the issue is with the version of Python you are running.

So my recommendation would be to update your Python version, and see if that resolves the problem.

kimjw001 commented 3 years ago

Thanks for replying about my question.

Yes it works for me after deleting leading zeo.

Regards,

Jeff Kim

213-200-9134

On Thu, Feb 4, 2021 at 11:53 AM chuckablack notifications@github.com wrote:

Are the Python version you are running, Python 3.7.x? I notice the directory is C:\Python37\lib... . I mention this because the issue seems to be in the IPv2Address package, and perhaps that has been updated?

On my development system, which is Ubuntu, I'm using Python 3.8.5. Perhaps it will behave differently with a newer version of Python on your Windows 10 system?

It may not, I'm just speculating. It is complaining about the strange IP addresses I'm attempting to pass in - with leading zeros - so if still isn't working, you can safely delete or comment out that line with the leading zeros.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chuckablack/python-52-weeks/issues/3#issuecomment-773564641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHI6IH6DRLX5SZBCAZKDADLS5L3LDANCNFSM4XDNVAJA .

chuckablack commented 3 years ago

Have you tried updating your Python version? On my Windows 10 system, the code works fine with both 3.8.5 and 3.9.

On Sat, Feb 6, 2021, 9:48 AM kimjw001 notifications@github.com wrote:

Thanks for replying about my question.

Yes it works for me after deleting leading zeo.

Regards,

Jeff Kim

213-200-9134

On Thu, Feb 4, 2021 at 11:53 AM chuckablack notifications@github.com wrote:

Are the Python version you are running, Python 3.7.x? I notice the directory is C:\Python37\lib... . I mention this because the issue seems to be in the IPv2Address package, and perhaps that has been updated?

On my development system, which is Ubuntu, I'm using Python 3.8.5. Perhaps it will behave differently with a newer version of Python on your Windows 10 system?

It may not, I'm just speculating. It is complaining about the strange IP addresses I'm attempting to pass in - with leading zeros - so if still isn't working, you can safely delete or comment out that line with the leading zeros.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/chuckablack/python-52-weeks/issues/3#issuecomment-773564641 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AHI6IH6DRLX5SZBCAZKDADLS5L3LDANCNFSM4XDNVAJA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chuckablack/python-52-weeks/issues/3#issuecomment-774514312, or unsubscribe https://github.com/notifications/unsubscribe-auth/APKL7FRLBHRUKC4MIZORCZDS5V6HBANCNFSM4XDNVAJA .

kimjw001 commented 3 years ago

Thanks Chuck ,

I have tried it with python 3.9.1 and it works fine.

Regards,

Jeff Kim

213-200-9134

On Sat, Feb 6, 2021 at 10:07 AM chuckablack notifications@github.com wrote:

Have you tried updating your Python version? On my Windows 10 system, the code works fine with both 3.8.5 and 3.9.

On Sat, Feb 6, 2021, 9:48 AM kimjw001 notifications@github.com wrote:

Thanks for replying about my question.

Yes it works for me after deleting leading zeo.

Regards,

Jeff Kim

213-200-9134

On Thu, Feb 4, 2021 at 11:53 AM chuckablack notifications@github.com wrote:

Are the Python version you are running, Python 3.7.x? I notice the directory is C:\Python37\lib... . I mention this because the issue seems to be in the IPv2Address package, and perhaps that has been updated?

On my development system, which is Ubuntu, I'm using Python 3.8.5. Perhaps it will behave differently with a newer version of Python on your Windows 10 system?

It may not, I'm just speculating. It is complaining about the strange IP addresses I'm attempting to pass in - with leading zeros - so if still isn't working, you can safely delete or comment out that line with the leading zeros.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/chuckablack/python-52-weeks/issues/3#issuecomment-773564641

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AHI6IH6DRLX5SZBCAZKDADLS5L3LDANCNFSM4XDNVAJA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/chuckablack/python-52-weeks/issues/3#issuecomment-774514312 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/APKL7FRLBHRUKC4MIZORCZDS5V6HBANCNFSM4XDNVAJA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chuckablack/python-52-weeks/issues/3#issuecomment-774517187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHI6IHZLDY7D5OUI3V6UPW3S5WAOTANCNFSM4XDNVAJA .