How to run python program from command line in windows

Hi All…

Iam new to the python scripting and exploring for security program…

I wrote a simple server script that offered connection to the client and send message to the client . and saved in local path as seen in the attached screen shot. I already added python exe in environment variable path. But when i trying to run the script from the location where i saved through command prompt, i am getting following error as " Not recognized as an internal or external command " as seen in the attached screen shot.

can anyone please help me how to run it from a command prompt…

Appreciate for your help


<img src="//codecademy-

basic_socket_programing is not a command, its a program you want to execute with python, so:

python Basic_Socket_Programing

This is where my knowlegde ends, i always code on Linux, rarely on windows

Hi Thanks @stetim94 for your replay… yea …you are right… but now whenever iam running program , iam getting following message…

Lets say there is server program as i already mentioned that offered connection to the client and send message to the client and other client program that listen from Server… Please look in to the attached screen shot and let me know please what is the exact issue… i googled it already but didn’t find suitable solution for that…


I don’t think you read the error message.

But if you did and you’re having trouble addressing what it’s telling you, then explain what that trouble is - there’s no way anyone will guess what that trouble is.

Hi @ionatan
Thanks for your replay… these are the error iam getting on client program

Traceback (most recent call last):
File “C:/Users/Umesh/PycharmProjects/Basic_Socket_Programing/”, line 8, in
File “C:\Python27\lib\”, line 228, in meth
return getattr(self._sock,name)(*args)
TypeError: connect() takes exactly one argument (2 given)

can you please have look in to that.


Yeah I’m just going to refer to my previous reply

seems pretty clear you have a problem at line 8?

Hi @stetim94 … Thanks for your replay… yea… but iam not sure about the reason behind this issue… as per the code it should connect to the server… right? could you please tell me how can fix those…

Let me brief the scenario here

  1. I have a Linux machine(Kali) in VM that considered/stand as server remotely for which the server listen program already done
  2. Now i want my windows(Client) machine to connect to the server- that is linux… so this above code i believe it does …

Please let me know if there any issue respect to the code

Appreciate for your help

pretty much everything you said here is not relevant. (no offense indented)

You have an error, causes by incorrectly using .connect(), you supply two arguments while connect can only handle one

yea @stetim94 i refereed some example for the same program and all where the arguments supplied was 2 ie - host and port… let me know what would be the exact method to connect to the host if the above is wrong…


Once you’ve identified that you’re using wrong arguments, look up its documentation to find out what it should be. You can find them by googling, including language name, module name, and function name should make it trivial to find

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.