Bonjour,

je souhaite faire un programme python qui change les droits d'un fichier.
mais je ne comprends pas bien la fonction os.chmod.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
[maillol@localhost ~]$ python 
Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) 
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.chmod( "toto", 755 )
>>> exit()
[maillol@localhost ~]$ ls -l toto
--wxrw--wt. 1 maillol maillol 2359 mars   8 16:46 toto
[maillol@localhost ~]$ python
Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57) 
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.chmod("toto", 777 )
>>> exit()
[maillol@localhost ~]$ ls -l toto
-r----x--t. 1 maillol maillol 2359 mars   8 16:46 toto
[maillol@localhost ~]$
Ne devrais-je pas avoir -rwxrwxrwx pour la dernière ligne ?

merci d'avance