lib

Python urllib2 > HTTP Proxy > HTTPS request

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This work fine: import urllib2 opener = urllib2.build_opener( urllib2.HTTPHandler(), urllib2.HTTPSHandler(), urllib2.ProxyHandler({'http': 'http://user:pass@proxy:3128'})) urllib2.install_opener(opener) print urllib2.urlopen('http://www.google.com').read() But, if http change to https : ... print urllib2.urlopen('https://www.google.com').read() There are errors: Traceback (most recent call last): File "D:\Temp\6\tmp.py", line 13, in print urllib2.urlopen('https://www.google.com').read() File "C:\Python26\lib\urllib2.py", line 124, in urlopen

import matplotlib.pyplot gives ImportError: dlopen(…) Library not loaded libpng15.15.dylib

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am aware that this exact same question has been asked before. I did follow the instructions given in the answer there, and it didn't solve my problem (and I don't have enough reputation to just comment on the Q or A in that thread). Anyway, here's what's going on: I try to do: import matplotlib.pyplot And in return I get: Traceback (most recent call last): File "/Users/russellrichie/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3032, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File " ", line

ImportError: No module named tweepy

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed pip in a virtual environment. It installed without errors. Here's what I get when I run sudo pip install tweepy after activating the venv: Requirement already satisfied (use --upgrade to upgrade): tweepy in /usr/local/lib/python2.7/dist-packages/tweepy-3.1.0-py2.7.egg Requirement already satisfied (use --upgrade to upgrade): requests==2.4.3 in /usr/local/lib/python2.7/dist-packages/requests-2.4.3-py2.7.egg (from tweepy) Requirement already satisfied (use --upgrade to upgrade): requests-oauthlib==0.4.1 in /usr/local/lib/python2.7

Python: ImportError: /usr/local/lib/python2.7/lib-dynload/_io.so: undefined symbol: PyUnicodeUCS2_Replace

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to build a triviol Python script that will grab data from URL and save it onto the server. Concider the below code: #!/usr/bin/python import pprint import json import urllib2 def getUSGS_json(): print "Fetch data from URL" fileName = 'data/usgsEarthquacks_12Hrs.json' url = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson' data = urllib2.urlopen(url).read() if data: try: with open(fileName) as jsonGetData: filePut = open(fileName, 'w+') #add data filePut.write(data) filePut.close() j = json.load

“No module named _scproxy” on OSX

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm on OSX 10.6 with pre-installed python 2.6 and would like to install python packages via easy_install or setup.py (in a downloaded package). In my case I'm trying to install MySQLdb. In both cases I get a stack trace which ends like so: ... File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/command/easy_install.py", line 21, in <module> from setuptools.package_index import PackageIndex, parse_bdist_wininst File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools

Compiling muPDF lib in Eclipse “cannot unlink `NUL': Invalid argument Android NDK” Error

匿名 (未验证) 提交于 2019-12-03 01:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to compile the muPDF lib in Eclipse on Windows 7. I'm following these steps . On this step Build the native code libraries : ~ /src/ mupdf / platform / android $ ndk - build I'm getting this error. Qadir Hussain@GENETECH042 ~ /mupdf/ platform / android ( master ) $ ndk - build "C:/Program Files (x86)/Git/bin/rm.exe" : cannot unlink `NUL': Invalid argument Android NDK: WARNING:jni/Android.mk:mupdfcore: LOCAL_LDLIBS is always ignored fo r static libraries 0 [main] rm 4244 stdio_init: couldn't make stderr distinct from

uWSGI can not load libssl.1.0.0.dylib

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I call uwsgi , it always shows the following: dyld: Library not loaded: libssl.1.0.0.dylib Referenced from: /Users/xingshi/anaconda/bin/uwsgi Reason: image not found Trace/BPT trap: 5 Here is all the libssl.1.0.0.dylib on my Mac: $ locate libssl.1.0.0.dylib /Library/PostgreSQL/9.2/lib/libssl.1.0.0.dylib /Library/PostgreSQL/9.2/pgAdmin3.app/Contents/Frameworks/libssl.1.0.0.dylib /Users/xingshi/anaconda/lib/libssl.1.0.0.dylib /Users/xingshi/anaconda/pkgs/openssl-1.0.1c-0/lib/libssl.1.0.0.dylib /opt/local/lib/libssl.1.0.0.dylib And my

Can&#039;t save matplotlib animation

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to get a simple animation saved using ffmpeg. I followed a tutorial to install ffmpeg, and I can now access it from the command prompt. Now I run this piece of code: import numpy as np from matplotlib import pyplot as plt from matplotlib import animation fig = plt.figure() ax = plt.axes(xlim=(0, 2), ylim=(-2, 2)) line, = ax.plot([], [], lw=2) def init(): line.set_data([], []) return line, def animate(i): x = np.linspace(0, 2, 1000) y = np.sin(2 * np.pi * (x - 0.01 * i)) line.set_data(x, y) return line, anim = animation

Running Cython in Windows x64 - fatal error C1083: Cannot open include file: &#039;basetsd.h&#039;: No such file or directory

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been trying to install Cython for Python 2.7 on my Window 7 system. In particular, I prefer everything in 64 bits. (In case you wonder, I need Cython because Cython is one of the components I need for another package for some specialized numerical analysis. And x64 is potentially an advantage for storage of large data sets.) So I downloaded the x64 Python 2.7 from the official website. Got Cython from Christoph Gohlke . The amd64 version for Python 2.7 of course. Before I installed, I added Python 2.7 into the registry with the .reg

OperationalError: (2001, “Can&#039;t create UNIX socket (24)”)

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using django-1.2 and python-2.6 and I am using mysql server. After working for a while - selecting and updating records, I got this error: Exception in thread Thread-269: Traceback (most recent call last): File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner File "dispatcher.py", line 42, in run File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 80, in __len__ File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 271, in iterator File "/usr/lib/python2.6/site-packages/django/db