[py] | I am trying to execute a batch script on a remote computer. | | The batch script looks like: | | @echo off | start c:\python24\python.exe c:\a_script.py | | | Here's the setup: | Computer A (my computer), Computer B (the remote computer). | | So I map "W:" to Computer B and then copy the batch script to Computer | B. Then from within Python on Computer A I run: | import subprocess | subprocess.Popen("W:\\foo.bat") | | However, when it runs it says it can't find c:\a_script.py. It seems | to be trying to look | at Computer A, not Computer B. How can I do this?
You're confusing a couple of things here. One is a drive mapping, which presents the *filesystem* of a remote computer as though it were local. The other is a remote procedure call, which presents the *processor* (and environment etc.) of a remote computer as though it were local. What you're doing has the effect of running a remote *file* on a local *processor*. You could run a remote script -- on the *remote* processor -- under vanilla Windows using WMI, and possibly using some other DCOM-based technology, such as WSH. But you'd run into some security / environment issues depending on just what your remote script was trying to do. You could also -- if you were prepared to invest in some more software infrastructure -- employ Pyro (http://pyro.sf.net), Corba, XML-RPC or any one of several other RPC-type technologies. Are you even more confused now than you were when I started? ;) TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list