Question

I'm writing an application in Flask, that consists of two files, app.py and tags.py. app.py imports tags.py, which in turn contains from eyed3 import load. Eyed3 is a Python module to extract mp3 tags from files. For some reason import of Eyed3 suppresses Flask's console output. Usually when starting Flask with python app.py returns:

* Running on http://127.0.0.1:17000/

When Eyed3 is imported, this line doesn't appear. It doesn't matter, whether it is import eyed3 or from eyed3 import load, or if import is in app.py or tags.py, or Flask has debug mode on/off. I even tried to run

import sys
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__

just after import or before app.run(), no success. Why and how does mere import of a module hide console output? How can i restore it?

Edit: Order of import doesn't matter. Nothing happens, if i import Eyed3 before Flask, error still holds. Does it have to do with this line of code?

Was it helpful?

Solution

I'm willing to bet it has something to do with the logging manipulations that EyeD3 is doing in this file: https://bitbucket.org/nicfit/eyed3/src/97905ecfcd6c8f8df0349582b90258b154e583b5/src/eyed3/utils/log.py?at=default

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top