Tag: Python

  • SSL Certificates in Python 3.6

    Note to self: After installing Python 3.6 on your Mac, run /Applications/Python 3.6/Install Certificates.command so your SLL connections don’t fail.

    The error you might get, when this is the case, is:

    ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)

    Python 3.6 no longer links to the macOS-supplied SSL libraries and now includes its own copy of OpenSSL, but it doesn’t automatically install the root certificates needed to validate connections. It seems the Python 3.6 installer warns you about this during the install, but it’s easy to miss. It’s also in the README, and there’s a behavior bug for Python suggesting that it get installed automatically. Thanks to this Stack Overflow post for the help.

  • Django MultiRangeField and MultiRangeFormField

    I’m building a website, and needed a way to save a list of pages and page ranges from a book or magazine. I wanted to to be a little more strict than just saving it as a string without any cleanup or validation, so I wrote a custom Django model field (and accompanying form field).

    It either just validates and cleans so that

    4-33, 43, 45, 60-65, 44, 59

    becomes the tidy

    4-33, 43-45, 59-65

    …or, if you comment out the raising of the ValidationError in the form field’s validate() method, it will actually clean up any junk characters for you, so even this horrible mess:

    ;4-33, 46a fads i44 ,p45o

    gets cleaned to

    4-33, 44-46

    Enjoy!

  • Django

    I’ve been trying to decide how to best go about building a site for a personal project I’ve been working on for a while. I’ve tried building it with a wiki back-end — and used DokuWiki, which is the least annoying wiki software I’ve had the pleasure of using. However, I’ve come to the […]

    More

Mark Boszko

Film & Video Editor, Voiceover Artist, macOS IT Engineer, and Maker

Mark Boszko Avatar