Search code examples
pythonpython-2.7scrapytwisted

Sudden error in python 2.7


I had installed python 2.7 which was working fine till today. Suddenly it closed with an application error which it failed to capture and now everytime while running it its throwing the below mentioned error.

To give you a brief background the RAM memmory reahed to 95% which might have led to initial python crashing

Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\lib\site-packages\scrapy-0.16.4-py2.7.egg\scrapy\cmdline.py"
, line 7, in <module>
    from scrapy.crawler import CrawlerProcess
  File "C:\Python27\lib\site-packages\scrapy-0.16.4-py2.7.egg\scrapy\crawler.py"
, line 3, in <module>
    from twisted.internet import reactor, defer
  File "C:\Python27\lib\site-packages\twisted\internet\reactor.py", line 38, in
<module>
    from twisted.internet import default
  File "C:\Python27\lib\site-packages\twisted\internet\default.py", line 56, in
<module>
    install = _getInstallFunction(platform)
  File "C:\Python27\lib\site-packages\twisted\internet\default.py", line 52, in
_getInstallFunction
    from twisted.internet.selectreactor import install
  File "C:\Python27\lib\site-packages\twisted\internet\selectreactor.py", line 1
8, in <module>
    from twisted.internet import posixbase
  File "C:\Python27\lib\site-packages\twisted\internet\posixbase.py", line 24, i
n <module>
    from twisted.internet import error, udp, tcp
  File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 73, in <mod
ule>
    from twisted.python.win32 import formatError as strerror
ImportError: cannot import name formatError

Solution

  • twisted module got corrupted due to the crash. Reinstalled the module and its working again.