Search code examples
pythonmacosmacportspolling

Can't use select.poll in OS X and already have MacPort installed


so the title pretty much says it all, I couldn't run a project which used elect.poll(), since this is for college, I must use select.poll() and cannot switch it for kqueue, so I read in this post that I could use MacPorts to work around it, so I did and it worked, but apparently after closing that terminal now I can't use it again, it keeps saying: AttributeError: 'module' object has no attribute 'poll'.

I don't understand why it only worked once, I've modified the paths file to have opt/local/bin and opt/local/sbin I have selected the macports version of python, does anyone have an answer? Thank you very much and I will provide any extra information if needed.


Solution

  • Do you have any file named "select.py", "select.pyc", "select.pyo"? If there are, and you try to "import select", Python would be trying to recursively import that file instead of the standard library.

    To solve this, you must rename your script to something else and to make sure you remove any automatically-created .pyc or .pyo files.