Running Windmill from inside Python code

185 views
Skip to first unread message

diogobaeder

unread,
Nov 3, 2010, 1:22:21 AM11/3/10
to Windmill Developers
Hi there,

I'm reading more and more of the documentation and unit tests of the
project, but it's still not clear for me how I can use Windmill from
inside Python code, instead of a terminal.

I'd like to know two specific things:
1- How can I start a Windmill client, so that I can run commands
through it? I'm trying by using samples generated by saved scripts
(like using the WindmillTestClient), but it's still lacking
configuration in order to run manually;
2- How can I stop the client, I mean, close all the browser windows
that the client opens and terminate these processes?

Thank you, guys!

Diogo

Adam Christian

unread,
Nov 3, 2010, 2:52:19 AM11/3/10
to windmi...@googlegroups.com
Greetings,

This is how I last had it working:

> from windmill.authoring import setup_module, WindmillTestClient
>
> from windmill.conf import global_settings
>
> global_settings.START_FIREFOX = True
>
> import sys
>
> setup_module(sys.modules[__name__])
>
> x = WindmillTestClient(__name__)

x.close() should kill the browser.

Adam

> --
> You received this message because you are subscribed to the Google Groups "Windmill Developers" group.
> To post to this group, send email to windmi...@googlegroups.com.
> To unsubscribe from this group, send email to windmill-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/windmill-dev?hl=en.
>

diogobaeder

unread,
Nov 3, 2010, 2:01:43 PM11/3/10
to Windmill Developers
Thanks, Adam, that almost worked for me, if I didn't get stuck with
the client being instantiated.

Here's the line that's blocking Windmill from continuing execution:

windmill/authoring/__init__.py - line 184
Code excerpt:

for action in self._method_proxy.execute_command(

{'method':'commands.getControllerMethods','params':{}})['result']
['result']:

Regards,

Diogo

Adam Christian

unread,
Nov 3, 2010, 4:53:01 PM11/3/10
to windmi...@googlegroups.com
Interesting, this call should be happening after the UI is up so it can get all available methods.. it works with me -- what OS are you on?

Adam

diogobaeder

unread,
Nov 4, 2010, 2:41:37 PM11/4/10
to Windmill Developers
Hi, Adam,

That's the catch, then! I didn't know I had to start the UI before
instantiating the client...

How can I start it from my code?

My OS is Ubuntu 10.10 (64 bits at home, 32 bits at work).

Thanks!

Diogo

ahamilton

unread,
Nov 8, 2010, 11:37:29 AM11/8/10
to Windmill Developers
I am running Ubuntu 10.04 64-bit Desktop and I am trying to get
Windmill to launch from inside some pylons nose unit tests that I am
writing. I copied in the code from above, but I get the following
error:

http://pastie.org/1281946

I've only started working with Windmill today, but I absolutely love
it. I would really like to get this working so I can integrate it
into my pylons web app. Thanks!

diogobaeder

unread,
Nov 9, 2010, 1:26:50 PM11/9/10
to Windmill Developers
Did you set up Windmill with the current module?:

>>> setup_module(sys.modules[__name__])

Regards,

Diogo
Reply all
Reply to author
Forward
0 new messages