1

I'm coding a python script, to import data from aws s3 bucket. In some machines, it returns None type has no attribute get. While debugging pyathena, I have found that this error comes from a lambda expression in util.py file, in the following function:

def retry_api_call(func, config, logger=None, *args, **kwargs):
retry = tenacity.Retrying(
    retry=retry_if_exception(
        lambda e: getattr(e, "response", {}).get("Error", {}).get("Code", None)
        in config.exceptions
        if e
        else False
    ),
    stop=stop_after_attempt(config.attempt),
    wait=wait_exponential(
        multiplier=config.multiplier,
        max=config.max_delay,
        exp_base=config.exponential_base,
    ),
    after=after_log(logger, logger.level) if logger else None,
    reraise=True,
)
return retry(func, *args, **kwargs)

Anyone has some idea?

Thanks

  • if i had to guess its probably in the second get `.get("Code", None)` as the first might return `None`? – Ironkey Nov 11 '20 at 15:58
  • It's the internal module code, I didn't change It. However in some machines, It works but in others not, even using the same module versions. – Rodrigo Ferreira Nov 11 '20 at 16:22

0 Answers0