[Tutor] File Writing Permission?

claxo clazzt at arnet.com.ar
Sun Oct 7 22:07:31 CEST 2007


>     if os.name == "posix":
>         fname = "~/" + fname
>     infile = open(fname,"w")


you must expand '~' before open:

          fname = os.path.join('~',fname)
          fname = os.path.expanduser( fname )
       infile = open(fname,'w')


More information about the Tutor mailing list