Python Forum
WindowsError when calling nbtstat command using subprocess
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WindowsError when calling nbtstat command using subprocess
#1
Hello. I have been using the subprocess module to call Windows commands from within my script. I have been trying to call the nbtstat command, but get the following error: WindowsError: [Error 2] The system cannot find the file specified

Here is the code with causes this error to occur:

import subprocess
p = subprocess.Popen(['nbtstat', '-A', '192.168.2.10'], std=subprocess.PIPE)
I also tried using the full path to nbtstat below, but still got the same error:

p = subprocess.Popen(['C:\\Windows\\System32\\nbtstat.exe', '-A', '192.168.2.10'], stdout=subprocess.PIPE)
What could be the reason for the WindowsError?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using subprocess to execute complex command with many arguments medatib531 5 1,885 Apr-27-2023, 02:23 PM
Last Post: medatib531
  use subprocess on linux\pi wwith a "grep " command korenron 2 8,111 Oct-19-2021, 10:52 AM
Last Post: DeaD_EyE
  Error when running mktorrent subprocess command pythonnewbie138 4 3,874 Sep-16-2020, 01:55 AM
Last Post: pythonnewbie138
  Select correct item from list for subprocess command pythonnewbie138 6 3,320 Jul-24-2020, 09:09 PM
Last Post: pythonnewbie138
  Subprocess command working for one cmd and for cmd one not wrking PythonBeginner_2020 0 4,144 Mar-25-2020, 01:52 PM
Last Post: PythonBeginner_2020
  How to parallel executing a command using subprocess? larkypython 0 2,155 Nov-28-2019, 03:49 PM
Last Post: larkypython
  [split] calling external exe with subprocess (maybe) himbehl 2 1,994 Sep-09-2019, 09:47 AM
Last Post: DeaD_EyE
  A question about subprocess taking input from command line and returning output! Aurimas 8 5,196 May-15-2019, 04:02 PM
Last Post: Aurimas
  Why is subprocess.call command not working? zBernie 5 10,747 Nov-19-2018, 11:11 PM
Last Post: snippsat
  OS command via python subprocess module alinaveed786 21 10,860 Oct-23-2018, 05:40 AM
Last Post: alinaveed786

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020