The problem is that the apache-poi package you probably installed via yum:
is implemented as Java jar files:
rpm -ql apache-poi
will show you those jars are under /usr/share/java/poi
but your jython script is only looking at python library paths for modules. One way to get that "poi.jar" in your script is to replace that "from org.apache.poi.hssf.usermodel import *" line with:
from org.apache.poi.hssf.usermodel import *
I tried that here and it worked with Pycharm IDE. I suspect there's a better way to include jars in Pycharm but I didn't see it in the "edit configuration" tool.
Then to make sure that even the raw script was working I went to where I put my testpoi.py (copy and paste of your script with my couple lines of edits as shown above)
in my pycharm project:
chmod +x testpoi.py
-rw-rw-r--. 1 mos mos 6656 May 26 17:36 Book1.xls
-rwxrwxr-x. 1 mos mos 1005 May 26 17:26 testpoi.py*
(note Book1.xls is a simple two row spreadsheet I made for my test containing two rows with some numbers in them like this:
1 2 3
4 4 5
Then I just ran it is a raw command line script so it's not running from Pycharm:
Picked up _JAVA_OPTIONS: -Dswing.aatext=true -Dawt.useSystemAAFontSettings=on -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKL ookAndFeel
org.apache.poi.hssf.usermodel.HSSFWorkbook@5be7ef2 c org.apache.poi.hssf.usermodel.HSSFSheet@580760d7 2
So that works too.
PS. another thing to watch for, I was just trying jython support in Fedora 16 and found that because the jython package in Fedora is very
old and behind the current version (Fedora 16 has version 2.2.1 while the latest stable jython is 2.5.2), some things you're accustomed to using
in normal python 2.7 (like the "with open() as file:" context statement (see: http://effbot.org/pyref/with.htm
) won't work.