[execnet-dev] how to remotely open a program on win box?

Mathieu Drapeau matdrapeau at gmail.com
Fri Jul 30 18:07:28 CEST 2010


Hi Charles,
I don't think it is the makegateway call that causes problems, I did try
bunch of different configuration without any help...
But the "source" variable seems weird. The way I understand it, it should be
a string and I should be able to output in the logs but everytime I try to
print its value, I get an error like this:

"RegisterEventSource/ReportEvent", the parameter is incorrect

Here is how I am trying to output the value of source:

try:
    servicemanager.LogErrorMsg("source = %s" % source)
except Exception as e:
    servicemanager.LogErrorMsg("error = %s" % e)

Any idea?

Thanks,
Mathieu

2010/7/29 Charles Solar <charlessolar at gmail.com>

> When I was debugging that script what I did was modify it so it was
> not a service, but just a little daemon that ran in a console.  Then I
> could put print commands in there and find out what was going on.
> Something I think you should try is instead of adding the
> "popen//python=", just add the python directory to your computers path
> and remove that line.  I dont know, but maybe running makegateway like
> that is opening a new python interactively, which would probably break
> the popen io connection.
> If that is all you changed then that is really all I can guess at what
> the problem might be.  If you add some print statements and find out
> what paths the service is taking when it fails I might be able to help
> some more.
>
> Charles
>
> On Thu, Jul 29, 2010 at 6:36 PM, Mathieu Drapeau <matdrapeau at gmail.com>
> wrote:
> > Yes I am currently using the other script and everything works fine.
> > Do you know how I can troubleshoot / debug your script?
> >
> > Thanks,
> > Mathieu
> >
> > 2010/7/29 Charles Solar <charlessolar at gmail.com>
> >>
> >> mm, well having a python window pop up is a bit suspicious.  Maybe the
> >> popen io is not connecting correctly.
> >> Maybe before trying the advanced process spawning service I wrote up,
> >> try the basic 1 python instance service that is in execnet's script
> >> directory.
> >>
> >> Charles
> >>
> >>
> >> On Thu, Jul 29, 2010 at 4:18 PM, Mathieu Drapeau <matdrapeau at gmail.com>
> >> wrote:
> >> > Hi Charles,
> >> >
> >> > In the source of your server script, I did change the makegateway
> >> > definition
> >> > to this:
> >> >
> >> > gw = execnet.makegateway("popen//pytho=C:\Python26\python.exe")
> >> >
> >> > When I connect to the server, a python box pop and when I try to send
> >> > basic
> >> > command to the server, I never receive any answers. The client just
> wait
> >> > for
> >> > something.
> >> > Here is what I tried:
> >> >     ch = gw.remote_exec("import os; channel.send(os.getcwd())")
> >> >     ch.receive()
> >> >
> >> > Do you know what could cause this problem?
> >> >
> >> > Thanks,
> >> > Mathieu
> >> >
> >> >
> >> > 2010/7/29 Mathieu Drapeau <matdrapeau at gmail.com>
> >> >>
> >> >> Hi Charles,
> >> >> I was able to install it finally, I needed to change the name of the
> >> >> file
> >> >> (which was socketserver.py and causes conflict).
> >> >>
> >> >> My problem now when I am trying to do a remote_exec, I am not able to
> >> >> debug what's happening in the background. Do you have an idea
> where/how
> >> >> I
> >> >> can see the trace?
> >> >>
> >> >> thanks,
> >> >> Mathieu
> >> >>
> >> >>
> >> >> 2010/7/29 Charles Solar <charlessolar at gmail.com>
> >> >>>
> >> >>> well, i would check the process list, see if pythonservice.exe is
> >> >>> running.  You may need to run it as admin if you are not.  Open
> >> >>> services.msc to make sure the service is actually installed ( named
> >> >>> 'python service' creatively enough).
> >> >>> If all that is working, then make sure you are connecting to it as a
> >> >>> socket gateway, not a ssh gateway.
> >> >>>
> >> >>> Another thing you may want to check, make sure you have the latest
> >> >>> version I posted which should have a class def for IOJoiner at the
> >> >>> top.  That version has a few improvements and should work better
> than
> >> >>> the first one i posted.
> >> >>> Also, there is a script in the execnet scripts folder called
> >> >>> socketservice.py or something which works similarly and might work
> >> >>> better for you.
> >> >>>
> >> >>> Charles
> >> >>>
> >> >>> On Thu, Jul 29, 2010 at 9:54 AM, Mathieu Drapeau
> >> >>> <matdrapeau at gmail.com>
> >> >>> wrote:
> >> >>> > Charles,
> >> >>> > Like you mentionned the problem was with sshd which didn't have
> the
> >> >>> > option
> >> >>> > to "interact with the desktop".
> >> >>> > This option could be enabled in the windows services panel.
> >> >>> > Unfortunately,
> >> >>> > this can only be done in Windows XP pre-SP! Since then Microsoft
> has
> >> >>> > disabled this option for security reasons.
> >> >>> >
> >> >>> > So, I decided to switch to a socket server. I did see the socket
> >> >>> > server
> >> >>> > script you posted but I am not able to make it work.
> >> >>> > I do install and start the server but I am not able to connect to
> >> >>> > it.
> >> >>> > Seems
> >> >>> > it is not running because when I try to stop it right after, it
> says
> >> >>> > the
> >> >>> > service has not been started.
> >> >>> >
> >> >>> > Do you have an updated version of your script? Do you have an idea
> >> >>> > why
> >> >>> > the
> >> >>> > script seems not to be running?
> >> >>> >
> >> >>> > thanks,
> >> >>> > Mathieu
> >> >>> >
> >> >>> > 2010/7/27 Charles Solar <charlessolar at gmail.com>
> >> >>> >>
> >> >>> >> I suspect that cygwin's sshd probably operates in non-interactive
> >> >>> >> mode.  Check the process list on the computer, does calc.exe show
> >> >>> >> up?
> >> >>> >> If so, it just means that sshd is indeed non-interactive which
> >> >>> >> means
> >> >>> >> it will not spawn graphical windows for logged in users.  There
> is
> >> >>> >> probably some way for it to do so, but it would be a cygwin
> thing,
> >> >>> >> not
> >> >>> >> execnet specificly =/
> >> >>> >>
> >> >>> >> Charles
> >> >>> >>
> >> >>> >> On Tue, Jul 27, 2010 at 4:36 PM, Mathieu Drapeau
> >> >>> >> <matdrapeau at gmail.com>
> >> >>> >> wrote:
> >> >>> >> > Hi,
> >> >>> >> > I am trying to connect to a windows box and execute a program
> >> >>> >> > which
> >> >>> >> > requires
> >> >>> >> > the display using execnet. The windows box has cygwin installed
> >> >>> >> > where
> >> >>> >> > sshd
> >> >>> >> > is running.
> >> >>> >> > Here is a small example of what I am trying to achieve.
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > # remote.py script which should open the windows calculator
> >> >>> >> > utility
> >> >>> >> > from subprocess import call
> >> >>> >> > if __name__ == '__channelexec__':
> >> >>> >> >     call(["calc"])
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > #code to run locally
> >> >>> >> > import execnet, remote
> >> >>> >> > gw = execnet.makegateway("ssh=%s" % WINBOX_IP)
> >> >>> >> > ch = gw.remote_exec (remote)
> >> >>> >> > ch.waitclose ()
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > Looking on the screen of my windows box, I don't see any
> >> >>> >> > calculator
> >> >>> >> > program!
> >> >>> >> > Is it expected?
> >> >>> >> >
> >> >>> >> > Thanks,
> >> >>> >> > Mathieu
> >> >>> >> >
> >> >>> >> > _______________________________________________
> >> >>> >> > execnet-dev mailing list
> >> >>> >> > execnet-dev at codespeak.net
> >> >>> >> > http://codespeak.net/mailman/listinfo/execnet-dev
> >> >>> >> >
> >> >>> >> >
> >> >>> >
> >> >>> >
> >> >>
> >> >
> >> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/execnet-dev/attachments/20100730/565b1dfa/attachment.html>


More information about the execnet-dev mailing list