« first day (1718 days earlier)      last day (3221 days later) » 

1:00 PM
Cartoons have given me a very false perspective on soufflés. Apparently they don't collapse if you clap your hands next to them.
 
I've seen the great british bakeoff. My impression is that they are similar to soup, is that correct?
 
I love GBBO.
I'm watching Celebrity Masterchef at the moment.
 
Today I am trying to password-protect a directory in my flash drive. Apparently I can just copy over the desktop version of TrueCrypt I already have, but this is somewhat unwieldy because apparently it needs administrator permission to run on systems it wasn't formally installed in.
Not a huge deal, since I have admin access on the computers where I want to use the drive, but it's six more seconds of clicking permission approval dialog boxes than I would prefer
I like how the suffle guy edits in a passive aggressive message instead of improving his question
Doesn't he know that we are a fickle and proud people? He's the one asking for a favor here.
 
@JRichardSnape you're making my and @tristan's star hegemony start to crack
 
It is quite impressive. "I'll just put a few bits in capitals, that'll throw them off" I imagine her thinking.
 
user559633
1:06 PM
I like to imagine he's an increasingly agitated natural language bot. Am I failing the turing test? Repeat message with capitals slowly and more frequently.
 
@RobertGrant don't worry - it'll wear off.
I found a bot with 1000+ rep today. Quite impressive, I thought. Kept dumping IRC commands in chat, though, which is a bit of a giveaway
 
user559633
I'd be interested in seeing the source for a bot like that
 
@holdenweb Did it use TeX or perhaps Troff?
 
By the way: Batman Arkham Knight is awesome so far.
Once the power came back on.
 
@Bob yeah I've heard fantastic things.
 
1:12 PM
Before that it was more Batman in the dark with no sound
 
Thanks for the update!
 
The only downside is the batmobile fights are a little lame compared to other stuff, but they're still reasonably cool
 
@tristan TBH - I think the rep was probably gained by a human operator.
 
I’m in one of these situations where I just stare at my code for half an hour…
 
user559633
@poke in confusion, awe, anger?
 
1:14 PM
Maybe it will fix itself.
 
It surely will.
 
Cosmic rays could flip those bits at any moment.
 
A butterfly could flap it's wings then fly over to your keyboard and debug it for you.
 
I didn't even type that last message - cosmic rays just happened to activate the circuits in my keyboard in the exact right order. See? Easy.
I didn't type that last one either...
 
@Ffisegydd Unfortunately, the windows are closed.
 
1:16 PM
Oh boy, this is getting out of hand.
 
@Kevin do you even exist?
 
@Kevin You mean out of cosmic rays?
 
Yes to both, probably.
 
cabbage
 
Hey up PM2
 
1:20 PM
Why when printing unicode character it shows codec cannot encode character
But not when tying just the argument
 
Python 2 or 3?
 
i.e)print (a) produces error
python 2
a dosent produce error
 
Can you put together a MCVE?
 
(Are you doing from __future__ import print_function?)
 
No normal print
0
Q: "UnicodeEncodeError: 'charmap' codec can't encode characters" when trying to parse .xlsx by openpyxl

Vadim Tikanov--- update --- I think this console log nails the issue, however it's still not clear how to fix it: >>> workbook = openpyxl.load_workbook('data.xlsx') >>> worksheet = workbook.active >>> worksheet['A2'].value u'\u041c\u0435\u0448\u043e\u043a \u0434\u0435\u043d\u0435\u0433' >>> print worksheet[...

 
1:22 PM
Hi @PM2Ring
 
I get errors when I try to print unicode because my console doesn't support unicode. Maybe you have the same problem. Try using a different console.
 
@JRichardSnape :) Hi Richard. I wonder if suffle guy will get my hint...
 
It was from this question but I too faced this problem back a while ago
But used .encode("utf-8") to evade from it
 
@PM2Ring I hope so. Really trying to help her help herself, but maybe difficult. If my suspicion is right - probably 14 year old just wants to get GCSE coursework done...
 
1:25 PM
Incidentally print a and a produce different output because they execute different methods to determine what data to display. The first calls a.__str__(), the second calls a.__repr__().
Or, wait, does it? Sigh.
 
@Kevin ha ha
 
Pretty sure print uses __str__ and just a uses __repr__
 
Yeah, forgot those 'scores.
 
@JRichardSnape Maybe GCSE. But I suspect English is not Bethan's 1st language. OTOH, I guess the spelling problems could be due to dyslexia.
 
"my console doesn't support unicode" - are you using a PDP-11 or something ;)
 
1:27 PM
What is it with python 2 and unicode sighs
 
@Ffisegydd Yep.
 
@JRS he actually wrote his own console using KevinScript and well...
 
:D
yammety yammety yam. I should be writing me some PhD. Less interesting on here, please.
 
Listen, all I know is it tells me "see python.org/dev/peps/pep-0263 for details", and when I go to that page for details, it doesn't actually tell me how to fix it.
 
@VigneshKalai Python 2 strings are byte strings, Python 3 strings are Unicode strings. So if you want to do Unicode stuff in Python 2 be prepared to get your hands dirty. :)
 
1:30 PM
yeah as of now not dealing with unicode
 
