Reputation: 10229
I am learning Scrapy, from Scrapy's docs http://doc.scrapy.org/en/1.0/intro/overview.html I input
scrapy runspider stackoverflow_spider.py -o top-stackoverflow-questions.json
and cmd prompt
ImportError: DLL load failed: %1 is not a valid Win32 application.
Details:
C:\Users\jiahao>scrapy runspider stackoverflow_spider.py -o top-stackoverflow-qu
estions.json
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\Scripts\scrapy.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\scrapy\cmdline.py", line 122, in execute
cmds = _get_commands_dict(settings, inproject)
File "c:\python27\lib\site-packages\scrapy\cmdline.py", line 46, in _get_comma
nds_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "c:\python27\lib\site-packages\scrapy\cmdline.py", line 29, in _get_comma
nds_from_module
for cmd in _iter_command_classes(module):
File "c:\python27\lib\site-packages\scrapy\cmdline.py", line 20, in _iter_comm
and_classes
for module in walk_modules(module_name):
File "c:\python27\lib\site-packages\scrapy\utils\misc.py", line 71, in walk_mo
dules
submod = import_module(fullpath)
File "c:\python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "c:\python27\lib\site-packages\scrapy\commands\version.py", line 6, in <m
odule>
import OpenSSL
File "c:\python27\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "c:\python27\lib\site-packages\OpenSSL\rand.py", line 11, in <module>
from OpenSSL._util import (
File "c:\python27\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "c:\python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: %1 is not a valid Win32 application.
Upvotes: 1
Views: 4179
Reputation: 338
Using cryptography version 38.0.4
did the trick!
pip install cryptography==38.0.4
Upvotes: 0
Reputation: 630
I, too, recently had this problem with OpenSSL on Windows, and in addition to the suggestion of installing pre-packaged library files from https://slproweb.com/products/Win32OpenSSL.html, I also needed to reinstall cryptography
.
pip install -I cryptography
Upvotes: 4
Reputation: 1
I had the same problem. I download and install Win64OpenSSL_Light-1_0_2h and it worked.
Upvotes: 0