Archived

This forum has been archived. Please start a new discussion on GitHub.

Python Ice Parsing: Bug or User Error?

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

  • mes
    mes California
    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
  • Thanks for the quick response.

    Should I expect that this fix will make it into a future version of 3.2?
  • 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.