kaer a écrit :

#! /usr/bin/python
# -*- coding: utf8 -*-

import os, sys

#NAUTILUS_SCRIPT_SELECTED_FILE_PATHS : chemins des fichiers
sélectionnés séparés par des retours à la ligne (newline) (uniquement
pour les fichiers locaux)
#NAUTILUS_SCRIPT_SELECTED_URIS : URIs des fichiers sélectionnés
séparés par des retours à la ligne (newline)
#NAUTILUS_SCRIPT_CURRENT_URI : URI de l'emplacement actuel
#NAUTILUS_SCRIPT_WINDOW_GEOMETRY : position et taille de la fenêtre
actuelle


KEYS=("NAUTILUS_SCRIPT_SELECTED_FILE_PATHS",
"NAUTILUS_SCRIPT_SELECTED_URIS", "NAUTILUS_SCRIPT_CURRENT_URI",
"NAUTILUS_SCRIPT_WINDOW_GEOMETRY")

ft=open("/home/kaer/stupid.txt", "w")
for key_value in [(key, os.environ.get(key, 'NOT FOUND')) for key in
KEYS]:
    ft.write("env(%s): %s\n" % key_value)
file_names=sys.argv[1:]
for index, file_name in enumerate(file_names):
    ft.write("%s: [%s]\n" % (index, file_name))
    if os.path.isfile(file_name): os.rename(file_name, '%03d-%s' %
(index+1, file_name))
ft.close()

Yes, indeed, it works with your code. Thanks for it.
I just have to find out why it doesn't work with mine. The problem is that Nautilus scripts are hard to debug.

Thanks for your help,
Michel

--
Michel Leunen
http://linux.leunen.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to