On Sat, Feb 24, 2018 at 12:41 AM, Larry Martell <larry.mart...@gmail.com> wrote:
> On Fri, Feb 23, 2018 at 8:34 AM, Chris Angelico <ros...@gmail.com> wrote:
>> On Sat, Feb 24, 2018 at 12:08 AM, Larry Martell <larry.mart...@gmail.com> 
>> wrote:
>>> On Fri, Feb 23, 2018 at 2:01 AM, dieter <die...@handshake.de> wrote:
>>>> Larry Martell <larry.mart...@gmail.com> writes:
>>>>> ...
>>>>> I had 2.2.1. I updated requests to 2.18.4 and now when I import atws I 
>>>>> get:
>>>>> No handlers could be found for logger "atws.connection"
>>>> This is a warning (only), telling you that the "atws" package wants
>>>> to log a message but there is not corresponding logging handler
>>>> defined -- likely because you did not configure Python's logging
>>>> infrastructure (--> "logging" package in Python's standard documentation).
>>> Yes, but this message comes from the import, which happens before any
>>> of my code runs.
>> It's perfectly legal to put other code before an import:
>> import logging
>> logging.basicConfig(...)
>> import atws
>> But this is just a warning, so it's not that big a deal either way.
> Yes, I know it's legal, but I've always thought it was bad form.

Most of the time, yes, you do all your imports at the top. But when
you need to configure something before you import it, this is the best
and simplest way to do it. Just try to keep it clean and simple, and
you'll be fine.


Reply via email to