Search code examples
pythonframeworksmasonite

Masonite - craft new command throws module 'urllib' has no attribute 'urlopen' error


I'm trying to use the Masonite framework and I just installed the masonite-cli package and whenever I run craft new, an Attribute Error - module 'urllib' has no attribute 'urlopen' is thrown. My base Python version is 2.7 but I have 3.6 installed.


Solution

  • Although this error is a little ambiguous, this is may seem like it is being thrown because of an incorrect Python version but the base craft commands are designed to be run on Python 2 and Python 3.

    With that being said, this error is likely because of an SSL certificate error since Python 3.6 doesn't come with certificates. You can read more about fixing this error here: urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error

    but the solution to this is to just run: /Applications/Python\ 3.6/Install\ Certificates.command