Executing script with sudo in virtual environment - packages not found
Question: I created a virtual environment and wrote a Scapy project in it. For this I
wrote some modules and packages and put them in the environments site-packages
folder. Now when I enter the environment with `source bin/activate` and try to
execute the script with `sudo` some modules I put in the virtual environments
site-packages folder can't be found. When I execute it as normal user the
module is found, but the script, of course, won't work because it needs super
user rights. How can I fix this?

    
    
    (Project)user@pc ~/git/Fuzzing/src $ python BACnetMonitoring.py 
    WARNING: No route found for IPv6 destination :: (no default route?)
    Traceback (most recent call last):
      File "BACnetMonitoring.py", line 17, in <module>
        webRequest_timeout=1
      File "/home/user/git/Fuzzing/local/lib/python2.7/site-packages/BACnetMonitor.py", line 78, in __init__
        self._socket = conf.L2socket(iface=self._iface)
      File "/home/user/git/Fuzzing/local/lib/python2.7/site-packages/scapy/arch/linux.py", line 414, in __init__
        self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
      File "/usr/lib/python2.7/socket.py", line 187, in __init__
        _sock = _realsocket(family, type, proto)
    socket.error: [Errno 1] Operation not permitted
    (Project)user@pc ~/git/Fuzzing/src $ sudo python BACnetMonitoring.py  
    Traceback (most recent call last):
      File "BACnetMonitoring.py", line 7, in <module>
        import BACnetMonitor
    ImportError: No module named BACnetMonitor
    (Project)user@pc ~/git/Fuzzing/src $
    


Answer: `sudo` doesn't inherit your environment. Specify the full path to the
Project's python executable.

Look at `sys.executable` with and without `sudo`.

