Tom wrote: > Peter Hansen wrote: >> Where do you think those double quotation marks came from? What >> happens if you try the following instead of using the variables you >> were trying to use? >> >> os.rename("e:\\music\\Joni Mitchell\\ogg-8", >> "e:\\music.ogg\\Joni Mitchell\\ogg-8") >> >> Now try it with this and observe how you get (I predict) the same >> error message as you originally got, and note what your mistake was: >> >> os.rename('"e:\\music\\Joni Mitchell\\ogg-8"', >> '"e:\\music.ogg\\Joni Mitchell\\ogg-8"') > > > This produced the msg: > OSError: [Errno 22] Invalid argument
Presumably "this" means the second one, whereas for the first you got a different message? The latter is clearly invalid, since paths can't contain quotation marks. The former would work provided the folder "music.ogg/Joni Mitchell" existed. > The problem seems to be that I'm trying to create more than one > directory at a time. In the above example, the dir 'Joni Mitchell' > doesn't exist. If that were true, and the only problem, you would get a different error: OSError: [Errno 2] No such file or directory > The functions that I'm calling (os.rename and shutil.move) use mkdir, > not makedirs. The solution is for me to use makedirs with all of the > path except the leaf before I move/rename the old dir. Regardless of the issue with error messages, that sounds like it does explain your problem. Great! :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list