krobertson/python-ernie

file descriptor error when running calc.py example

clofresh opened this issue · 1 comments

Trying to run the calc.py example on Mac OS X 10.6.2 with Python 2.6:

$ python calc.py 
Traceback (most recent call last):
  File "calc.py", line 27, in <module>
    start()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ernie/__init__.py", line 14, in start
    server.start()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ernie/ernie.py", line 56, in start
    input = os.fdopen(3)
OSError: [Errno 9] Bad file descriptor

You don't run the RPC services directly. They are called through the main ernie process. The ernie process then opens the file descriptors between it and the python process to communicate with.

You need to use a fork of the main ernie project that I have (http://github.com/krobertson/ernie/commits/master/) as it allows the handlers to be called directly rather than assuming they're all ruby.

Then you start it by calling:

ernie -h calc.py