Question: I have a Library that uses sockets that I'm trying to edit to emit an event, broadly the code looks like this:

```
function Library(port, host) {
  this.myData = [];
  this.socket = net.connect( ... );
  this.socket.on('data', this._ondata.bind(this));
  this.socket.on('error', this._onerror.bind(this));
  this.socket.on('close', this._onclose.bind(this));
}
Library.prototype._ondata = function() {
  //do stuff
  //have the data we want
  this.myData.push(stuff);
  this.socket.end();
}
Library.protoype._onclose = function() {
  console.log('this gets logged');
}
modules.export = Library;

```

I want to emit an event in the `_onclose` method such that I could do something like

```
var lib = new Library(port, host);
lib.on('emitted-event', function() {
  var data = lib.myData;
});

```

because if I just access `lib.myData` straight away it's still an empty array. But I'm struggling to emit an event. What I'm getting at the moment is Library has no method on. So clearly I'm not adding an emitter in the right way. Anyone know what that is?

Answer: 
I was able to fix this error on Ubuntu by adding a cell to the top of the notebook appending the module directory to the path:

```
import sys
sys.path.append('/usr/lib/python2.7/dist-packages')

```

The path to add can be found when running `pip install <something>`, (such as numpy) and it tells you where each package is installed or already exists.
Is it possible that /usr/bin/python is actually a symlink? 

The better solution is that you should be running your ipython notebook from a virtualenv that contains all the modules that you need.