I have to call example.py (having another dependencies windrose, matlab, numpy ) python file from java to create wind graph but it unable to import any dependency while calling from java but its runs fine independently using python, I got
Error: no module name windrose
but this module is already in folder please let me know how to do it
windroseGraph ie = new windroseGraph();
ie.execfile("E:\\example.py");
PyInstance hello = ie.createClass("test", "None");
hello.invoke("run");
python file example.py
from windrose import WindroseAxes
from numpy.random import random
from numpy import arange
from matplotlib import pyplot as plt
import matplotlib.cm as cm
class test:
def new_axes():
fig = plt.figure(figsize=(8, 8), dpi=80, facecolor='w', edgecolor='w')
rect = [0.1, 0.1, 0.8, 0.8]
ax = WindroseAxes(fig, rect, axisbg='w')
fig.add_axes(ax)
return ax
def set_legend(ax):
l = ax.legend(borderaxespad=-0.10)
plt.setp(l.get_texts(), fontsize=8)
def run(self,wd,ws):
ax = new_axes()
ax.bar(wd, ws, normed=True, opening=0.8, edgecolor='white')
set_legend(ax)
##print ax._info
plt.show()
example.py is python file having function with parameter and generate wind graph using windrose.py module (python lib online available )