Sys.path.append("") Dosen't work on Debian.. :/ "no module named guess_language"
Question: Just transferred my python project by ftp to my linux server and the project
can't import files some what.. :/

    
    
    sys.path.append("Functions\guess_language")
    import check_language
    sys.path.append("Functions\SL4A")
    import android
    

It's doesn't let me to import any module, but In windows, It does work.. why?
I'm using Python 2.7 btw.

Thanks.


Answer: backslashes are escape characters in strings.

so you have a few choices to deal with that in your example...

  1. use raw strings:

sys.path.append(r"Functions\guess_language")

  2. escape the backslash with another backslash:

sys.path.append("Functions\\\guess_language")

  3. use forward slashes:

sys.path.append("Functions/guess_language")

  4. use os.path.join:

sys.path.append(os.path.join("Functions", "guess_language"))

  5. string formatting with os.sep:

sys.path.append('Functions%sguess_language' % os.sep)

