On Sat, Aug 7, 2010 at 16:34, bob gailer <bgai...@gmail.com> wrote:

> [chr(x) for x in os.urandom(6))]

Correcting this to [chr(x) for x in os.urandom(6)],
most of the time I get an error:

>>> [chr(x) for x in os.urandom(6)]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python31\lib\encodings\cp437.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\xb9' in
position 12: character maps to <undefined>

But once in a while it works:
>>> [chr(x) for x in os.urandom(6)]
['\x9d', '\x9b', '\x0e', 'ê', '^', 'N']

(remember, I'm using Windows)

Dick
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to