running spynner script on linux without x11

360 views Asked by At

I wrote script which collect some userful for me data from my accounts. I run it on windows and everything works ok. But I am not able to run it on linux (without gui).

I installed pyqt4, spynner and all necessary dependencies. The problem is:

object does not have attribute findfirstelement.

As I understand, qwebframe object not able to work with browser. I installed firefox and chromiumbafter that but it is not work. Had I install browser first? I run script inxvfb, as i haven't x11

xvfb-run python ...py

[UPD]

Traceback (most recent call last):
  File "ebay_reports_retriver.py", line 392, in <module>
    main()
  File "ebay_reports_retriver.py", line 375, in main
    downloadReportsFromPublishers.getReport()
  File "ebay_reports_retriver.py", line 228, in getReport
    downloadReportsFromPublishers.downloadReports(url,username,password, counter)
  File "ebay_reports_retriver.py", line 183, in downloadReports
    browser.wk_fill("input[type=text]", username)
  File "/usr/lib/python2.6/site-packages/spynner/browser.py", line 1158, in wk_fill
    element = self.webframe.findFirstElement(selector)
AttributeError: 'QWebFrame' object has no attribute 'findFirstElement'

rpm -qa | grep qt
qt-4.6.2-28.el6_5.x86_64
qt-sqlite-4.6.2-28.el6_5.x86_64
qt-x11-4.6.2-28.el6_5.x86_64
zlibrary-ui-qt-0.12.10-5.el6.x86_64
qtwebkit-2.1.1-1.el6.x86_64
qt-devel-4.6.2-28.el6_5.x86_64
qt-mobility-1.1.3-2.el6.x86_64

[UPD2]

Traceback (most recent call last):
  File "ebay_reports_retriver.py", line 2, in <module>
    import urllib , cookielib , spynner
  File "/opt/python27/lib/python2.7/site-packages/spynner/__init__.py", line 2, in <module>
    from .browser import *
  File "/opt/python27/lib/python2.7/site-packages/spynner/browser.py", line 52, in <module>
    from PyQt4 import QtCore
ImportError: /opt/python27/lib/python2.7/site-packages/PyQt4/QtCore.so: undefined symbol: PyUnicodeUCS4_FromUnicode
1

There are 1 answers

0
ekhumoro On BEST ANSWER

The findFirstElement function and the QWebElement classes were introduced in Qt-4.6.

However, PyQt versions don't always match the Qt ones, and so PyQt-4.6.2 only has support for Qt-4.5. The first version that supports Qt-4.6 is PyQt-4.7, which also adds support for the QWebElement classes.

So it looks like you just need to upgrade PyQt to 4.7 or greater.