Ruby had all the mindshare and hype over Python back then. To me as a Python fan, it felt like Python had peaked and wasn't going to grow further.
Then Node came along and stole the bandwagon followers that had flocked to Rails. The Ruby community was mostly the Rails community, so this kinda capped the growth of Ruby.
Python though had lots of competing Web frameworks, and other use outside webdev incl core tooling for Linux distros etc. Ansible (and Salt to a lesser extent) came along and stole back share from Chef/Puppet. Less fashionable Python kept on trucking along and was well placed to pick up machine learning.