Q:

Eclipse - interactive shell for python not working

I've installed and configured Pydev with Eclipse but when I try to use interactive shell I get errors. Can someone have a look and advise?
Code for two functions:
def convert_milage(t):  # t - number of miles per 1 gallon
    litersPer100Kilometers = 100/ ((t * 1.609) / 3.785) 
    return litersPer100Kilometers

def liters_needed(t, v): # t: distance in kms, v: fuel consumption
    fuelConsumption = convert_milage(v)
    litersNeeded = (t * fuelConsumption) / 100
    return litersNeeded

Error:
http://i54.tinypic.com/2afmu7p.png
Error message:
>>> convert_milage(100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'convert_milage' is not defined
>>> 

A:

You need to open the console for the file you're in, not just use the general python console, as that knows nothing about the functions in your source file.
Press Ctrl-Alt-Enter and select Current active editor. 
That should import the current module into your shell and make things work better.

