OS path insert command
Question: There are some problems using the PYTHONPATH env variable. Therefore I have to
figure out some other option in my code to import modules from another folder.
I was trying the sys.path,insert based on "TEST_INSTALL_DIR" env variable (
value=C:\test).

I want to create

    
    
    path = os.getenv("TEST_INSTALL_DIR")#C:\test
    path=  path.replace("\\", "/")
    pypath= '%s/python/profile'%(path)#C:/test/python/profile
    pypath= "\'%s\'" %(pypath)# 'C:/test/python/profile'
    print "PYPATH:",pypath
    sys.path.insert(0, pypath)
    

If set the path as below ,everything works fine. :

    
    
     sys.path.insert(0, 'C:/test/python/profile')
    

Am I doing anything completely wrong in my code? Any ideas would help. Thanks.


Answer: I think the comment of sberry should be correct. Just to be sure have you
tried the following?

    
    
    path = os.getenv("TEST_INSTALL_DIR")#C:\test
    path = path.replace("\\", "/")
    pypath = '%s/python/profile'%(path)#C:/test/python/profile
    print "PYPATH:",pypath
    sys.path.insert(0, pypath)
    

