On Wed, Oct 24, 2012 at 8:01 AM, Doan Viet Dung <vietdung0181@yahoo.com> wrote:
Hi all,

My current project need both Java and Python. For data analysis, I base on Pandas (data analysis tools for the Python programming language : http://pandas.pydata.org/index.html). Then to fetch the results to my java application, I need to invoke some python classes. And I hope Jython will help me to do that.

My very first Hello World Java Jython example worked  fine. I can call a python class, script in my java application. Howerver when I started implement some methods that invoke the Pandas modules, the problems arrive. 

Traceback (most recent call last):
  File "src\main\python\script\Pandas.py", line 1, in <module>
    from pandas.io.data import DataReader
  File "C:\Python27\Lib\site-packages\pandas\__init__.py", line 7, in <module>
    import numpy as np
  File "C:\Python27\Lib\site-packages\numpy\__init__.py", line 131, in <module>
    from _import_tools import PackageLoader
  File "C:\Python27\Lib\site-packages\numpy\_import_tools.py", line 1, in <module>
    import os
  File "C:\Python27\lib\os.py", line 63, in <module>
    import ntpath as path
  File "C:\Python27\lib\ntpath.py", line 12, in <module>
    import warnings
  File "C:\Python27\lib\warnings.py", line 8, in <module>
    import types
  File "C:\Python27\lib\types.py", line 36, in <module>
    BufferType = buffer
NameError: name 'buffer' is not defined

After some Google searchs, I am learning that Jython does not allow access to most Python extensions. Am I in this case ?
You haven't run into the lack of C-extensions support (so far), but you have run into the fact that Jython does not support the buffer protocol so far. There may be some hope in the future 2.7 as Jeff Allen (a relatively new contributor to Jython) has been working feverishly to implement the internal buffer API for Jython, which is a prerequisite for the exposed buffer protocol that we are missing and that pandas needs. I wish I could give you a timeframe on when we can support the buffer protocol, but this area of development is too new to give good predictions.