4

I'm trying to get started with the Ghost.py headless browser on a Mac. I installed Ghost.py and its dependencies using these links/commands:

  1. Qt 5.0.1 for Mac, has a GUI installer
  2. PySide 1.1.0, which requires Qt Version >= 4.7.4, has a GUI installer
  3. sudo pip install Ghost.py

I launched Python, and confirmed that I can import PySide. However, when I do from ghost import Ghost, it fails to find PySide:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/__init__.py", line 1, in <module>
    from ghost import Ghost
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ghost/ghost.py", line 28, in <module>
    raise Exception("Ghost.py requires PySide or PyQt")
Exception: Ghost.py requires PySide or PyQt

By doing import PySide; print PySide;, it appears that PySide is installed here on my system: /Library/Python/2.7/site-packages/PySide. So, appended the PYTHONPATH like this:
export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages #for PySide.

However, Ghost.py still cannot find PySide.

How can I convince Ghost.py to find my installation of PySide?


Environment:

  • Mac OS X 10.7.5
  • Python 2.7
  • Qt 5.0.1
  • PySide 1.1.0
solvingPuzzles
  • 8,541
  • 16
  • 69
  • 112
  • 1
    Try making a Python file with just `from ghost import Ghost` in it. Then try running that under `pdb` like `python -m pdb import-ghost.py`. Then step through it seeing if you can find what particular `import` statement within `ghost.py` fails. – icktoofay Feb 24 '13 at 00:51
  • Aha, it fails when trying to do `from PySide import QtWebKit`. It looks like the real problem is that PySide's WebKit wrapper can't find a suitable QtWebKit binary on my system. I'm seeing if I can find the appropriate path for QtWebKit now. – solvingPuzzles Feb 24 '13 at 01:11
  • 4
    I installed `Qt 4.8` (instead of `Qt 5.0.1`) from [this link](http://qt-project.org/downloads), and PySide started working properly. – solvingPuzzles Feb 24 '13 at 01:36
  • Im getting the same error and I have installed Qt 4.8.5 from the same link but to no effect. – Sasha Aug 06 '13 at 09:12

1 Answers1

2

I faced the exact same problem but managed to fix it. Here is how:

  1. Uninstall the current installation of PySide and qt on your system. Make sure PySide is not present in /Library/Python/2.7/site-packages.
  2. Install qt and PySide from http://qt-project.org/wiki/PySide_Binaries_MacOSX.

PS: My system is running 10.9 (Mavericks) but I think it should work in 10.7 (Mountain Lion) as well.

iamas
  • 311
  • 2
  • 7