Search code examples
pythonflaskmod-wsgiwerkzeug

ImportError: No module named types


I am getting below error when I start the httpd server and access the app url -

[Tue Feb 21 22:01:51 2017] [error] [client 10.209.33.139] mod_wsgi (pid=15425): Target WSGI script '/scratch/gdudwadk/python-projects/newblog/app/wsgi.py' cannot be loaded as Python module.
[Tue Feb 21 22:01:51 2017] [error] [client 10.209.33.139] mod_wsgi (pid=15425): Exception occurred processing WSGI script '/scratch/gdudwadk/python-projects/newblog/app/wsgi.py'.
[Tue Feb 21 22:01:51 2017] [error] Traceback (most recent call last):
[Tue Feb 21 22:01:51 2017] [error]   File "/scratch/gdudwadk/python-projects/newblog/app/wsgi.py", line 7, in <module>
[Tue Feb 21 22:01:51 2017] [error]     from app import app as application
[Tue Feb 21 22:01:51 2017] [error]   File "/scratch/gdudwadk/python-projects/newblog/app/app.py", line 1, in <module>
[Tue Feb 21 22:01:51 2017] [error]     from flask import Flask
[Tue Feb 21 22:01:51 2017] [error]   File "/scratch/gdudwadk/python-projects/newblog/venv/lib/python2.6/site-packages/flask/__init__.py", line 17, in <module>
[Tue Feb 21 22:01:51 2017] [error]     from werkzeug.exceptions import abort
[Tue Feb 21 22:01:51 2017] [error]   File "/scratch/gdudwadk/python-projects/newblog/venv/lib/python2.6/site-packages/werkzeug/__init__.py", line 17, in <module>
[Tue Feb 21 22:01:51 2017] [error]     from types import ModuleType
[Tue Feb 21 22:01:51 2017] [error] ImportError: No module named types

This started happening after my machine was replaced with new one. Previously app was working fine.


Solution

  • I found one reference to python2.7 in /etc/httpd/conf.d/wsgi.conf and that's what was causing the issue. After removing that, the app was up and running.. Thanks!