I have Eclipse Version: 4.2.1 and PyDev version 2.7.1 installed on my 64-bit Ubuntu. I am using Python 2.7 and I have this problem with Eclipse that it doesn't recognize my un-imported methods. For example if I write a code like this:
def main():
myfiles = os.listdir('src')
if __name__ == '__main__':
main()
print'done!'
I get this error:
Traceback (most recent call last):
File "tset.py", line 5, in <module>
main()
File "tset.py", line 2, in main
myfiles = os.listdir('src')
NameError: global name 'os' is not defined
which is a pretty obvious error because I didn't write "import os" at the beginning of my code. My problem is that Eclipse doesn't highlight these errors for me anymore. Either I have to find them by myself or I will find out about them when I run my code. My Eclipse was working fine before but I don't know what did I change that this happened.
I should also mention that I have "lib" folder in my project and in that folder I have a few of my own modules and I have added the "lib" folder to PYTHONPATH of my project. And the code that I am running is in another folder named "test" and that's not in the PYTHONPATH.