Hey Dude :)

Dude, WHOA! wrote:
> kinda thing. The problem is that the client I wrote doesn't receive
> data and display it, and it also only executes single word commands.

> Server side:
> #!/usr/bin/env python

<snip>

>       try:
>               echo = Popen(command, stdout=PIPE).stdout.read()

On a linux system (and perhaps Windows as well), the type of 'command'
seems to be important and changes the behavior of Popen -- whether it be
string or sequence. If you pass a 'command' as a string that includes
arguments (ex. 'ls -l'), the above will raise an exception. I'm not sure
if the same applies to Windows. You could try passing command as a list
or tuple (ex command.split(), ['ls', '-l'], or similar), or add
'shell=True' to the Popen call.

> Client:
> #!/usr/bin/env python

<snip>

>       send = raw_input('Send: ')
>       sock.send(send)
>       sock.recv(2048)

Try 'print sock.recv(2048)'.

>       sock.close()

HTH,
Marty
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to