I need to integrate two files, one in python the other in julia. More precisely, I need to call a julia function, snapshot_sphere(b,h,data,m,r,d), from a python file. Moreover,I need to provide the parameters via the command line. I had difficulties in using PyJulia. For the moment an error message is persisting:
ModuleNotFoundError: No module named '_ctypes'
I found some dependencies related to libffi-dev
. Installing it did not change anything. What should I do to call the julia function from the python file ?
Here is the code of the python file:
import argparse
from julia import Main
from PIL import Image, ImageShow
parser = argparse.ArgumentParser(description="Projection of the picture")
parser.add_argument(
"-f",
"--filename",
type=str,
action="store",
dest="fname",
help="Name of the picture"
)
parser.add_argument(
"-d",
"--density",
type=int,
action="store",
dest="density",
help="Number samples per Pixel"
)
parser.add_argument(
"-r",
"--radius",
type=float,
action="store",
dest="radius",
help="Radius of the sphere"
)
parser.add_argument(
"-x",
type=float,
action="store",
dest="x",
help="X coordinate of the center"
)
parser.add_argument(
"-y",
type=float,
action="store",
dest="y",
help="Y coordinate of the center"
)
parser.add_argument(
"-z",
type=float,
action="store",
dest="z",
help="Z coordinate of the center"
)
args = parser.parse_args()
print(args)
m = (args.x, args.y, args.z)
print(m)
im = Image.open(args.fname)
b, h = im.size
data = list(im.getdata())
Main.b = b
Main.h = h
Main.m = m
Main.r = args.radius
Main.d = args.density
Main.data = data
Main.include("projekt1.jl")
result = Main.eval("snapshot_sphere(b,h,data,m,r,d)")