2

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?

Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166
  • That is bizarre isnt it. I can replicate it with minimal code, just to reassure you you're not on your own. sys.stdout looks sane just before app.run() as far as I can tell, and going through the code that executes at import time doesn't reveal the offender yet – DazWorrall Feb 21 '13 at 11:59
  • What happens if you import eyed3 *before* you import Flask? – Sean Vieira Feb 22 '13 at 03:30

1 Answers1

2

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

aezell
  • 1,532
  • 14
  • 17