"Luke Dunstan" <[EMAIL PROTECTED]> writes:
> I sometimes use interactive commands, but usually through a program called
> ActiveSync Remote Display which is like Remote Desktop.
Ok, I've downloaded the Windows Mobile Power toys. Maybe there's
something useful in it.
> Other times I do double-click on scripts, and it is possible (but
> inconvenient) to see the error messages by switching to the Python
> window.
Ah, I see. Could the error window be made smaller and moveable so that
one could move it around to see the actual traceback?
> I have been planning on creating some tools to help this process but
> maybe you've already done that?
>
> Your script would be appreciated.
I've attached it. There are two issues with it:
First, you have to set the PC's IP address in the client.py script.
For me, 127.0.0.1 did *not* seem to work.
Second, you must start the server.py script on the PC before starting
the client.py script on the pocket device. I was not able to start the
connection from the pocket device, although that would seem more logical.
Thomas
# Thomas Heller 20060109
# Run this on the Pocket_PC, *after* starting server.py on the PC
import sys, socket, code, time
try:
HOST = '192.168.0.236' # The remote host
PORT = 20000 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
def readfunc(prompt=""):
if prompt:
sys.stderr.write(prompt)
try:
data = s.recv(1024)
except EOFError:
s.close()
sys.stderr._output.write(data[:-1])
sys.stderr._output.write("\n")
return data[:-1]
class Output(object):
def __init__(self, output):
self._output = output
def write(self, text):
self._output.write(text)
s.send(text)
sys.stdout = Output(sys.stdout)
sys.stderr = Output(sys.stderr)
## sys.ps1 = "Pocket_PC >>> "
## sys.ps2 = "Pocket_PC ... "
banner = "Python %s on %s\n(Remote Console)" % (sys.version, sys.platform)
# Replace the builtin raw_input (which doesn't work on CE anyway),
# to make pdb work.
import __builtin__
__builtin__.raw_input = readfunc
code.interact(banner=banner, readfunc=readfunc)
except SystemExit:
raise
except:
import traceback
traceback.print_exc()
time.sleep(5)
# Thomas Heller 20060109
# Start this script on the PC, then start client.py on the Pocket PC.
import socket, sys, threading
HOST = '' # Symbolic name meaning the local host
PORT = 20000 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
def get_input():
while 1:
data = raw_input()
conn.send(data + '\n')
t = threading.Thread(target=get_input)
t.setDaemon(True)
t.start()
while 1:
data = conn.recv(1024)
if not data:
print "SystemExit, hit return to end."
raise SystemExit
sys.stderr.write(data)
_______________________________________________
PythonCE mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pythonce