strohne / Facepager

Facepager was made for fetching public available data from YouTube, Twitter and other websites on the basis of APIs and webscraping.
https://github.com/strohne/Facepager/releases
506 stars 198 forks source link

"Long" encoding error drops randomly #26

Closed dorvak closed 10 years ago

dorvak commented 10 years ago

The following error seems to drop randomly:

2014-05-05 13:44:17,226 ERROR:'long' object has no attribute 'encode'
Traceback (most recent call last):
  File "N:\src\facepager\src\apithread.py", line 112, in run
    self.module.fetchData(job['data'], job['options'], streamingData)
  File "N:\src\facepager\src\apimodules.py", line 561, in fetchData
    urlpath, urlparams = self.getURL(urlpath, options["params"], nodedata)
  File "N:\src\facepager\src\apimodules.py", line 110, in getURL
    urlparams[name] = value.encode("utf-8")

This looks like an issue with long numbers (f.e. the Twitter Tweet ID) and the QParamEdit Class (BTW: We should not name our own classes like QAnyName, as it suggests that it is an official QT-Class) and the .getcurrentText()-Method. Although it returns unicode by default, at some point a conversion to long or int might have happened randomly.

Not reproducible, all entries in the ParamEdit seem to be unicode strings

strohne commented 10 years ago

I guess this comes from the response data via getDictValue (https://github.com/strohne/Facepager/blob/master/src/apimodules.py#L101), when the json parser returns integers. Not the QParamEdit. See my last commit for a first try to fix it.