raman325 / broadlink-rm-rest

Python based REST server to interact with Broadlink RM IR/RF blasters
MIT License
12 stars 5 forks source link

Error when the engine starts #7

Closed Coday-meric closed 3 years ago

Coday-meric commented 3 years ago

Hello, thanks you so mutch for your excellent work !!

But I cannot start the server, i am getting this error, i am not using docker is it serious ?

`[2021-01-26 18:06:31 +0100] [2204] [INFO] Starting gunicorn 20.0.4 [2021-01-26 18:06:31 +0100] [2204] [INFO] Listening at: http://0.0.0.0:8000 (2204) [2021-01-26 18:06:31 +0100] [2204] [INFO] Using worker: sync [2021-01-26 18:06:31 +0100] [2207] [INFO] Booting worker with pid: 2207 [2021-01-26 18:06:34 +0100] [2207] [ERROR] Exception in worker process Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 3129, in execute_sql cursor.execute(sql, params or ()) sqlite3.OperationalError: no such table: command

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker worker.init_process() File "/usr/local/lib/python3.7/dist-packages/gunicorn/workers/base.py", line 119, in init_process self.load_wsgi() File "/usr/local/lib/python3.7/dist-packages/gunicorn/workers/base.py", line 144, in load_wsgi self.wsgi = self.app.wsgi() File "/usr/local/lib/python3.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() File "/usr/local/lib/python3.7/dist-packages/gunicorn/app/wsgiapp.py", line 49, in load return self.load_wsgiapp() File "/usr/local/lib/python3.7/dist-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp return util.import_app(self.app_uri) File "/usr/local/lib/python3.7/dist-packages/gunicorn/util.py", line 358, in import_app mod = importlib.import_module(module) File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/home/pi/broadlink-rm-rest/app/app.py", line 358, in for command in command_db.Command.select(): File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 6850, in iter self.execute() File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 1898, in inner return method(self, database, *args, *kwargs) File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 1969, in execute return self._execute(database) File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 2141, in _execute cursor = database.execute(self) File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 3142, in execute return self.execute_sql(sql, params, commit=commit) File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 3136, in execute_sql self.commit() File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 2902, in exit reraise(new_type, new_type(exc_value, exc_args), traceback) File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 185, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.7/dist-packages/peewee.py", line 3129, in execute_sql cursor.execute(sql, params or ()) peewee.OperationalError: no such table: command [2021-01-26 18:06:34 +0100] [2207] [INFO] Worker exiting (pid: 2207) [2021-01-26 18:06:35 +0100] [2204] [INFO] Shutting down: Master [2021-01-26 18:06:35 +0100] [2204] [INFO] Reason: Worker failed to boot.`

raman325 commented 3 years ago

hi @Bosseur31 does the folder that you are running the application from have the data folder? It appears that peewee is not creating the DB files before trying to run operations on it which is what makes me think it's a lack of a data folder. The application should be able to create the DB files if they don't exist but I don't think I added any handling to ensure that the data folder exists

raman325 commented 3 years ago

actually, I just found a bug and pushed a fix, can you try again? The above statement about needing a data folder still holds true but I definitely broke something in my last update

Coday-meric commented 3 years ago

I do that now, Thanks for you réactivuty

Coday-meric commented 3 years ago

Your patch works great

pi@raspberrypi:~/broadlink-rm-rest/app $ gunicorn -b 0.0.0.0:8000 app:app [2021-01-26 22:34:34 +0100] [1033] [INFO] Starting gunicorn 20.0.4 [2021-01-26 22:34:34 +0100] [1033] [INFO] Listening at: http://0.0.0.0:8000 (1033) [2021-01-26 22:34:34 +0100] [1033] [INFO] Using worker: sync [2021-01-26 22:34:34 +0100] [1036] [INFO] Booting worker with pid: 1036 [2021-01-26 22:34:44 +0100] [1033] [INFO] Handling signal: winch [2021-01-26 22:34:48 +0100] [1033] [INFO] Handling signal: winch

raman325 commented 3 years ago

Great!