masood shaik <masood....@gmail.com> writes:

> Hi
>
>   I am trying to call python function from c code.The following
> program i got from the web source while i am trying to run this
> program it throws an segmentation fault.

Yes, the call to PyImport_Import fails and returns a NULL. You could use
the more complete example at
http://docs.python.org/extending/embedding.html which includes some
error handling...

Anyways, apparently PyImport_Import can't import from the current
working directory but with parameters like math sqrt 2 it returns the
square root of 2. Setting PYTHONPATH to point to the working directory
works for me, but I don't know if there's a more correct solution.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to