[GRASSGUI] Re: [grass-addons] r343 - trunk/grassaddons/gui

Glynn Clements glynn at gclements.plus.com
Tue Mar 27 16:34:15 EDT 2007


Michael Barton wrote:

> > > Modified:
> > >    trunk/grassaddons/gui/gis_set.py
> > > Log:
> > > Fixed bug with new mapset not copying WIND file from PERMANENT.
> > > 
> > > ****Please check to see if permissions need to be set (I just copied
> > > the WIND file permissions). Line 674 has a chmod statement, but I don't
> > > know what to set it to (needs set of numbers for u+rw,go+r I think).
> > 
> > 644  should mean: "u+rw, go+r"
> > 
> > hope, it helps
> 
> I just tried this. Seemed like a good idea but didn't work. I got an error
> saying that I didn't have the right permissions to use the mapset.
> 
> Maybe Daniel understands how os.chmod works

The documentation at:

	http://docs.python.org/lib/os-file-dir.html

says:

	chmod(path, mode)
	
	    Change the mode of path to the numeric mode. mode may take one of
	    the following values (as defined in the stat module) or bitwise
	    or-ed combinations of them:
	
	        * S_ISUID
	        * S_ISGID
	        * S_ENFMT
	        * S_ISVTX
	        * S_IREAD
	        * S_IWRITE
	        * S_IEXEC
	        * S_IRWXU
	        * S_IRUSR
	        * S_IWUSR
	        * S_IXUSR
	        * S_IRWXG
	        * S_IRGRP
	        * S_IWGRP
	        * S_IXGRP
	        * S_IRWXO
	        * S_IROTH
	        * S_IWOTH
	        * S_IXOTH

The stat.py file gives these constants their usual numeric values. If
you want to use a numeric value in the os.chmod() call, you will need
to specify it in octal (with a leading zero), e.g.:

            os.chmod(os.path.join(database,location,mapset,'WIND'), 0644)

Note: 644 (decimal) = 01204 (octal) = t-w----r-- (u=w,g=,o=r,t), which
isn't much use (the owner can't read it).

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-gui mailing list