天天看點

pexpect 'module' object has no attribute 'spawn'

pexpect 'module' object has no attribute 'spawn'

solutions:

 found some similar info in the google, advice was to move .py file to another folder. It didn't work for me. Another advice was to delete " pycache" folder (I've got same in my pexpect.py location), but it didn't work aswell. Errors are still the same, this folder are still created after running the script (trying, I mean). Any ideas?

You have called your file <code>pexpect.py</code>. You need to rename it to something else as you are importing from your file not the <code>pexpect</code> module. You also need to delete any <code>.pyc</code> in the same folder. It does not matter where you move your script, the current folder is still going to be in the path before where the actual pexpect module is.

本文轉自aaa超超aaa 51CTO部落格,原文連結:http://blog.51cto.com/10983441/1880497