queryman.py: fix file not found (reported by calcifea), make script compatible with Python 3.x