Menu ▾ ▴

Error message conundrum

2009-04-20
2013-03-15
  • James Garrison

    James Garrison - 2009-04-20

    Consider:

    import config
       .
       .
       .
            if vars(config).has_key('unzip') and config.unzip != "":
                if not os.path.exists(config.unzip):
                    self.logger.die("unzip program not found at %s" % config.unzip)
                self.unzip = config.unzip 
            else:
                .
                .
                .

    References to config.unzip are flagged as errors, but they really aren't.  This is a fundamental problem with trying to statically check dynamic languages.

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-04-21

      Well, yes, there are some cases where there's no real way to know about that.

      Currently, the ways to deal with that are:

      1. Actually declare things in the module so that the analyzer can find those (e.g.: in the config module, declare the unzip as a variable)

      2. Put a comment on that line to silent the error (Just press Ctrl+1 in the line that has the error and an option will be presented for that)

      3. Silent all the import errors in the preferences

      4. If it's a class, you can put "@DynamicAttrs" in the docstring and it'll know that no errors should be raised from having that (maybe the same could be done for modules -- what do you think?)

      Cheers,

      Fabio