I’m trying to save a file in which I have some credentials. In order not to leave passwords in clear in the file, I encrypted them with the pycrypto module. But when I try to save my file with the result strings, I have an error:
- I had 1st to save my file as UTF-8 because of the strange characters I receive (
# -*- coding: utf-8 -*-) - but then I still face some issues:
SyntaxError: EOL while scanning string literal(for instance on string'tý}DŠÇ{÷*6Ù·®') when I run my code via F5 in IDLE (saving is ok).
Note that this string can be used normally in IDLE shell:
>>> s = 'tý}DŠÇ{÷*6Ù·®'
>>> s
't\xfd}\x7fD\x8a\xc7{\x17\xf7\xad*6\xd9\xb7\xae'
>>>
Can you please help ? Thanks !
EDIT: this may not be clear: this string is in a python program, I’m not trying to write it in an external file.
Another thing: looks like the character that seems to be causing the error (\x7f in hexa) was removed by the SO interpreter.
I used
zlibinstead (no real encryption, but the passwords are no longer left in clear) which produces ASCII chars so no problem now… Of course that does not solve my initial problem, but I spent already too much time trying to solve it. Thanks Ignacio for your answers.