Python script not executing (No module named APNSWrapper) -
in terminal run command:
python pnot.py next error: traceback (most recent phone call last): file "pnot.py", line 1, in <module> apnswrapper import * importerror: no module named apnswrapper i have tried install module:
pip install apnswrapper==0.6.1 requirement satisfied (use --upgrade upgrade): apnswrapper==0.6.1 in /library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages requirement satisfied (use --upgrade upgrade): docutils>=0.3 in /library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages (from apnswrapper==0.6.1) cleaning up... i have tried install apns:
pip install apns i next error:
downloading/unpacking apns downloading apns-1.1.2.tar.gz running setup.py egg_info bundle apns installing collected packages: apns running setup.py install apns error: /library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages/__pycache__/apns.cpython-33.pyc: permission denied finish output command /library/frameworks/python.framework/versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/t/pip_build_samiesyed/apns/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/t/pip-3yfn_n-record/install-record.txt --single-version-externally-managed: running install running build running build_py creating build creating build/lib copying apns.py -> build/lib running install_lib copying build/lib/apns.py -> /library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages byte-compiling /library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages/apns.py apns.cpython-33.pyc error: /library/frameworks/python.framework/versions/3.3/lib/python3.3/site-packages/__pycache__/apns.cpython-33.pyc: permission denied ---------------------------------------- cleaning up... command /library/frameworks/python.framework/versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/t/pip_build_samiesyed/apns/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/t/pip-3yfn_n-record/install-record.txt --single-version-externally-managed failed error code 1 in /private/var/folders/8g/6w73vzqs04b6f1cq8m8pyswc0000gn/t/pip_build_s/apns storing finish log in /users/s/.pip/pip.log script code:
from apnswrapper import * wrapper = apnsnotificationwrapper('cert.pem', true) token in ['xxxxxxx']: token = binascii.unhexlify(token) apn = apnsnotification() apn.token(token) alert = apnsalert() alert.body('hello world') apn.alert(alert) apn.sound() wrapper.append(apn) wrapper.notify() this frustrating me, not sure why script not executing.
most pip , python point different python installations. 1 might bundle manager, 1 might scheme defaults.
you can find out doing commands
which python
which pip
probably pip installs packages against other python installation trying use.
the solution problem, no matter how has manifested itself, utilize virtualenv environments python bundle installations. virtualenv creates self-contained folder containing python interpreter , bundle installations, can wipe clean , rebuild in case of problems.
first install virtualenv.
then do:
virtualenv venv # create virtualenv installation in folder called venv source venv/bin/activate # modify shell , path utilize python venv/bin/python pip install apns # installs apns in venv/lib python pnot.py # runs script using venv/bin/python interpreter # , packages installed in venv/lib/python2.7 more info python , virtualenv installations
http://opensourcehacker.com/2012/09/16/recommended-way-for-sudo-free-installation-of-python-software-with-virtualenv/ python
No comments:
Post a Comment