I am new to python programming and started trying to fool around with flask this morning. I installed flask using pip and it seemed to work as expected. However, when I went to the python shell and typed import flask
I got the following error:
>>> import flask
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/flask/__init__.py", line 17,
in <module>
from werkzeug.exceptions import abort
File "/usr/lib/python2.7/dist-packages/werkzeug/__init__.py", line
151, in <module>
__import__('werkzeug.exceptions')
File "/usr/lib/python2.7/dist-packages/werkzeug/exceptions.py", line
71, in <module>
from werkzeug.wrappers import Response
File "/usr/lib/python2.7/dist-packages/werkzeug/wrappers.py", line
27, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "/usr/lib/python2.7/dist-packages/werkzeug/http.py", line 23,
in <module>
from email.utils import parsedate_tz
File "/usr/lib/python2.7/email/utils.py", line 27, in <module>
import random
File "random.py", line 6, in <module>
print(random.randint(1, 101))
AttributeError: 'module' object has no attribute 'randint''
I uninstalled flask using pip and tried again. No change. I installed flask using apt, same problem I even tried it on python 2, same error message. the really weird part is that it is giving me errors from a python3 shell session I did earlier in the week - the import random for random.py part of the message at the very end. Why would it spit out messages that have nothing to do with the import flask message?
It made me think that maybe I should see if a reboot would help, but no luck there either.
How does one troubleshoot an issue like this? googling the error hasn't helped and I am running out of ideas.
Thanks in advance