Skip to content Skip to sidebar Skip to footer

Windowserror 32 While Trying To Os.rename

I'm using a base folder REF_IMAGES where I keep reference bitmaps for a specified language. I have other several languages folder like REF_IMAGES-EN, REF_IMAGES-NL etc. I want to

Solution 1:

Test with this:

try:
     currentLanguage = textFile.read()
 except WindowsError:
   pass
   textFile.close()


try:
    textFile.write("%s" %currentLanguage)
except WindowsError:
   pass
   textFile.close()

Solution 2:

Found the issue myself ! The error is in the os.rename syntax. by doing :

os.rename(imageFolder, os.path.join(imageFolder, currentLanguage))

The output of os.path.join(imageFolder, currentLanguage) is IMAGES\REF_IMAGES\-FR and not IMAGES\REF_IMAGES-FR as I expected

The syntax I use now is:

originalName = imageFolder + currentLanguage
os.rename(imageFolder, originalName)

Thanks to Mayk who lead me on it actually.

Post a Comment for "Windowserror 32 While Trying To Os.rename"