Why does this (very simple piece of) code does not work?

jblazi jblazi at hotmail.com
Mon Aug 16 15:03:51 CEST 2004


import os

L = os.listdir('.')

for x in L:
    print '!'+x+'!'+x[0]
    if x != 'rename.py':
       y = 'Kapustin (Hamelin): '+x
       os.rename(x,y)

I get

Traceback (most recent call last):
  File "<stdin>", line 9, in ?
OSError: [Errno 22] Invalid argument


TIA,

jb




More information about the Python-list mailing list