On Fri, Jun 7, 2013 at 9:10 AM, Νικόλαος Κούρας <nikos.gr...@gmail.com> wrote: > On 7/6/2013 10:42 πμ, Michael Weylandt wrote: > >>> os.rename( filepath_bytes filepath.encode('utf-8') > >> Missing comma, which is, after all, just a matter of syntax so it can't >> matter, right? > > I doubted that os.rename arguments must be comma seperated.
All function calls in Python require commas if you are putting in more than one argument. [0] > But ater reading the docs. > > s.rename(src, dst) > > Rename the file or directory src to dst. If dst is a directory, OSError will > be raised. On Unix, if dst exists and is a file, it will be replaced > silently if the user has permission. The operation may fail on some Unix > flavors if src and dst are on different filesystems. If successful, the > renaming will be an atomic operation (this is a POSIX requirement). On > Windows, if dst already exists, OSError will be raised even if it is a file; > there may be no way to implement an atomic rename when dst names an existing > file. > > Availability: Unix, Windows. > > Indeed it has to be: > > os.rename( filepath_bytes, filepath.encode('utf-8') Parenthesis missing here as well. > > 'mv source target' didn't require commas so i though it was safe to assume > that os.rename did not either. > That's for shell programming -- different language entirely. The surrogate business is back to Unicode, which ain't my specialty so I'll leave that to more able programmers. MW [0] You could pass multiple arguments by way of a tuple or dictionary using */** but if you want arguments that aren't in the container being passed, you're back to needing commas. -- http://mail.python.org/mailman/listinfo/python-list