I got the following error when installing the Google Cloud SDK on my Windows 10 computer:
ERROR: gcloud failed to load: 'ascii' codec can't decode byte 0xe1 in position 13: ordinal not in range(128)
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.calliope import cli
from googlecloudsdk.calliope import backend
from googlecloudsdk.calliope import parser_extensions
from googlecloudsdk.core.updater import update_manager
from googlecloudsdk.core.updater import installers
from googlecloudsdk.core.credentials import store
from googlecloudsdk.core.credentials import creds
from googlecloudsdk.core.credentials import devshell as c_devshell
from oauth2client import client
from oauth2client import crypt
from oauth2client import _openssl_crypt
from OpenSSL import crypto
from OpenSSL import crypto, SSL
from cryptography import x509
from cryptography.x509.base import (
from cryptography.x509.extensions import Extension, ExtensionType
from asn1crypto.keys import PublicKeyInfo
from ._elliptic_curve import (
from ._int import inverse_mod
from ._perf._big_num_ctypes import libcrypto
libcrypto_path = find_library('crypto')
fname = os.path.join(directory, name)
result_path = result_path + p_path
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 executable:
C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\python.exe
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
https://cloud.google.com/sdk/
Traceback (most recent call last):
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\\bin\bootstrapping\install.py", line 12, in <module>
import bootstrapping
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\bin\bootstrapping\bootstrapping.py", line 44, in <module>
from googlecloudsdk.core.credentials import store as c_store
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\googlecloudsdk\core\credentials\store.py", line 35, in <module>
from googlecloudsdk.core.credentials import creds
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\googlecloudsdk\core\credentials\creds.py", line 34, in <module>
from googlecloudsdk.core.credentials import devshell as c_devshell
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\googlecloudsdk\core\credentials\devshell.py", line 30, in <module>
from oauth2client import client
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\third_party\oauth2client\client.py", line 51, in <module>
from oauth2client import crypt
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\third_party\oauth2client\crypt.py", line 45, in <module>
from oauth2client import _openssl_crypt
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\lib\third_party\oauth2client\_openssl_crypt.py", line 16, in <module>
from OpenSSL import crypto
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\OpenSSL\crypto.py", line 12, in <module>
from cryptography import x509
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\__init__.py", line 9, in <module>
from cryptography.x509.base import (
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\base.py", line 16, in <module>
from cryptography.x509.extensions import Extension, ExtensionType
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\cryptography\x509\extensions.py", line 13, in <module>
from asn1crypto.keys import PublicKeyInfo
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\keys.py", line 22, in <module>
from ._elliptic_curve import (
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_elliptic_curve.py", line 51, in <module>
from ._int import inverse_mod
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_int.py", line 56, in <module>
from ._perf._big_num_ctypes import libcrypto
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\site-packages\asn1crypto\_perf\_big_num_ctypes.py", line 31, in <module>
libcrypto_path = find_library('crypto')
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\ctypes\util.py", line 53, in find_library
fname = os.path.join(directory, name)
File "C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 13: ordinal not in range(128)
Failed to install.
I have tried redownloading the installer, I run it with admin rights and I have choosen an install folder without any non-ascii characters or spaces.
I also verified that the installer set up the python successfully, more specifically I have Python version 2.7.13 at C:\AndroidSdk\CloudSdk\google-cloud-sdk\platform\bundledpython\python.exe
I also have tried to set the CLOUDSDK_PYTHON variable without success.
Note: I saw this question, but I have a different version (213.0.0) of the cloud-sdk and I didn't find the mentioned part in my code, so I don't think this is a duplicate question.
EDIT 1:
My ntpath.py line 63-90:
def join(path, *paths):
"""Join two or more pathname components, inserting "\\" as needed."""
result_drive, result_path = splitdrive(path)
for p in paths:
p_drive, p_path = splitdrive(p)
if p_path and p_path[0] in '\\/':
# Second path is absolute
if p_drive or not result_drive:
result_drive = p_drive
result_path = p_path
continue
elif p_drive and p_drive != result_drive:
if p_drive.lower() != result_drive.lower():
# Different drives => ignore the first path entirely
result_drive = p_drive
result_path = p_path
continue
# Same drive in different case
result_drive = p_drive
# Second path is relative to the first
if result_path and result_path[-1] not in '\\/':
result_path = result_path + '\\'
result_path = result_path + p_path #85
## add separator between UNC and non-absolute path
if (result_path and result_path[0] not in '\\/' and
result_drive and result_drive[-1:] != ':'):
return result_drive + sep + result_path
return result_drive + result_path
EDIT 2:
Thank you for your suggestions I have checked these SO questions and answers also, but I could not find a solution:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 13: ordinal not in range(128)
Bitbucket Pipelines: gcloud crashed (UnicodeDecodeError)
Note that I do not have any non-ascii characters in gcloud path, I have checked it with the following command: gci -recurse . | where {$_.Name -match "[^\u0000-\u007F]"}
Any other ideas how to fix?
Just a list of things to try:
install Python from https://www.python.org/downloads/release/python-2715/. Remember the location of the python binary. Set that as CLOUDSDK_PYTHON
Show the printout with the variable set.
Ensure that the variable is really set.
In C:\ (or C:\AndroidSdk, but optimally C:\): Run the gci command in https://superuser.com/questions/237533/find-files-with-non-ascii-characters-in-filenames-in-windows-xp, show the output. Or run the python program from that same question.
would be found by 4., but the 13th character seems to be the \. Try to re-create the directory, giving the AndroidSDK a shorter/longer name, see if it still is the 13th character
I just had the same problem and it took me a while to solve it, so here's my findings for posterity:
I had the npm package windows-build-tools installed (using npm install --global windows-build-tools), and that package apparently came with a separate Python installation in C:\Users\[my user]\.windows-build-tools which I had forgotten about. That folder was also in my PATH.
Now unfortunately my Windows user name contains non-ASCII characters. As far as I'm aware, there is no way for me to change this, as my user is tied to a MS account that my employer manages.
Despite me installing the SDK in a unproblematic location (D:\CloudSDK) and setting CLOUDSDK_PYTHON to another Python 2.7.15 installation, I kept getting the error described in the question, until I removed the windows build tools python installation plus every other trace of any previous Python installation I found and re-installed 2.7.15 cleanly. I then retried the Cloud SDK installation without the bundled Python and used my clean new one from PATH, which solved the problem.
Maybe this helps someone.
Same problem with non-ascii chars. I edited the cloud_env.bat in the install root folder (mine is C:\prg\GCP) and REMOVED appending the %PATH% (see below) - problem solved for install.
I also had to add this manual to the PATH after install:
C:\prg\GCP\google-cloud-sdk\bin;C:\prg\GCP\google-cloud-sdk\platform\bundledpython\;
AND update the USERPROFILE=C:\prg\GCP (mine contained non-ascii).
cloud_env.bat
ECHO OFF
CLS
REM SET PATH=C:\prg\GCP\google-cloud-sdk\bin;%PATH%;
SET PATH=C:\prg\GCP\google-cloud-sdk\bin;
cd C:\prg\GCP
ECHO Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of available commands.
ECHO ---
ECHO ON`
For me, window10,
it happen because the python 2.7 paths get found before the python 3.7,
I simply delete 2.7 PATH
and SET CLOUDSDK_PYTHON point to the 3.7 paths and it works.
Related
I have this very simple scapy program, which does a arp_ping to my subnet
from scapy.all import srp, Ether, ARP, conf
def arp_ping(subnet):
conf.verb = 1
answered, unanswered = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=subnet),timeout=2,verbose=False, inter=0.1)
return [rcv.sprintf(r"%Ether.src% - %ARP.psrc%") for snd, rcv in answered]
if __name__=="__main__":
subnet = '192.168.1.0/24'
for i in arp_ping(subnet):
print i
EDIT
After reinstalling atleast PyWin32 and WinPcap with choco I now have a this NameError:
Traceback (most recent call last):
File "arp_sender.py", line 1, in <module>
from scapy.all import srp, Ether, ARP, conf
File "C:\Python27\lib\site-packages\scapy\all.py", line 16, in <module>
from scapy.arch import *
File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 83, in <module>
from scapy.arch.windows import *
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 465, in <module>
conf.iface = get_working_if()
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 463, in get_working_if
return LOOPBACK_NAME
NameError: global name 'LOOPBACK_NAME' is not defined
Checking for depencies issue
Running scapy.bat to check for depencies results into this message:
INFO: Can't load Python libreadline or completer
INFO: Can't import matplotlib. Won't be able to plot.
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
WARNING: No match between your pcap and windows network interfaces found. You probably won't be able to send packets. Deactivating unneeded interfaces and restarting Scapy might help.Check your winpcap and powershell installation, and access rights.
INFO: Could not get readline console. Will not interpret ANSI color codes.
WARNING: No default IPv4 routes found. Your Windows release may no be supported and you have to enter your routes manually
Traceback (most recent call last):
File "C:\Python27\Scripts\\scapy", line 25, in <module>
interact()
File "C:\Python27\lib\site-packages\scapy\main.py", line 300, in interact
scapy_builtins = __import__("all",globals(),locals(),".").__dict__
File "C:\Python27\lib\site-packages\scapy\all.py", line 16, in <module>
from scapy.arch import *
File "C:\Python27\lib\site-packages\scapy\arch\__init__.py", line 83, in <module>
from scapy.arch.windows import *
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 465, in <module>
conf.iface = get_working_if()
File "C:\Python27\lib\site-packages\scapy\arch\windows\__init__.py", line 463, in get_working_if
return LOOPBACK_NAME
NameError: global name 'LOOPBACK_NAME' is not defined
My guess is that:
WARNING: No match between your pcap and windows network interfaces found. You probably won't be able to send packets. Deactivating unneeded interfaces and restarting Scapy might help.Check your winpcap and powershell installation, and access rights.
is causing the issue, but I'm unsure how to resolve this.
You are using an old scapy version, update it via
pip install scapy --upgrade to get 2.4.0
I can see that because recent versions do not need libreadline anymore
In the latest version, the only dependency you need to install is:
Winpcap or Npcap
IPython (if asked)
You may have run your Python code as non-administrator.
I just encountered the same problem when I used the PyCharm IDE, which was not opened in the administrator mode (by default).
After I restarted the IDE as the administrator, the error message was gone.
Similarly, when you want to use the scapy library in Linux, you have to specify "sudo ..."
I'm having trouble with using impyla library on windows
I installed impyla library
pip install impyla
Error occured when I tried to import impyla libary in python code
from impala.dbapi import connect # error occured
from impala.util import as_pandas
conn = connect(host='10.xx.xx.xx', database='xx_xx', port=21050)`
Traceback (most recent call last): ...
File "D:/test/test.py", line 14, in
from impala.dbapi import connect
File "C:\Anaconda3\lib\site-packages\impala\dbapi.py", line 28, in
import impala.hiveserver2 as hs2
File "C:\Anaconda3\lib\site-packages\impala\hiveserver2.py", line 32, in
from impala._thrift_api import (
File "C:\Anaconda3\lib\site-packages\impala_thrift_api.py", line 73, in
include_dirs=[thrift_dir])
File "C:\Anaconda3\lib\site-packages\thriftpy\parser__init__.py", line 30, in load
include_dir=include_dir)
File "C:\Anaconda3\lib\site-packages\thriftpy\parser\parser.py", line 496, in parse
url_scheme))
thriftpy.parser.exc.ThriftParserError: ThriftPy does not support generating module with path in protocol 'c'
when I tried to print include_dir, which was
D:/test\thrift
I just cannot import libray at all
help me
I had the same problem with thriftpy, the problem on windows is an absolute path is like C:\foo\bar.thrift
But, the way the thrift library parses the file, it detects the C: as if it were a protocol like http: or https:
Its pretty easy to workaround you just have to strip the first two characters from the path with a slice like path[2:]
Just slice when you call thriftpy.load or in the library file
File "C:\Anaconda3\lib\site-packages\thriftpy\parser__init__.py", line 30
path = "C:\foo\bar.thrift"
thrift.load(path[2:], module_name, include_dirs=include_dirs,
include_dir=include_dir)
OR
You can go a bit deeper and make the same change that I already submitted as a patch on the github page... perhaps it will be incorporated in the next version of thrift.
File "C:\Anaconda3\lib\site-packages\thriftpy\parser\parser.py", line 488
- if url_scheme == '':
+ if len(url_scheme) <= 1:
My justification of why this change is valid is in the pull request. If its incorporated then you wont have to worry about making the same change again when you update the library. If not then just strip the two characters again.
Update:
Thriftpy Version 1: the parser fix is now on line 547: elif len(url_scheme) <= 1:
Thriftpy Version 2: the fix has already been merged.
I was encountering the same error with impyla on an Anaconda Python 3.6 distribution on Windows. Instead of installing using pip, I was able to get it working using:
conda install -c anaconda impyla
https://anaconda.org/anaconda/impyla
When trying to install mysql-python on my Windows 10 machine i get the following error:
File "<string>", line 1, in <module>
File "C:\Users\LUCAFL~1\AppData\Local\Temp\pip-build-3u7aih0l\mysql-python\setup.py", line 21, in <module>
setuptools.setup(**metadata)
File "c:\program files (x86)\python35-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
...
File "c:\program files (x86)\python35-32\lib\subprocess.py", line 1055, in communicate
stdout = self.stdout.read()
File "c:\program files (x86)\python35-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1716: character maps to <undefined>
I tried installing other packages and received the same error on almost every one (one exception being pymysql). All of these packages were big and had dependencies. I guess that the big ones create temporary data in my user directories APPDATA folder. As you can see, the ü is not properly decoded (ü being byte 0x81). It's always a german umlaut that produces the error (mainly ü, as it's part of my user folders name).
I googled for the last 2 hours and found a lot of people having the same problem, but mostly they were opening github tickets or discussing the problem for Ubuntu/Fedora/OSX, etc. A couple times i read, that the standard encoding under windows is cp-1252 which causes the problem. Can i somehow force windows using my console to use utf-8 for this session and then run pip with that?
Please don't recommend me renaming my user folder. It's not easily done under Windows 10 and i dont want to re-install windows just because of python.
My setup: Windows 10, Python 3.5.1, pip 8.0.3
Can you try the following and see if it works. Replace path for python by your actual path.
I am not able to simulate on my windows laptop.
import sys
import subprocess
reload(sys) # Reload may do the trick!
sys.setdefaultencoding('UTF8')
theproc =subprocess.call(['C:\\Python27\\Scripts\\pip.exe', 'install', 'mysql-python'])
theproc.communicate()
Trying to create a Python application on ElasticBeanstalk using the CLI, after I select my platform version I get the following error:
Select a platform version.
1) Python 3.4
2) Python
3) Python 2.7
4) Python 3.4 (Preconfigured - Docker)
(default is 1): 1
ERROR: UnicodeDecodeError :: 'ascii' codec can't decode byte 0xe2 in position 891: ordinal not in range(128)
I found this: https://github.com/aws/aws-cli/issues/708 which makes me think maybe I pasted my AWS credentials with a newline attached. I'd like to re-enter the credentials but it seems they are cached somewhere (it asked me for them on the first install attempt but not any subsequence attempts). I do not see them in my environment vars and I have been deleting .elasticbeanstalk between attempts. Any ideas?
update: I deleted .aws/config so it allowed me to re-enter my credentials. Still get the same error when I try to run eb init
update2: gist of --debug output can be found here: https://gist.github.com/dshuhler/8d64849021c48bf1ba71
tldr; My .gitignore had a hidden non-ascii character as I had copy pasted a Python specific .gitignore from a popular Github repository.
Steps I took to figure out the root cause
So, I couldn't find any answer that helped me solve this problem for me. Looks like, different people are seeing this error for different reasons.
I'm going to share the steps I took to figure out the cause for my problem. Make sure to run your command using --debug flag
$ eb init --debug
My output was something like this
2019-05-05 13:44:17,548 (INFO) eb : Traceback (most recent call last):
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/core/ebrun.py", line 62, in run_app
app.run()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/foundation.py", line 797, in run
return_val = self.controller._dispatch()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/controller.py", line 472, in _dispatch
return func()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/cement/core/controller.py", line 478, in _dispatch
return func()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/core/abstractcontroller.py", line 89, in default
self.do_command()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/controllers/initialize.py", line 118, in do_command
initializeops.setup(app_name, region_name, platform, dir_path=None, repository=repository, branch=branch)
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/operations/initializeops.py", line 57, in setup
setup_ignore_file()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/operations/initializeops.py", line 92, in setup_ignore_file
source_control.set_up_ignore_file()
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/site-packages/ebcli/objects/sourcecontrol.py", line 294, in set_up_ignore_file
for line in f:
File "/Users/mudassirali/.virtualenvs/rtp_dev/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 1287: ordinal not in range(128)
I jumped into the source code, specifically this bit
for line in f:
I found out this is the part which was throwing the error
with open('.gitignore', 'r') as f:
for line in f:
if line.strip() == git_ignore[0]:
return
Once I removed the .gitignore it worked like charm(and added it later without copy-paste)
It could be that your Beanstalk runs the Python environment without LC_ALL defined. Setting LC_ALL=en_US.UTF-8 in my Beanstalk environment properties resolved this issue for me.
Some background on these locale environment variables is available at: Explain the effects of export LANG, LC_CTYPE, LC_ALL
your aws credentials are at ~/.aws/config
I have successfully installed Scrapy and all it's dependencies into Python.org 64 shell on a Windows Vista 64 bit platform. This is installed as Site Package. I have tested Scrapy works ok at a basic level by typing:
Import Scrapy
Into a Python Shell and got no errors. I've just got started with tutorials on how to use Scrapy. Most of these suggest setting up a new project using the following Command Prompt line:
C:\Python27>scrapy startproject myproject
However this throws up the error message in the title about Scrapy being an invalid command. I have tried amending my environment variables to allow me to use this command from any file location within Command Prompt. I have added the following to the end of my environment variables:
C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages\scrapy;C:\Python27\Scrapy
This does not seem to resolve the problem however as I still get the same error message. I have also tried running the 'scrapy startproject myproject' command from the following locations with Command Prompt:
C:\Python27
C:\Python27\Scripts
C:\Python27\Scrapy
This again still throws up the same error message. I feel like I am quite close to having the solution, but I just cant quite seem to make it work.
Can anyone spot where I am going wrong?
Thanks
EDIT:
In response to the last comment above from MattDMo, the command now works, however it now throws up the following error message, which I'm not even sure where to start with:
C:\Python27\Scripts>scrapy startprogram mrscript
Traceback (most recent call last):
File "c:\Python27\Scripts\scrapy", line 3, in <module>
from scrapy.cmdline import execute
File "c:\Python27\lib\site-packages\scrapy\cmdline.py", line 9, in <module>
from scrapy.crawler import CrawlerProcess
File "c:\Python27\lib\site-packages\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 50, 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 29, in <mod
ule>
from twisted.internet._newtls import (
File "c:\Python27\lib\site-packages\twisted\internet\_newtls.py", line 21, in
<module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
File "c:\Python27\lib\site-packages\twisted\protocols\tls.py", line 41, in <mo
dule>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError
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 4, in <module>
binding = Binding()
File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 87, in __init__
self._ensure_ffi_initialized()
File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\openssl\bindi
ng.py", line 106, in _ensure_ffi_initialized
libraries=libraries,
File "c:\Python27\lib\site-packages\cryptography\hazmat\bindings\utils.py", li
ne 80, in build_ffi
extra_link_args=extra_link_args,
File "c:\Python27\lib\site-packages\cffi\api.py", line 341, in verify
lib = self.verifier.load_library()
File "c:\Python27\lib\site-packages\cffi\verifier.py", line 75, in load_librar
y
return self._load_library()
File "c:\Python27\lib\site-packages\cffi\verifier.py", line 151, in _load_libr
ary
return self._vengine.load_library()
File "c:\Python27\lib\site-packages\cffi\vengine_cpy.py", line 138, in load_li
brary
raise ffiplatform.VerificationError(error)
cffi.ffiplatform.VerificationError: importing 'c:\\Python27\\lib\\site-packages\
\cryptography\\_Cryptography_cffi_444d7397xa22f8491.pyd': DLL load failed: The s
pecified module could not be found.
Is this actually an error log or just a standard print out? Also, could someone explain please why adding a .bat file to my Python scripts causes this to work?
Thanks
pip install scrapy installs a file called scrapy in Python's Scripts directory on Windows, the default location for which is C:\Python27\Scripts. However, C:\Python27\Scripts\scrapy is a Python file, even though it lacks the .py suffix. There are two ways of running it. My preferred method is to use the Git Shell, as scrapy has its executable bit set, and can be run without further ado.
The other method, if you want to keep using cmd.exe, is to make a batch file with the following contents:
#echo off
c:\Python27\python c:\Python27\Scripts\scrapy %*
Save it in the Scripts directory as scrapy.bat (assuming your PATH now includes C:\Python27;C:\Python27\Scripts), restart cmd.exe, and you should now be able to run it from the command line.
I experienced a similar problem (I'm using a virtual environment in Windows 7).
I noticed that for older versions of scrapy, e.g. pip install scrapy==0.18.4, it automatically creates a scrapy.bat in my virtual environment: {VENV_ROOT_FOLDER}\Scripts\scrapy.bat
But if I use the latest scrapy (currently version 0.24.2), the scrapy.bat is missing.
I wanted to use the latest scrapy version, so what I did is to put a copy of scrapy.bat to its Scripts folder and it solves the problem.