Skip to content

Flask : ModuleNotFoundError: No module named '*********' #496

@elder-easy-care

Description

@elder-easy-care

Hello,

I report an error I have (similar to this problem : #96).

I just try to import a personal module in my python file "wsgi_flask.py" with python 3 and I have its error in unit.log : ModuleNotFoundError: No module named 'JEEDOM'. I use python3.7.3.
Otherwise, If I try to import this personal module with python 2, it's working !

Details :

config_flask.json (for python 2) :
{
"listeners": {
"*:8282": {
"pass": "routes"
}
},

"routes": [
	{
		"match": {
			"uri": "/test",
			},
            "action": {
                "pass": "applications/flask_app"
            }
	},
],

"applications": {
    "flask_app": {
        "type": "python",
		"home": "/git/eec/APPLICATION/www/flask/venv",
		"path": "/git/eec/APPLICATION/www/flask",
		"module": "wsgi_flask",
		"processes": 1
    }
},

"access_log": "/var/log/access.log"

}

config_flask.json (for python 3) :
{
"listeners": {
"*:8282": {
"pass": "routes"
}
},

"routes": [
	{
		"match": {
			"uri": "/test",
			},
            "action": {
                "pass": "applications/flask_app"
            }
	},
],

"applications": {
    "flask_app": {
        "type": "python3",
		"home": "/git/eec/APPLICATION/www/flask/venv",
		"path": "/git/eec/APPLICATION/www/flask",
		"module": "wsgi_flask",
		"processes": 1
    }
},

"access_log": "/var/log/access.log"

}

wsgi_flask.py :

import json
from flask import Flask, jsonify, request
from JEEDOM.Class_MySQL_Jeedom import *
from Tools.Variables import *

app = Flask(name)

@app.route('/')
def test():
return 'TEST'

application = app

unit.log :

2020/11/16 23:20:54 [info] 27019#27019 "flask_app" application started
2020/11/16 23:20:54 [alert] 27019#27019 Python failed to import module "wsgi_flask"
Traceback (most recent call last):
File "/git/eec/APPLICATION/www/flask/wsgi_flask.py", line 5, in
from JEEDOM.Class_MySQL_Jeedom import *
ModuleNotFoundError: No module named 'JEEDOM'
2020/11/16 23:20:54 [notice] 14105#14105 process 27019 exited with code 1
2020/11/16 23:20:54 [warn] 14108#14108 failed to start application "flask_app"
2020/11/16 23:20:54 [alert] 14108#14108 failed to apply new conf

Like I said, with python 2 it's working and with python 3 no.
Do you have any ideas ?

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions