This is because the ARGS option value contains spaces.   You need to 
indicate the beginning and end of a value that contains spaces either by 
surrounding the value in double quotes or, when using a Python script, you 
should use the wrapData method that STAF provides as talked about in 
section "4.1.4 Function wrapData" in the STAF Python User's Guide at 
http://staf.sourceforge.net/current/STAFPython.htm#Header_wrapData.  For 
example:

    args = "{'machName': 'local', 'commandname': 'hostname'}"
    command = 'EXECUTE FILE /usr/local/staf/getfiles ARGS %s' % (
wrapData(args))

For more information about how to specify option values that contain 
spaces or quotes, see section "7.2 Option Value Formats" in the STAF 
User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDROVFORM 
which says:

7.2 Option Value Formats
Values for options may be specified in one of three ways. 

1.      If the value contains no spaces or quotes, you may simply specify 
the value. For example, 
MESSAGE Hello

2.      You may enclose the value in quotes. When doing so, the backslash 
character is the escape character. Any character after the backslash is 
treated as a literal character. To specify a backslash, use two 
backslashes. For example, 

MESSAGE "Hello World"
specifies the message Hello World 
MESSAGE "He said, \"What is that\""
specifies the message He said, "What is that" 
MESSAGE "c:\\MyApp\\Some directory with spaces"
specifies the message c:\MyApp\Some directory with spaces 

3.      You may use a length delimited format that is of the form 
:<Length>:<String>. Note that the length is specified in characters, not 
bytes. For example, 

MESSAGE :11:Hello World
specifies the message Hello World 
MESSAGE :23:He said, "What is that"
specifies the message He said, "What is that" 
MESSAGE :35:c:\MyApp\Some directory with spaces
specifies the message c:\MyApp\Some directory with spaces 
The first two formats are most appropriate when using the STAF command 
line. The third is most appropriate and easiest from within programs using 
one of the supplied "wrapData" functions. 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   babmis <bab...@outlook.com>
To:     staf-users@lists.sourceforge.net, 
Date:   09/02/2013 12:11 PM
Subject:        [staf-users] Error while runnng stax exec file with args 
from    python script



Hi ,
I am getting following error while trying to execute stax exec file from 
python script. Here is the debugger output. Can any please help me to 
get rid of this.


(Pdb) command="EXECUTE FILE /usr/local/staf/getfiles ARGS {'machName': 
'local','commandname':'hostname'}"

(Pdb) p host
'local'
(Pdb) p service
'STAX'
(Pdb)
(Pdb) result = self.handle.submit( host,service,command )
(Pdb) pp result.__dict__
{'rc': 7,
  'result': "You may have no more than 0 argument(s).  You specified 1 
argument(s).  The first excess argument is, 
'local','commandname':'hostname'}.",
  'resultContext': You may have no more than 0 argument(s).  You 
specified 1 argument(s).  The first excess argument is, 
'local','commandname':'hostname'}.,
  'resultObj': "You may have no more than 0 argument(s).  You specified 
1 argument(s).  The first excess argument is, 
'local','commandname':'hostname'}."}


Thanks.



------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft 
technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk

_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to