I found a discussion on this topic on Stackoverflow, where someone else had the same problem.
I'm posting a link to the python docs thy post references below. I didn't want to paste a link to the post itself (I know people have security concerns) so I'm pasting images below that get to the "good parts" of the post. The first is a description of the problem, the second the suggested solution:
Issue from link:
Solution from link: