I am trying to run Python code which uses Scapy functionality from C# using IronPython.
I get the following exception:
IronPython.Runtime.Exceptions.ImportException: 'No module named scapy'
I've already added everything I could to engine search paths:
paths.Add(@"C:\Program Files (x86)\IronPython 2.7\Lib");
paths.Add(@"C:\Python27\Lib"); // or you can add the CPython libs instead
paths.Add(@"C:\Python27\Scripts");
paths.Add(@"C:\\Python27\\lib\\site - packages\\scapy - git_archive.dev2ef25578b - py2.7.egg");
paths.Add(@"C:\\windows\\SYSTEM32\\python27.zip");
paths.Add(@"C:\\Python27\\DLLs");
paths.Add(@"C:\\Python27\\lib\\plat-win");
paths.Add(@"C:\\Python27\\Lib\\site-packages\\scapy-git_archive.dev2ef25578b-py2.7.egg\\scapy");
paths.Add(@"C:\\Python27");
paths.Add(@"C:\\Python27\\lib\\site-packages");
If I try to use other Python module functionality, like for example, math, the script runs.
While searching for the solution I've stumbled across this information:
https://grokbase.com/t/python/ironpython-users/1546gp6gt1/import-error-scapy-on-ironpython-windows
Where the bottomline is:
"You're right that IronPython does not support pywin32, because IronPython doesn't support C extensions in general. In this specific case it's probably because scapy checks for Windows using sys.platform == 'win32' instead of os.name == 'nt' and it's trying to run a Unix codepath (uname is the giveaway, it's part of os on Unix but not Windows)."
But that post is from 2015, is it still relevant? I know that Scapy improved a lot since then regarding compatibility and ease of use from Windows.