Glam Prestige Journal

Bright entertainment trends with youth appeal.

I am trying to run a ping using windows powershell, but this is the result:

ping google.com
Traceback (most recent call last): File "C:\Program Files\Python36\Scripts\ping.py", line 31, in <module> from impacket import ImpactDecoder, ImpactPacket
ImportError: No module named impacket

It seems that a python ping command is trying to be executed instead of the windows default ping command. How can I solve this?

PATH:

$env:PATH.split(";")
C:\Program Files\Python36\Scripts\
C:\Program Files\Python36\
C:\Program Files\Python37\Scripts\
C:\Program Files\Python37\
C:\Program Files\AdoptOpenJDK\jre-8.0.212.03-hotspot\bin
C:\Program Files (x86)\AdoptOpenJDK\jre-8.0.212.03-hotspot\bin
C:\Program Files\AdoptOpenJDK\jre-11.0.3.7-hotspot\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files\PuTTY\
C:\Program Files (x86)\Intel\Intel(R) Memory And Storage Tool\
C:\Users\user\AppData\Local\Microsoft\WindowsApps
C:\Program Files\JetBrains\PyCharm 2020.1\bin
C:\texlive\2019\bin\win32
C:\Program Files (x86)\Nmap
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
3

1 Answer

Issue analysis

Your problem is that Windows goes through each entry in the PATH variable and checks if a binary of the name you're calling exists in there and aborts the search on the first match. Since your PATH variable contains the Python Scripts entries before the common Windows paths they'll override default commands since they contain a script called ping.

It's uncommon to add custom paths to the beginning of the PATH variable. You usually append to its end.

How to fix:

Take the list above and combine all entries with ; as delimiter. But make sure to move the following entries to the end of the list:

C:\Program Files\Python36\Scripts\
C:\Program Files\Python36\
C:\Program Files\Python37\Scripts\
C:\Program Files\Python37\
C:\Program Files\AdoptOpenJDK\jre-8.0.212.03-hotspot\bin
C:\Program Files (x86)\AdoptOpenJDK\jre-8.0.212.03-hotspot\bin
C:\Program Files\AdoptOpenJDK\jre-11.0.3.7-hotspot\bin

Then follow these steps to update the PATH variable:

  1. On the Windows desktop, right-click My Computer.
  2. In the pop-up menu, click Properties.
  3. In the System Properties window, click the Advanced tab, and then click Environment Variables.
  4. In the System Variables window, highlight Path, and click Edit.
  5. In the Edit System Variables window, replace the list with your prepared list of entries (the full list from your post, reordered, with semicolons as delimiters). If the last character is not a semi-colon (;), add one.

Finally reboot the computer to ensure that all programs use the updated PATH variable.

Edit

It seems in Windows 10 they updated the PATH editor so that when you edit the variable you get a little editor window that allows you to edit each entry separately and also allows you to move them up and down. Simply move the Python entries to the bottom of the list.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy