I am making a call to my python script via Java using jython . The python script has a scapy module (Python version : 2.7) . When I make a call using the below code ,I receive the below exception
from scapy.all import *
File "/Users/Library/Python/2.7/lib/python/site-packages/scapy/all.py", line 18, in <module>
from scapy.arch import *
File "/Users/Library/Python/2.7/lib/python/site-packages/scapy/arch/__init__.py", line 28, in <module>
from scapy.arch.bpf.core import get_if_raw_addr
File "/Users/Library/Python/2.7/lib/python/site-packages/scapy/arch/bpf/core.py", line 9, in <module>
from ctypes import cdll, cast, pointer
ImportError: cannot import name cast
My Java code :
import org.python.core.*;
public class PythonCall {
public static void main(String[] args) {
PythonInterpreter interp = new PythonInterpreter();
interp.execfile("/Users/python_projects/PacketTrace/nettracer/DebugMonitor.py");
}
}
My python code :
import os
os.sys.path.append('/Users/Library/Python/2.7/lib/python/site-packages')
print os.sys.path
from scapy.all import *
from scapy.layers.http import HTTPRequest,HTTPResponse,HTTP
class DebugMonitor(object):
def __init__(self):
'''
Constructor
'''
print "Debugging"
self.packetSniff()
def packetSniff():
<Code to Sniff packets>
if __name__ == '__main__':
print os.sys.path
os.sys.path.append('/Users/Library/Python/2.7/lib/python/site-packages')
debug = DebugMonitor()
Has anyone faced this issue , any help is appreciated .