I am working with Scrapy framework to scrap out data from website, but getting the following error in command prompt:
ImportError: cannot import name '_win32stdio'
Traceback is attached as a screenshot.
Kindly revert if require directory structure of my program's directory.
This error generally occurs when a class cannot be imported due to one of the following reasons: The imported class is in a circular dependency. The imported class is unavailable or was not created. The imported class name is misspelled.
In Python, ImportError occurs when the Python program tries to import module which does not exist in the private table. This exception can be avoided using exception handling using try and except blocks. We also saw examples of how the ImportError occurs and how it is handled.
Scrapy can work with Python 3 on windows if you make some minor adjustments:
Copy the _win32stdio and _pollingfile to the appropriate directory under site-packages. Namely, twisted-dir\internet. Download these from https://github.com/twisted/twisted/tree/trunk/twisted/internet
pip install pypiwin32
Granted, this is based on my personal experience. Because the repository will certainly change in the future, readers should beware the age of this answer.
Update: the twisted-win
package is no longer required because the appropriate files are now included in the twisted
package.
I have gone through the same. I have resolved by updating the twisted package
pip install --upgrade twisted
or pip uninstall twisted
and pip install twisted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With