Re: Client/Server socket send user input

2005-10-26 Thread jas
Dennis, Thanks. That certainly looks like it could work. I understand about the interactive shell and my app going back and forth with the reads/writes. When my program runs it won't be used in an interactive python shell, but that is the only way I know of to really test it. --

DrPython - auto complete

2005-10-26 Thread jas
Hi, I just started to use DrPython and I have installed the CodeCompletion plugin. I am using DrPython 161 (on windows) with wxPython 2.6.1. Anyhow, when I try something like x = [] x. ...it pops up x.filename, x.prepend and x.word. Shouldn't it show x.append, x.pop, etc? Just curious if

Re: Redirect os.system output

2005-10-25 Thread jas
to a process. http://pexpect.sourceforge.net/ I've been using it on windows to automate a few things. Cheers, Paul jas wrote: Kent, Yes, your example does work. So did os.popen...however, the problem is specific to cmd.exe. Have you tried that yet? Thanks! Kent Johnson wrote

Re: Read/Write from/to a process

2005-10-25 Thread jas
So it seems there is no good way to handle interactive processes on windows using python. By interactive I mean processes/commands that require user interaction, such as telnet or del (to delete a file or directory sometimes you need to confirm with a yes or no), date, etc. os.system gives the

Re: Read/Write from/to a process

2005-10-25 Thread jas
Steve Holden wrote: Look at how you might do it in other languages. Then you'll realise this isn't (just) a Python problem. Yea your right. However, for example, in Java, one can use the Process class, and then read from the stream until its the end (i.e. -1 is returned). However, with Python

select.select() on windows

2005-10-25 Thread jas
I am currently using subprocess to execute a command. Then I read from it's stdout...however, this is hanging on a read..waiting for more bytes. So what I would like is to timeout...and select.selec() seems to be what I need. Except I don't have a socket, i have stdout. Any suggestions on how

Re: Redirect os.system output

2005-10-25 Thread jas
Paul Dale wrote: pexpect is POSIX compliant and works under Cygwin. I haven't tried it under pythonw. Well if I want my code to run on other computers, then they'd have to run it under Cygwin right? -- http://mail.python.org/mailman/listinfo/python-list

Client/Server socket send user input

2005-10-25 Thread jas
I have a basic client/server socket situation setupwhere the server accepts a connection and then waits for commands. On the client side, I create a socket, connect to the server...then I pass the socket to a class which just reads from the socket (in a thread). class Reader(Thread): def

Re: Read/Write from/to a process

2005-10-25 Thread jas
I have setup multiple threads and a queue...which is working pretty good. But I have one other issue...I have a new thread (since it is different issue) here: http://groups.google.com/group/comp.lang.python/browse_frm/thread/ec81d8982d1a0130 if you get chance, would you mind checking that out.

Re: Read/Write from/to a process

2005-10-25 Thread jas
I have setup multiple threads and a queue...which is working pretty good. But I have one other issue...I have a new thread (since it is different issue) here: http://groups.google.com/group/comp.lang.python/browse_frm/thread/ec81d8982d1a0130 if you get chance, would you mind checking that out.

Re: Client/Server socket send user input

2005-10-25 Thread jas
I even tried inserting a \r or \r\n or \n to stdout, also tried the same using msvcrt.putch() ...but no luck. I still have to hit enter to get the prompt , where I can then type a command and hit enter. For example, I get this displayed: [example] Microsoft Windows XP [Version 5.1.2600] (C)

Re: Redirect os.system output

2005-10-24 Thread jas
Any other ideas? or examples of using subprocess to do what I was asking? Kent Johnson wrote: jas wrote: I would like to redirect the output from os.system to a variable, but am having trouble. I tried using os.popen(..).read() ...but that doesn't give me exactly what i want. Here

Re: Redirect os.system output

2005-10-24 Thread jas
I see that, although I don't totall grasp the code. However, I am looking to basically emulate a command prompt. i.e. everything u see in the windows command prompt should be displayed back in python. How can I do it without files? Kent Johnson wrote: jas wrote: Any other ideas? or examples

Re: Redirect os.system output

2005-10-24 Thread jas
as an internal or external command, operable program or batch file. basically I was opening to send the ipconfig command to cmd.exe and store the result in the result variable. But you can see there was an error with result. Ideas? jas wrote: I see that, although I don't totall grasp the code

Re: Redirect os.system output

2005-10-24 Thread jas
doesn't sound to encouraging :) How about something with os.popen? in = os.popen(cmd, w) in.write(hostname) I tried this, and I get IOError: [Errno 22] Invalid Argument I am not sure why this isnt working. Steve Holden wrote: jas wrote: Ok, I tried this... C:\python Python 2.4.1 (#65

Read/Write from/to a process

2005-10-24 Thread jas
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen(cmd.exe, stdout=sp.PIPE) p.stdin.write(hostname\n) however, it doesn't seem to work. I think the cmd.exe is catching it. I also tried f =

Re: Redirect os.system output

2005-10-24 Thread jas
Kent, Yes, your example does work. So did os.popen...however, the problem is specific to cmd.exe. Have you tried that yet? Thanks! Kent Johnson wrote: jas wrote: Ok, I tried this... C:\python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type

Re: Read/Write from/to a process

2005-10-24 Thread jas
Thanks, that is certainly a start. As you mentioned, the cd could is an issue. Perhaps checking to see if the line ends with is sufficient? Dennis Lee Bieber wrote: On 24 Oct 2005 07:20:42 -0700, jas [EMAIL PROTECTED] declaimed the following in comp.lang.python: Hi, I would like

Re: Read/Write from/to a process

2005-10-24 Thread jas
actually, i can't check for only because if you a dir, a line can end with a but is not the end of the output jas wrote: Thanks, that is certainly a start. As you mentioned, the cd could is an issue. Perhaps checking to see if the line ends with is sufficient? Dennis Lee Bieber wrote

Re: Read/Write from/to a process

2005-10-24 Thread jas
What about having a thread which reads from subprocess.Popen()'s stdout...instead of read/write, read/write. just always read, and write when needed? any comments on that idea? jas wrote: actually, i can't check for only because if you a dir, a line can end with a but is not the end

Redirect os.system output

2005-10-21 Thread jas
I would like to redirect the output from os.system to a variable, but am having trouble. I tried using os.popen(..).read() ...but that doesn't give me exactly what i want. ..this is windows by the way. For example: tmp = os.popen(hostname).read() ...works as expected. however, tmp =