Expected type '{__iter__}', got 'None' instead (?!)

Answered

Hello!

 

I'm having a pretty hard time eliminating these warnings from my code, but the latest puts the cherry. I have the following:

 

(path, contents) = ('bin', os.listdir('bin')) if os.path.exists('bin') else (None, None)

if path is not None:
    validate_path(path, contents) 



In validate path, I get this warning stating that path is none. How on earth could it be None if there's an explicit check that it's NOT none. What could I do to eliminate this warning? I got no response elsewhere... Oh btw the code works correctly so I guess this 

Thank you!

0
1 comment

Hello,

Is it full code? I don't get any warnings with it.

 

0

Please sign in to leave a comment.