Importing scapy to blender
Question: I'm trying to import the scapy module into blender:

    
    
    from bge import logic
    import socket
    from scapy.all import *
    

But I face this exception:

[![enter image description
here](http://i.stack.imgur.com/LDwIf.png)](http://i.stack.imgur.com/LDwIf.png)

I copied the scapy module folder into:

C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules

And this is what it contains:

[![enter image description
here](http://i.stack.imgur.com/e2OoP.png)](http://i.stack.imgur.com/e2OoP.png)

Notice all and base_classes is in it.

In addition i tried to add the PYTHONPATH in the environment variables (I'm
not sure this is what I had to do.. I also tried to add

C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules\scapy

in the PATH and in PYTHONPATH, they both didn't solve the problem):

[![enter image description
here](http://i.stack.imgur.com/Lma8Y.png)](http://i.stack.imgur.com/Lma8Y.png)

EDIT:

The problem as sambler said is that I used scapy that doesn't support python
3.x as blender uses. So I download newer scapy version which supports python
3.x from here: <https://github.com/phaethon/scapy> and replaced it with the
older scapy, now it works but I can't sniff, send or receive packets:

[![enter image description
here](http://i.stack.imgur.com/6tuOY.png)](http://i.stack.imgur.com/6tuOY.png)

[![enter image description
here](http://i.stack.imgur.com/xPHOo.png)](http://i.stack.imgur.com/xPHOo.png)


Answer: The direct cause of this error is that you don't have `C:\Program
Files\Blender Foundation\Blender\2.75\scripts\modules` in the
[PYTHONPATH](https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH)
environment variable. It's not a specific Blender issue, it's a general Python
requirement for loading third-party packages.

You can try to add `PYTHONPATH` as a global per-user environment variable as
described in this question: [How to add to the pythonpath in windows
7?](http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-
in-windows-7)