Googles sqlalchemy.orm.exc.DetachedInstanceError. Finds sqla docs on it that say "An attempt to access unloaded attributes on a mapped instance that is detached." Cries.
 
#!/usr/bin/python
# -*- coding: utf-8 -*-
message = "all rights reserved © Kevin Kevinson"
print(message)
#result: all rights reserved ¬ Kevin Kevinson
This is why I don't Unicode.
 
This is why I don't Unicode Python 2 :P
 
Ok, let's try it in 3... SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa9 in position 0: invalid start byte. Much better.
 
In [3]: message = "all rights reserved © Kevin Kevinson"

In [4]: print(message)
all rights reserved © Kevin Kevinson
 
1:37 PM
Wow, I can't even paste that © into command prompt
 
Now this is the most debatable thing python
 
PowerShell?
 
Oh, here's the problem. Notepad++ wasn't in UTF-8 mode. I'll just switch over, and... UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in position 20: character maps to <undefined>
I think after three cryptic errors I'm justified in sticking with just ANSI forever, yeah?
 
Of course, unless you want to eat soufflé.
 
@Kevin count me in
 
1:39 PM
é is actually in ANSI (on my machine at least). ordinal value 130.
 
Curses!
Wait isn't ANSI 128 chars? Or is that ASCII?
 
ASCII is the littler one, yeah
 
@Ffisegydd doesn't help, and neither does changing the codepage it seems
 
Weird. I was just using ipython in PowerShell. Win7.
Py3.
 
Maybe ipython does magic
 
1:43 PM
Bother -_-
 
Ok apparently I'm using "code page 437".
 
No I can type it into PowerShell too. Clearly I'm just a better human being than you Bob.
 
It's got it all. Sideways T shapes. playing card suits. two smiley faces.
Everything you need.
 
Yeah the paste doesn't work into the command prompt
 
Kevin, does this work:
 
1:44 PM
Well I pasted it too.
 
message = u"all rights reserved \xa9 Kevin Kevinson"
print(message)
 
Nah, same UnicodeEncodeError as last time.
I'm beginning to suspect that I installed Python wrong...
 
FWIW, your original code works for me in the KDE editor kate, if the file's saved with the encoding set to utf-8.
 
For me it is working in canopy
 
44
Q: Python, Unicode, and the Windows console

James SulakWhen I try to print a Unicode string in a Windows console, I get a UnicodeEncodeError: 'charmap' codec can't encode character .... error. I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Python auto...

 
1:46 PM
How about
message = u"all rights reserved \xa9 Kevin Kevinson"
print(message.encode('utf-8'))
 
Hey, it didn't crash! b'all rights reserved \xc2\xa9 Kevin Kevinson'
 
ooh, I got past 5000. That gives me the somewhat dubious "privilege" of doing more reviewing, apparently.
 
I guess I should mention that you have to set the encoding of your console to utf-8 as well...
 
Is... Is that a thing
 
Congrats, Richard!
@Kevin 'Fraid so.
 
1:49 PM
@Kevin chcp 65001 magic
 
Yeah I tried that; nothing.
>>> message = u"all rights reserved \xa9 Kevin Kevinson"
>>> print(message.encode('utf-8'))
b'all rights reserved \xc2\xa9 Kevin Kevinson'
Sweet
 
Same output as last time
Do I still need this # -*- coding: utf-8 -*- line that I don't know what it does
 
Oh, but this worked!
>>> message = "all rights reserved \xa9 Kevin Kevinson"
>>> print(message)
all rights reserved © Kevin Kevinson
 
>>> message = u"all rights reserved \xa9 Kevin Kevinson"
>>> print(message)
all rights reserved © Kevin Kevinson
 
You also need a truetype font - e.g. Lucida console. You obviously have that bob
 
1:51 PM
Yeah I also switched to Lucida console for this
@Kevin did you do chcp 65001?
 
Interestingly, that A-circumflex copyright that I just pasted in appears like a lopsided table on my actual console.
 
Note - chcp 65001 is pure necromancy - do not let it go beyond this room ;)
 
@RobertGrant Yes.
 
@Kevin That magic line tells the Python interpreter that your source is encoded with utf-8. You need it if you've told the editor to use utf-8 encoding. You don't need it if your editor's using ASCII encoding & you're doing unicode stuff using escape sequences.
 
Let me also switch to Lucida...
Woooooooaaaaaah all rights reserved © Kevin Kevinson
 
1:54 PM
Weird that your font has that character, and still breaks
 
I think you left the \xc2 in somehow (i.e. output of encode()) - that's A circumflex
 
Finally Kevin gets the copyright he deserves.
 
Ok, so to use Unicode I merely need to 1) use the magic chcp 65001 command 2) switch to this ugly font 3) only use Python 3 because forget this noise in 2, 4) switch the encoding in Notepad++ if I want to actually have unicode chars in my source 5) use the magic # -*- coding: utf-8 -*- line. So easy.
 
I guess we should all use a Mac really. Have I ever mentioned the pdf layer... ;)
I'm expecting someone to say "use Linux" soon, too. Works right off the bat on a humble Raspberry Pi, Python 2.7, raspbian console
 
Aaand cmd has crashed for the second time in my life.
 
1:58 PM
Woo hoo OS X!
 

« first day (1718 days earlier)      last day (3221 days later) »