Loading ...
Sorry, an error occurred while loading the content.
 

python : sys.path.append doesn't work

Expand Messages
  • Kumar, Ganesh
    Hi all, I m trying to add a custom folder path to python sys path using sys.path.append, but it doesn t work for me, Googling got me
    Message 1 of 1 , Jun 12 10:01 AM
      Hi all,

      I'm trying to add a custom folder path to python sys path
      using sys.path.append, but it doesn't work for me,
      Googling got me

      http://www.johnny-lin.com/cdat_tips/tips_pylang/path.html

      This is what I tried :

      gakumar@ubuntu:~/tcs_tgt_cfg/tgt_script/python/Python-2.7.3$ python
      Python 2.7.3 (default, May 24 2012, 10:13:35)
      [GCC 4.4.3] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import sys,os
      >>> print sys.path
      ['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']
      >>>
      >>> sys.path.append('/home/gakumar/C_Prgs/')
      >>>
      >>>
      >>> print sys.path
      ['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages', '/home/gakumar/C_Prgs/']
      >>>
      >>>
      >>> os.system('/home/gakumar/C_Prgs/custom_ls')
      build configure.in Include LICENSE Makefile.pre.in Parser pyconfig.h.in README tgt_work_04062012.tar.gz
      config.log Demo install-sh Mac Misc PC python RISCOS tgt_work.tar.gz
      config.status Doc Lib Makefile Modules PCbuild Python setup.py Tools
      configure Grammar libpython2.7.a Makefile.pre Objects pyconfig.h python-gdb.py tgt_work
      0
      >>>
      >>>
      >>>
      >>>
      >>> os.system ('custom_ls')
      sh: custom_ls: not found
      32512
      >>>

      Am I missing something here...?
      Thanks in advance for any pointers.

      rgds,
      GK
    Your message has been successfully submitted and would be delivered to recipients shortly.