I have created a folder in my home directory in ubuntu 12.04 and stord all the python files there. I have added path to my directory to pythonpath variable also. But it is not working. Earlier files were executed when they were in home directory but now they also do not get executed.
In Ubuntu Terminal manish@manish-laptop:~$ echo $PYTHONPATH /home/manish/project:
manish@manish-laptop:~$ ls -l /home/manish/project
total 24
-rw-rw-r-- 1 manish manish 140 May 31 00:07 Connection.py
-rw-rw-r-- 1 manish manish 122 May 29 11:29 Connection.py~
-rw-rw-r-- 1 manish manish 7150 May 31 00:07 Host.py
-rw-rw-r-- 1 manish manish 7132 May 30 23:30 Host.py~
`
Execution From Terminal:
>>> import sys
>>> sys.path
['', '/home/manish/project', '/home/manish', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
Execution from IDLE :
>>> import sys
>>> sys.path
['/usr/bin', '/home/manish/project', '/home/manish', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
In Ubuntu Terminal:
>>> import Host
>>> obj = Host()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
And Host is python file containing functions and I want to run some of the functions in the host file, that is why I am trying to create a object.It contains one class and class name is same as file name.
I have also granted execute permission on files using chmod command.
File do execute if I change the path to folder 'project' using cd command. Here is what i do
manish@manish-laptop:~$ cd project
manish@manish-laptop:~/project$ python
Python 2.7.3 (default, Apr 20 2012, 22:44:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> execfile('Host.py')
>>> obj = Host()
>>>