Not sure why this hasn't been discovered yet, except perhaps no one uses the 'filename' kwarg. Fix is simple. In pyquery/pyquery.py:
155 156 if kwargs: 157 # specific case to get the dom 158 if 'filename' in kwargs: 159 - html = open(kwargs['filename']) 159 + html = open(kwargs['filename']).read() 160 elif 'url' in kwargs:.
Just needs that and a test to exercise this path in the constructor.