How to run the python script

hi
I got error with the python /usr/… path for python not found. I realized we need to install it with sudo.

from inside your vagrant run:
sudo apt-get install python-psutil

@ jumuma

If your original Vagrant installation completed successfully, you should not have to do this. You don’t mention which Python script you were attempting to run, but Python should be installed and accessible on your vm if everything went correctly. Did you try running python --version before running this command?

vagrant@m312:/shared$ ./write_to_the_same_document.py --port 30000
Traceback (most recent call last):
File “./write_to_the_same_document.py”, line 99, in
main()
File “./write_to_the_same_document.py”, line 85, in main
collection.drop() # Drop the collection to start fresh
File “/usr/local/lib/python2.7/dist-packages/pymongo/collection.py”, line 1103, in drop
dbo.drop_collection(self.__name, session=session)
File “/usr/local/lib/python2.7/dist-packages/pymongo/database.py”, line 914, in drop_collection
with self.__client._socket_for_writes(session) as sock_info:
File “/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py”, line 1267, in _socket_for_writes
server = self._select_server(writable_server_selector, session)
File “/usr/local/lib/python2.7/dist-packages/pymongo/mongo_client.py”, line 1254, in _select_server
server = topology.select_server(server_selector)
File “/usr/local/lib/python2.7/dist-packages/pymongo/topology.py”, line 231, in select_server
address))
File “/usr/local/lib/python2.7/dist-packages/pymongo/topology.py”, line 189, in select_servers
selector, server_timeout, address)
File “/usr/local/lib/python2.7/dist-packages/pymongo/topology.py”, line 205, in _select_servers_loop
self._error_message(selector))
pymongo.errors.ServerSelectionTimeoutError: No replica set members available for replica set name “m312RS”
vagrant@m312:/shared$ Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.

Hi @Dhamodharan_23277,

The possible reasons for this error can be:

  1. The localhost is not mapped to the correct IP 127.0.0.1. You can check the mapping in /etc/hosts file.
  2. Also, check that your M312rs replica set is up and the primary is available for the replica set.

Please check for the above mentioned points. Meanwhile, I will get back to you with more information on it.

Please let me know, if you have any question.

Thanks,
Sonali