I'm using macOS Sierra. When importing builtwith
I get these following error:
Daniels-MacBook-Pro:~ Daniel$ python
Python 3.5.2 |Anaconda 4.2.0 (x86_64)| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import builtwith
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/danielotero/anaconda3/lib/python3.5/site-packages/builtwith/__init__.py", line 43
except Exception, e:
^
SyntaxError: invalid syntax
What I can do to import it correctly?
According to the module's issue tracker, it is not compatible with Python 3. The project owner says
Since they don't appear to want to port it to Python 3 in order to remain backwards compatible, you should either use Python 2, look for another library, or attempt to port it yourself.
This is because the
builtwith
package you installed is developed by Python2, not Python3. So it usesprint
andException
as Python2 does. It also uses urllib2 library which is seperated into two part of urllib library in Python3.It's better to use Python2 (Python2.7) to finish the work or you have to modify the source code of
builtwith
, that is, change allprint
statement intoprint()
function, changeexcept Exception, e
intoexcept Exception as e
, and change allurllib2
functions into functions inurllib.requests
andurllib.error
.