Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError : cannot import name '_win32stdio'

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.

Error in CMD

like image 760
Sagar Raj Singh Avatar asked May 20 '16 09:05

Sagar Raj Singh


People also ask

Can not import name Python?

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.

What is Import error in Python?

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.


2 Answers

Scrapy can work with Python 3 on windows if you make some minor adjustments:

  1. 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

  2. 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.

like image 164
xaav Avatar answered Sep 20 '22 20:09

xaav


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

like image 42
Srivardhan Cholkar Avatar answered Sep 19 '22 20:09

Srivardhan Cholkar