jeanphix/Ghost.py

pyqt ghost sip

zhangbowei opened this issue · 3 comments

Pouring pyqt-4.11.4.yosemite.bottle.1.tar.gz
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'getusersitepackages'
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'getusersitepackages'
==> Caveats
Phonon support is broken.

Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p

echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> homebrew.pth

And In my OS X:

Using pyqt-4.11.4; sip-4.16.9; python virtualenv,virtualenvwrapper.

So I'm installing it in virtualenv (workon "some")

And when I run the test:

from ghost import Ghost
ghost = Ghost()
page, extra_resources = ghost.open("http://xiaorui.cc")

assert page.http_status==200 and 'xiaorui' in ghost.content

I get:
raise Exception("Ghost.py requires PySide or PyQt4")

Exception: Ghost.py requires PySide or PyQt4

What should I do?

aorzh commented

@zhangbowei , did you has some luck with this?

sorry, I hasn't use it for a long time.

Hopefully brew recipe now no longer fails installing PyQt4 or PySide. In any case, I ran the following code on my machine (not a mac unfortunately), with no problem:

import logging

from ghost import Ghost

logging.basicConfig(level=logging.DEBUG)
ghost = Ghost()

with ghost.start() as session:
    page, extra_resources = session.open("http://xiaorui.cc", timeout=300)

Feel free to re-open if you still encounter this issue.