Reputation: 147
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:
I copied the scapy module folder into:
C:\Program Files\Blender Foundation\Blender\2.75\scripts\modules
And this is what it contains:
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):
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:
Upvotes: 2
Views: 189
Reputation: 7079
There are two things in the screenshot of the error that giveaway the problem -
L
in 0xFFL
C:\Python27\scapy\base_classes.py
From 2.50 onwards blender uses python 3.x and the error causing the exception (L to specify a long int) is a python 2.7 language feature that was removed in 3.0.
A quick search shows a fork of scapy has been made to work with python3
Have a look at scapy-python3
Upvotes: 1
Reputation: 4725
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 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?
Upvotes: 2