pklaus / brother_ql_web

A Python-based web service to print labels on Brother QL label printers. Based on brother_ql: https://github.com/pklaus/brother_ql
GNU General Public License v3.0
254 stars 124 forks source link

No handlers could be found for logger "brother_ql.devicedependent" #38

Open jwindleGitHub opened 2 years ago

jwindleGitHub commented 2 years ago

Got a new Raspberry Pi Zero, loaded the latest OS, loaded brother_ql_web and get this message: No handlers could be found for logger "brother_ql.devicedependent" Traceback (most recent call last): File "./brother_ql_web.py", line 28, in except FileNotFoundError as e: NameError: name 'FileNotFoundError' is not defined

Any suggestions?

larsfroelich commented 2 years ago

having the same issue

jwindleGitHub commented 2 years ago

I think that I found that although python3 was installed on my machine it needed to be linked to the python2 executable file in /usr/bin/python

FriedrichFroebel commented 1 year ago

There are two issues here: The logger error message from the issue title only occurs with Python < 3.2 (see https://docs.python.org/3/howto/logging.html#what-happens-if-no-configuration-is-provided).

For the FileNotFoundError part, the offending block is https://github.com/pklaus/brother_ql_web/blob/9e20b6dc3f80589bffc0b1036aa3f7122ea4af89/brother_ql_web.py#L25-L30 FileNotFoundError has not been defined in Python 2, while /usr/bin/python usually pointed to Python 2 in the past (at least until Ubuntu 20.04 if I am not mistaken). Running python3 brother_ql_web.py should have worked. As soon as the configuration file is available, the undefined FileNotFoundError exception class will not be an issue any more on Python 2 as well, due to the way Python handles such exceptions.