Python

AttributeError: module ‘selectors’ has no attribute ‘SelectSelector’

Usually, the error module x has no attribute y means that:

  1. Your working directory contains a x file, which collides with python’s x module
  2. You are running a python script from a directory (thereby making it your current working directory) where file x collides with python’s x module

In this case, I have a selectors.py file in the same folder as the script I’m running, and therefore, when python wants to import its own selectors module, it gets mine, and fails.

So, either:

  1. Rename your own file
  2. Use -m to run script as a module
  3. Move the script to another directory
Standard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.