Changing filenames from Greeklish => Greek (subprocess complain)

Lele Gaifax lele at metapensiero.it
Fri Jun 7 03:09:29 EDT 2013


nagia.retsina at gmail.com writes:

>   File "files.py", line 75
>     os.rename( filepath_bytes filepath.encode('utf-8') )
>                                      ^
> SyntaxError: invalid syntax
>
> I am seeign the caret pointing at filepath but i cant follow what it
> tries to tell me.

As already explained, often a SyntaxError is introduced by *preceeding*
"text", so you must look at your code with a "wider eye".

> This rename statement tries to convert the greek byted filepath to
> utf-8 byted filepath.

Yes: and that usually imply that the *function* accepts (at least) *two*
arguments, specifically the source and the target names, right? How many
arguments are you actually giving to the os.rename() function above?

> I can't see whay this is wrong though.

Try stronger, I won't be give you further indications to your
SyntaxErrors, you *must* learn how to detect and fix those by yourself.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list