1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python: TCC command line parsing removes '=' equal sign characters

Discussion in 'Support' started by J.R. Heisey, May 24, 2016.

Tags:
  1. J.R. Heisey

    Joined:
    Nov 8, 2012
    Messages:
    3
    Likes Received:
    0
    When I use an equals signs in a command line parameter to a python script it use the equal sign as white space.

    #test.py
    import sys

    print("arg count=%u" %len(sys.argv))
    print("sys.argv[0]=%s" %sys.argv[0])
    print("sys.argv[1]=%s" %sys.argv[1])
    if len(sys.argv) >= 3:
    print("sys.argv[2]=%s" %sys.argv[2])
    else:
    print("no value in sys.argv[2]")


    The output results for CMD and TCC 13 or 14.

    [c:\]ver

    TCC LE 13.04.63 Windows 7 [Version 6.1.7601]

    [c:\]python e:\temp\test.py --path=c:\temp
    arg count=3
    sys.argv[0]=e:\temp\test.py
    sys.argv[1]=--path
    sys.argv[2]=c:\temp

    [c:\]cmd
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    c:\>python e:\temp\test.py --path=c:\temp
    arg count=2
    sys.argv[0]=e:\temp\test.py
    sys.argv[1]=--path=c:\temp
    no value in sys.argv[2]


    This makes writing command line parsing very difficult.
    Can I report this as a bug?

    J.R. Heisey
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,888
    Likes Received:
    30
    I don't know if it's a bug or not, but you might get around it by escaping the "=".
    Code:
    python e:\temp\test.py --path^=c:\temp
    or, if python can deal with it, quote the second arg.
    Code:
    python e:\temp\test.py "--path=c:\temp"
    Not having python, I can't test it.
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,809
    Likes Received:
    82
    Please post TCC/LE issues in the TCC/LE forum. This forum is for Take Command and TCC.
     
  4. charles_perrin

    Joined:
    Nov 7, 2015
    Messages:
    9
    Likes Received:
    0
    See CMDBatchDelimiters in TCMD.INI. (Not sure about LE though).
     
  5. J.R. Heisey

    Joined:
    Nov 8, 2012
    Messages:
    3
    Likes Received:
    0
    CMDBatchDelimiters=no has corrected the issue even on LE. Thanks Charles.
    The Python script is invoked by a make based software build system used by a hundred developers so I cannot change parameters. I am the only one who uses TCC.
    1. I could not find any documentation on this in the help file when using the keyword search for 'equal sign parameter delimiter'. OK now that I know what to look for the keywords 'argument delimiter' does show this topic.
    2. Searching for CMDBatchDelimiters does find the topic. I see the statement (Note: this will break CMD compatibility!) when set to 'no' which is not my experience on Windows 7 64 bit.
    3. The name CMDBatchDelimiters is confusing.
    I would have expected something like EqualSignAsCommandLineDelimiter
    I used to have paid licenses starting with 4DOS then 4NT for a while.
    Now that was a long time ago. ;)
     

Share This Page