0

pyapns appears to be the most popular push notification package for python. However, it does not appear to work on a mac running mountain lion. I am using a mac for development.

https://github.com/samuraisam/pyapns

pyapns is an APNS provider that you install on your server and access through XML-RPC. To install you will need Python, Twisted and pyOpenSSL. It's also recommended to install python-epoll for best performance (if epoll is not available, like on Mac OS X, you may want to use another library, like py-kqueue). If you like easy_install try (it should take care of the dependancies for you):

I try to install pyapns in my virtualen on my mac, and python-epoll sure enough does not work. The paragraph above states that you can install py-kqueue, which I have by typing in: pip install py-kqueue. No errors. But when I try to start up the server using the line: twistd -r epoll web --class=pyapns.server.APNSServer --port=7077

I received this error:

...  bin/twistd: The specified reactor cannot be used, failed with error: cannot import name epoll.
See the list of available reactors with --help-reactors

Is there any hope to set up a python apns server on a mac? Thanks!

4

1 回答 1

4

解决方法有两个:

  1. 如果您使用的是 virtualenv,请确保您已激活它,以便将第 2 步的包安装在您的 virtualenv 中,而不是系统的 python 中。
  2. 点安装 py-kqueue
  3. 当你想启动 pyapns 时,用 kqueue 代替 epoll,如下所示: epoll 在 Mac 上不存在。

    twistd -r kqueue web --class=pyapns.server.APNSServer --port=7077

于 2013-08-13T15:19:18.697 回答