Comment #23 on issue 1455 by pekka.klarck: Process.Start Process unable to execute command which change folder
http://code.google.com/p/robotframework/issues/detail?id=1455

Based on the example you sent (which I've so far only seen briefly on colleagues machine) the problem is that you are passing configuration arguments to the keyword via a list variable. That does not work because Robot, by design, only evaluates named argument syntax when a keyword is explicitly called like `name=value`.

If I understood it correctly, you had a user keyword that looked something like this:

    My Keyword
        [Arguments]    @{args}
        Start Process    command    @{args}

and you used it like:

    My Keyword    argument
    My Keyword    argument    shell=True

The latter one of these doesn't work as you expected. The end result is that Start Process is called like this:

    Start Process   command    argument    shell\=True

To make the keyword work correctly, you can to change it to this:

    My Keyword
        [Arguments]    ${shell}=True    @{args}
        Start Process    command    @{args}    shell=${shell}

Unfortunately that also means you need to always give ${shell} if you want to give @{args}:

    My Keyword    True    argument
    My Keyword    ${EMPTY}    argument

If you always want to use shell, or some other configuration parameter, it's obviously easier to change your keyword to this:

    My Keyword
        [Arguments]    @{args}
        Start Process    command    @{args}    shell=True

I hope that either one of the above solutions work for you.


Post scriptum:

The main reason for these problems is that Start Process uses Python's **kwargs syntax and there is no equivalent syntax with user keywords. Implementing something like that is far from trivial, because it would require as to add new variable type to represent dictionaries.

An easier solution that ought to work too is implementing Python 3 style keyword only arguments <http://www.python.org/dev/peps/pep-3102/>:

    My Keyword
        [Arguments]    @{args}    ${shell}=True
        Start Process    command    @{args}    shell=${shell}

This feature definitely won't make it to 2.8, though, as it is to be released tomorrow.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to