Failed to load resource: the server responded with a status of 429 (Too Many Requests) and 404 (Not Found) with ChromeDriver Chrome through Selenium

429 Too Many Requests The HTTP 429 Too Many Requests response status code indicates that the user has sent too many requests in a given amount of time (“rate limiting”). The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request. … Read more

Optimize Sieve of Eratosthenes Further

a slightly different approach: use a bitarray to represent the odd numbers 3,5,7,… saving some space compared to a list of booleans. this may save some space only and not help speedup… from bitarray import bitarray def index_to_number(i): return 2*i+3 def number_to_index(n): return (n-3)//2 LIMIT_NUMBER = 50 LIMIT_INDEX = number_to_index(LIMIT_NUMBER)+1 odd_primes = bitarray(LIMIT_INDEX) # index … Read more

selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed using ChromeDriver Chrome Selenium Python

This error message… selenium.common.exceptions.SessionNotCreatedException: Message: session not created from tab crashed (Session info: headless chrome=78.0.3904.108) …implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session. Analysis and Solution There are diverse solution to this issue. However as per UnknownError: session deleted because of page crash from tab crashed this … Read more

Run a python script in virtual environment from windows task scheduler

Create batch file with these commands: c:\__full_path_to_virtualenv__\Scripts\activate.bat && python __full_path_to_python_script__.py && means run command2 if command1 completed successfully. Then set that batch file as script to run. You don’t need to set any additional arguments in task scheduler (or you can set them in batch file anyway) and can set Start in if script has … Read more

TypeError: can’t pickle _thread.lock objects

I had the same problem with Pool() in Python 3.6.3. Error received: TypeError: can’t pickle _thread.RLock objects Let’s say we want to add some number num_to_add to each element of some list num_list in parallel. The code is schematically like this: class DataGenerator: def __init__(self, num_list, num_to_add) self.num_list = num_list # e.g. [4,2,5,7] self.num_to_add = … Read more

Error when executing `jupyter notebook` (No such file or directory)

It seems to me as though the installation has messed up somehow. Try running: # For Python 2 pip install –upgrade –force-reinstall –no-cache-dir jupyter # For Python 3 pip3 install –upgrade –force-reinstall –no-cache-dir jupyter This should reinstall everything from PyPi. This should solve the problem as I think running pip install “ipython[notebook]” messed things up.

How to install Anaconda on RaspBerry Pi 3 Model B

Installing Miniconda on Raspberry Pi and adding Python 3.5 / 3.6 Skip the first section if you have already installed Miniconda successfully. Installation of Miniconda on Raspberry Pi wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-armv7l.sh sudo md5sum Miniconda3-latest-Linux-armv7l.sh sudo /bin/bash Miniconda3-latest-Linux-armv7l.sh Accept the license agreement with yes When asked, change the install location: /home/pi/miniconda3 Do you wish the installer to … Read more

Sending selenium chrome instance to the background using Python

There is no programatic way to open in the Browser Client at the background or as a Background Process. Of coarse the alternative way is to use a Headless Browser and you can find a detailed discussion in Which drivers support “no-browser”/“headless” testing?. Why not possible? Software Test Automation is an art. Your Test Framework … Read more

urllib.error.URLError:

You should use urllib.parse.urlencode(), urllib.parse.urljoin(), etc functions to construct urls instead of manually joining the strings. It would take care of : -> %3A conversion e.g.: >>> import urllib.parse >>> urllib.parse.quote(‘:’) ‘%3A’