1

I am trying to access google-analytics data using python. I successfully get data when I run the script from console. But when I try to call script.main() function from a Django view, I get an error:

CryptoUnavailableError at /
No crypto library available

I tried different solutions, building and installing Crypto but no lucks

My setup:

Mac XOS 10.10.5

python -V 2.7.10

pip freeze

altgraph==0.10.2
awscli==1.3.8
bcdoc==0.12.2
bdist-mpkg==0.5.0
bonjour-py==0.3
botocore==0.42.0
cffi==1.4.2
colorama==0.2.5
cryptography==1.1.2
Django==1.9
docutils==0.11
enum34==1.1.2
google-api-python-client==1.4.2
httplib2==0.9.2
idna==2.0
ipaddress==1.0.15
jmespath==0.4.0
macholib==1.5.1
matplotlib==1.3.1
modulegraph==0.10.4
numpy==1.8.0rc1
oauth2client==1.5.2
psycopg2==2.6.1
py2app==0.7.3
pyasn1==0.1.9
pyasn1-modules==0.0.8
pycparser==2.14
pycrypto==2.6.1
pyobjc-core==2.5.1
pyobjc-framework-Accounts==2.5.1
pyobjc-framework-AddressBook==2.5.1
pyobjc-framework-AppleScriptKit==2.5.1
pyobjc-framework-AppleScriptObjC==2.5.1
pyobjc-framework-Automator==2.5.1
pyobjc-framework-CFNetwork==2.5.1
pyobjc-framework-Cocoa==2.5.1
pyobjc-framework-Collaboration==2.5.1
pyobjc-framework-CoreData==2.5.1
pyobjc-framework-CoreLocation==2.5.1
pyobjc-framework-CoreText==2.5.1
pyobjc-framework-DictionaryServices==2.5.1
pyobjc-framework-EventKit==2.5.1
pyobjc-framework-ExceptionHandling==2.5.1
pyobjc-framework-FSEvents==2.5.1
pyobjc-framework-InputMethodKit==2.5.1
pyobjc-framework-InstallerPlugins==2.5.1
pyobjc-framework-InstantMessage==2.5.1
pyobjc-framework-LatentSemanticMapping==2.5.1
pyobjc-framework-LaunchServices==2.5.1
pyobjc-framework-Message==2.5.1
pyobjc-framework-OpenDirectory==2.5.1
pyobjc-framework-PreferencePanes==2.5.1
pyobjc-framework-PubSub==2.5.1
pyobjc-framework-QTKit==2.5.1
pyobjc-framework-Quartz==2.5.1
pyobjc-framework-ScreenSaver==2.5.1
pyobjc-framework-ScriptingBridge==2.5.1
pyobjc-framework-SearchKit==2.5.1
pyobjc-framework-ServiceManagement==2.5.1
pyobjc-framework-Social==2.5.1
pyobjc-framework-SyncServices==2.5.1
pyobjc-framework-SystemConfiguration==2.5.1
pyobjc-framework-WebKit==2.5.1
pyOpenSSL==0.15.1
pyparsing==2.0.1
python-dateutil==2.2
pytz==2013.7
rsa==3.2.3
scipy==0.13.0b1
simplejson==3.8.1
six==1.10.0
Twisted==13.2.0
uritemplate==0.6
vboxapi==1.0
virtualenv==13.1.2
wheel==0.26.0
xattr==0.6.4
zope.interface==4.1.1
Community
  • 1
  • 1
PeaceDefener
  • 618
  • 2
  • 8
  • 22
  • Have you tried all the solutions in the answers? – TheGeorgeous Dec 28 '15 at 07:02
  • @TheGeorgeous, yes, except for `app.yml` one cuz it is specific for GoogleAppEngine? I see Crypto installed in `/Library/Python/2.7/site-packages` folder. Plus it is weird that the authentication works fine when I solely run the script on console but not on Django app – PeaceDefener Dec 28 '15 at 07:26

1 Answers1

1

Alright... it was my Mac OS environment issue.

I had to run unset SSL_CERT_FILE on my terminal and solved the problem.

PeaceDefener
  • 618
  • 2
  • 8
  • 22