George Opritescu

Developer from somewhere

twisted debugging

Problem: had to work with some defer.Deferred and defer.DeferredList() with scrapy, and started to receive this kind of errors: twisted.internet.defer.AlreadyCalledError

Solution: this seems promising, add it after you import defer from twisted.internet

defer.setDebugging(True)
Read More

scrapy get html from selector

Problem: need to access the html for a selector

Solution: found here:

from lxml import etree
etree.tostring(selector._root)
Read More

scrapy unicode utf-8

Problem: want to write unicode strings encoded as utf-8 when exporting scrapy items.

Solution:

  • found here
  • add the following setting in your settings.py:
FEED_EXPORT_ENCODING = 'utf-8'
Read More

redux form inputs not updating

Problem: had some fields in a form, and they were not updating.

Solution: The name of the redux reducer was passed to combineReducers in a wrong way. Problem is also discussed here

Read More

chromedriver logs from python

Problem: wanted to see why chrome might fail to start.

Solution: specify a logging file when building your driver object:

driver = webdriver.Chrome(service_args=["--verbose", "--log-path=/tmp/your.log"])
Read More

pyconfig.h no such file or directory

Problem: received this error: pyconfig.h: No such file or directory

Solution:

  • install with yum the following
yum -y install python-devel python-lxml
Read More

cannot get automation extension

Problem: received this error message cannot get automation extension

Solution: upgrade chromedriver.

Read More

javascript find element at coordinates

Problem: given X,Y coordinates, find the element in the DOM at that position.

Solution:

  • use document.elementFromPoint(647,17)
Read More

tslint Error Cannot find module './test/parse'

Problem: Received this error: Error: Cannot find module ‘./test/parse’

Solution:

  • it was caused by me having a .yarnclean
  • remove it, delete node_modules, run yarn again
Read More

angular1 controllerAs with ngRoute

Problem: want to use controller as with ngRoute

Solution:

$routeProvider
    .when('/somePath', {
        template: htmlTemplate,
        controller: 'myController as ctrl'
    });
Read More