Python Ice Parsing: Bug or User Error?

jaejae John EisenmanOrganization: Orange SVProject: N/AMember
I'm using IcePy 3.1.1. I don't seem to be able to parse Ice arguments correctly.
After a call to parseCommandLineOptions, the return value (args) is always None. Is this user error, or a bug in Python Ice?

Example Code:
#!/usr/bin/python
import sys, Ice
class ParseTestClient(Ice.Application):
    def run(self, args):
        # read properties (file or command line)
        properties = self.communicator().getProperties()
        print args
        # Note: There appears to be a bug; args is None after the following!
        args = properties.parseCommandLineOptions("ParseTest", args)
        print args
        return(1)

app = ParseTestClient()
sys.exit(app.main(sys.argv, "CanonicClient.config"))

Example use:

% ./ParseTestClient.py --Ice.Default.Host=foo --ParseTest.One=bar --ParseTest.Two=car -cd bread

None

Comments

  • mesmes CaliforniaMark SpruiellOrganization: ZeroC, Inc.Project: Ice DeveloperAdministrators, ZeroC Staff ZeroC Staff
    Hi,

    You can fix this problem by making a simple change to ICE_HOME/python/Ice.py:
        def parseCommandLineOptions(self, prefix, options):
            return self._impl.parseCommandLineOptions(prefix, options)
    
        def parseIceCommandLineOptions(self, options):
            return self._impl.parseIceCommandLineOptions(options)
    
    These two functions were missing the return keyword.

    Thanks for reporting this bug.

    - Mark
  • jaejae John EisenmanOrganization: Orange SVProject: N/AMember
    Thanks for the quick response.

    Should I expect that this fix will make it into a future version of 3.2?
  • michimichi Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-)Member ✭✭✭
    jae wrote: »
    Should I expect that this fix will make it into a future version of 3.2?

    Yes. We always add bug fixes such as this to the next release as a matter of course.

    Cheers,

    Michi.
Sign In or Register to comment.