Reputation: 1575
I have created a PythonProject in Eclipse Luna
. I am trying to run python module via PyDev Interactive Console
, but a simple import <ModuleName>
does not work it throws the following error.
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\SAMA0714\Downloads\eclipse\plugins\org.python.pydev_4.0.0.201504132356\pysrc\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs)
ImportError: No module named first
I have changed the working directory of console via
import os
os.chdir(<to_the_src_folder_of_my_project_where_I_put_my_python_modules)
but still I face the same error. Generally when I do the import statement
, If I type the first character of my module name I use to get the available modules with the name, but I do not see the names.
I've look into various stackoverflow question, but none were appropriate. any help is appreciated.
I have also tried running the console for the present editor option
in the Eclipse Console Options, but in vain.
But it works fine on Eclipse Kepler version.
UPDATE PyDev Interactive Console
Project Explorer
This is my on job system which is a 64-bit machine. I have a 32-bit machine at home on which python interactive console works smooth.
On my home machine, I have had python on local drive c
. On my job system I had installed it in documents folder which I now moved to C
, but still the error persists.
Upvotes: 1
Views: 916
Reputation: 8741
The locations in which Python looks for modules are in sys.path
which can also be modified. What output do you get when printing it?
import sys
print sys.path
You could try adding your path to sys.path
:
import sys
sys.path.append(<full_path_to_the_src_directory)
Upvotes: 3