« first day (2674 days earlier)      last day (2272 days later) » 

12:50 AM
trying to link brew's tcl-tk with brew's python but I'm getting
RuntimeError: tk.h version (8.7) doesn't match libtk.a version (8.5)

I ran:
brew install tcl-tk
brwe install python --with-tcl-tk
I get the error when I try: "idle2"
i also want to link that tcl-tk to my system python as I'm getting a message that i'm running unstable tcl-tk there when "idle" successfully launches
 
1:30 AM
hi
@Pavel This answer demonstrates how to do it with zipped files: stackoverflow.com/a/36320295/541136
 
 
3 hours later…
4:08 AM
this was un-duped. I don't understand why.
The target had two links that provided what is needed to solve that problem.
and one of the answers is a parsing HTML with regex....come on
You removed the dupe for this, and provided a regex answer for parsing HTML? seriously? why would you do this? — idjaw 3 mins ago
That individual removed the dupe and it seriously makes no sense...
 
@idjaw He seems to be suggesting that his answer gave more detail on how to proceed?
 
Sure....the filtering I can see that the answers did not provide exactly how to "remove" things
but...regex
really?
The other answer is the way to go and I can agree that my dupes did not use the del explicitly
 
4:25 AM
Well it is an alternative :) but it seems like rep seeking, but then I am biased against regex. I guess you can upvote the preferred answer, leave comments. Or flag the question since OP hasn't actually stated how they want to do it, nor any effort/attempts.
 
sorry. I have updated my question.can you help again? — user3751111 1 min ago
This is why you dupe and move on
they don't even know what they want
so until they know what they want shut that yam down
 
4:40 AM
Fair enough.
 
anyway that answerer deserves an OP that is now changing their question
 
 
2 hours later…
6:46 AM
cbg mango!
Finally got the Outspoken silver badge :D (Tip: Kevinism)
Updated an old answer to use f-strings
 
 
2 hours later…
9:21 AM
off-topic / reco, outside resources - stackoverflow.com/questions/258243/…
 
10:03 AM
It only took ~4 years for the day to renew :-p stackoverflow.com/questions/20078816/…
 
10:58 AM
@idjaw I think the answerer is pingable here if you want to discuss
 
I never thought writing a replacement for pickle would require graph theory...
handling references between immutable objects is a pain, you have to deserialize them in the correct order :/
 
11:23 AM
@Aran-Fey will you call it marinate? Also why isn't it called pyckle?
 
hah! as if I wanted my awesome module to be associated with pickle!
Also, I'm a firm believer in self-documenting names. I'm probably gonna call it "secure_serializer" or something of the sort
 
securealizer?
or serialcure :-p
 
@Aran-Fey avoid lawsuits by using secure_serializer_ymmw
 
@AshishNitinPatil I think we have different ideas about the meaning of "self-documenting"... :P
@AndrasDeak Yeah, in the back of my head I'm still worried that there's some vulnerability I've overlooked and all my efforts have been a waste of time
I posted a proof-of-concept on CodeReview, but all they've done is upvote it and I haven't received any feedback regarding the security
 
Maybe that's their way of saying it's good and they don't see anything they might object to?
 
11:35 AM
Possible. But it also means they aren't confident enough to post an answer stating "This is secure."
Heh, I like the idea of silence == approval
In my head I'm imagining an advert that goes like "Brand X toothpaste is the best toothpaste in the world! 10/10 dentists didn't object to the use of Brand X toothpaste!"
 
**apart from usual objections to gagging, we didn't find anything specific towards our toothpaste
 
@Aran-Fey you could try looking at pickle vulnerabilities and try to adapt them to yours
And I wonder if this could be on topic at Information Security; probably not
 
How does the tag have a logo / icon in front of it? Can't find it in edit info. Is it a sponsored thing by py-charm?
 
11:53 AM
@AndrasDeak Yeah, I don't think so either. Going through pickle's vulnerabilities is a good idea though
 
@AshishNitinPatil yup
"Sponsored tags"
 
@AndrasDeak yep, thanks. class="sponsor-tag-img" says it all anyway.
 
can anyone look into this ?
0
Q: How to use different combinations of group by while trying to get the top most viewed

pylearnerAm trying to get the top most rating using groupby of multiple columns and if there is no combination of that particular groupby, its throwing me an error . how to do multiple combinations ? data : maritalstatus gender age_range occ rating ma M young student PG ma ...

 
12:09 PM
This question complete with a third-party bounty is giving me hives. "How do I do pointless weird thing?". Bounty: "I want an elegant way to do pointless weird thing."
Oh, bounty posted by a 70k python gold badger :|
 
He's got a point though, all 3 answers are hacky in some way or another
 
Yes. OP wants a yamming hack!
"I want to turn this snake inside out...elegantly". Ignore the elegance of "grab tail from the inside, pull" in my example
 
Sure, it's an odd requirement, but asking for a string in a certain format isn't asking for a hack
 
Oh, and the 3rd answer came after the bounty was posted and doesn't even answer the question. That answerer has been on my radar for a while...
@Aran-Fey it's asking for broken JSON
 
What? Where?
 
12:20 PM
"I want a json where the keys are not strings"
Now the gold badger wants an elegant solution to Y
Preferably with json :D
 
The OP never mentions json, and the bounty message only suggests a json encoder as a possible solution
 
Of course not, OP dumped a single line of requirement...
> I'd like to see if there is a solution that doesnt involve manually building or running string replacements but instead extending upon existing library
Double the weird requirement fun
 
Agreed, that part doesn't make a whole lot of sense. Manually building the string sounds better than mutilating an existing library so that it produces different output
 
12:39 PM
Which the existing solutions were probably doing
You either put brackets and colons yourself, or you replace auto-built strings, at least at a quick glance
 
recbg
 
@AndrasDeak awful
it lacks motivation too so I downvoted it
 
12:56 PM
Voted no MCVE
I legit didn't notice OP's code image
 
1:39 PM
@AndrasDeak yeah......but at that rep level, knowingly putting an answer like that I really don't want to bother with the irritating discussion of defending that answer.
I think the answer should be delv'd but I don't have that privilege yet
 
@idjaw wouldn't be the first. And answering with crap is one thing; unhammering dupes is another (potential abuse of privileges)
 
@idjaw stop slacking captain and go catch yourself the whale some repz! :)
 
1:54 PM
time to challenge @idjaw to a repwhfarming duel
let's see who can answer the most typo questions until 20k
 
Lol super typo hunter
fgitw edition
 
@idjaw I'm disappointed at the lack of any deliberate typos :(
 
2:16 PM
The guy wrote his life's story as a function name. Do you think it is related to my question? — Sargsyan Grigor 9 mins ago
I guess I probably shouldn't respond to that.
Although, the answer to the related question is hilarious - stackoverflow.com/a/19985336/2689986
 
open-ended (or the aforementioned dupe, I'm not so convinced about that) stackoverflow.com/questions/48721582/…
 
It's an opinionated question else the dupe is perfect. There's no right or wrong way, since even the PEP does not address this in particular (doesn't feel the need to). — Ashish Nitin Patil 1 min ago
 
2:46 PM
@JonClements lol I did not even think of that. You are clearly the Ryu of typo fighter
 
I'm glad you think that rather than Chun Li :p
 
It would be really neat to have an inverse of Pandas' __str__/__repr__ function. In numpy, you can just recreate the array with np.array.
 
although, more like Blanca without coffee in the morning :p
@nnnmmm sure... but DataFrames aren't as simple as an np.array - they can contain more complicated objects...
 
I'm always Blanca without coffee
Then I'm lightning Blanca when I have coffee
 
I loved that game when younger... SF2 - I completed it with every character at level 7
played my nephew last year for a bit at some new one on Xbox/PS4 - not sure which - it's the marvel vs capcom universe or something - but it has a lot of the SF characters in it
I went for Ryu... (heck all the keypad movements are still the same even if my paws aren't quite as agile as they once were) - all the special moves I remember were still there... he didn't like losing that
"you've played this before - you're cheating - I hate you!" etc... etc...
 
2:54 PM
Hahaha that happened to me too
My cousin was really upset. But I had all my Ryu skills
I remember when my mom got me super Street fighter new challengers
I don't know how many times I finished it with all the characters
 
@nnnmmm If it helps, I've started writing something like that: gist.github.com/Aran-Fey/4dc69b64f5925932aa7b76c28cec1c67 Needs more field-testing though, I'm not sure how well it performs on real-world data.
 
>>> df = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6]})
>>> df
   a  b
0  1  4
1  2  5
2  3  6
>>> pd.read_table(io.StringIO(repr(df)),sep='\s+')
   a  b
0  1  4
1  2  5
2  3  6
@nnnmmm for simple cases that might work ^
 
@Aran-Fey, @AndrasDeak: Awesome, I'll try them out!
 
yeah, I guess datetimes are an extra pain
 
3:09 PM
@idjaw Mind you - he kept going for a few more hours... I was sitting there rubbing my paws that felt like they were constantly going to go into cramp... but I'm staying a puppy forever dammit! Although - notching up another year on the tree I scratch my year count into tomorrow sighs
 
 
2 hours later…
4:53 PM
@wim I'll be on and off all day so early congratulations on 10k votes cast :P
 
5:11 PM
Is django relevant to this chatroom?
 
wim
5:23 PM
yes
@AndrasDeak thanks. it's weird though, when I click on that number 9,994 in profile, I already have 10,054 votes cast (all) and only 7072+1818=8890 (up+down). something off in their accounting.
 
@wim deleted posts?
I know this came up before...but I can never remember the details
 
wim
5:52 PM
Her: "I just need time."
Me: "Okay. Yeah, I understand."
Her: "And some distance, as well."
Me: "Fine. But can I ask you one last question?"
Her: "Go ahead."
Me: "What are you calculating the velocity of, anyway?"
 
maybe she meant multiple data points and she will determine the jerk
 
hey can i get someone to try and install and run my shared coderpad and let me know if it works when you install it?
 
DSM
@AndrasDeak: wow, snap!
 
pip install git+git://github.com/joranbeasley/Flask-CoderPad#egg=CoderPad -U
ive not tried installing my "pip package" on any machines but mine
i would be shocked if it didnt work
 
DSM
6:08 PM
@AndrasDeak: that might not work in Hungarian, come to think of it. what word do you guys use for the derivative of jerk? snap or jounce?
 
well if you are using 2.7 and it didnt work ... i think python3 works too ... im double checking right now (I should have developed it in python3)
nope it breaks in python3 ... sorry fixing now (stupid print)
 
6:30 PM
@DSM we don't even use jerk... plus we use Hungarian :P
 
Hi all, maybe some Tkinter experts here - I have a Text widget that gives me a bogus width when queried with widget["width"]. It says 129 chars, but I can see (and count) that in the app it's actually over 160. Any ideas why this can be happening?
 
Engineers might use jerk but I know I've never heard of the quantity in Hungarian. There's a Hungarian wiki stub for jerk with a loan translation, but I can't tell if that's an accepted name and the page doesn't mention further derivatives
 
Or alternatively, maybe someone has an idea how to center a text if one doesn't know how many chars are in a line? :)
 
you can't even center text based on how many characters there are in a line. Unless you're 100% sure that the text will be displayed in a monospace font
which might actually also explain your text widget's "bogus" width: when it claims to be 129 characters wide, which character is it using as a reference?
 
@DSM weird wiki page calls it "snap" in Hungarian but only in parentheses hu.wikipedia.org/wiki/Jounce
 
6:43 PM
I have a hunch we might be onto something here, thx! :)
 
Uuuuh since when are wikipedia link hover previews a thing? I'm not hating it, but this is new to me
 
And your question, @Aran-Fey, is exactly what I'm wondering about now. I have no idea what it uses as a reference, but trying to enforce a monospaced font won't hurt. It shouldn't be hard in Tkinter, I guess
 
my only impression of tkinter (based purely on hearsay) is that anything can be hard in tkinter ;)
 
I don't know tkinter well enough to judge the difficulty of that task
 
I was surprised on the positive side (well, at least initially ;)). I embarked on a noble quest of making a game in it. Well, a Battleship clone, but still, a game is a game. And surprisingly it's seems quite feasible. But there are hiccups on the way, that is for sure
 
6:50 PM
awesome (the positive part, of course)
 
The moment I first realized tkinter might be not all that great was when I tried to make a scrollbar. I jumped ship very soon after that. To this day I don't know how to make things scroll in tkinter.
 
Make that two who can't make a scrollbar. As soon as any complexity is involved tkinter quickly becomes a nightmare
Well apart from a canvas and a few buttons.
 
I have a impression I read it used to be much worse, but improved recently (with all themed widgets and all), so maybe it was before all the changes for the better. Scrollbars aren't that bad - you just grid them along the widget they are to scroll and cross-bind some callbacks
But I grant you there are inconsistancies like trying to scroll horizontally a treeview - I learned here that the magic trick is to set a minwidth greater than an actual width (what?! well, yes :) )
 
Sep 11 '17 at 11:38, by Andras Deak
don't fix what ain't broken has a workaround
 
or that if you want to have an icon on a button you'd better do something more than just use an option argument image (like tie it additionally to some object's variable) or your image will be promptly garbage-collected (a bug afaik)
 
7:02 PM
that on the other hand is regular GUI stuff
matplotlib widgets tell you to bind stuff in order to prevent them from becoming inactive
 
well, I'm a noob so I don't notice such niceties :)
 
well, I'm not sure about objects passed as keywords, I read that about widget objects
@o'rety nah, it's not at all straightforward. It should be put somewhere highly visible in the documentation/howto
I was merely saying that that issue is not unique to tkinter at least
 
good to know
 
example: "To guarantee that the widget remains responsive and not garbage-collected, a reference to the object should be maintained by the user." on line 3 (and for every widget)
 
As to the answer to my question, I see the best tut that there is a way to ensure a platform independent monospaced font: TkFixedFont A standard fixed-width font.
 
7:08 PM
dir = dlg.GetDirectory() this is wrong right?
 
it throws a NameError for me
 
This is the moment I ask myself why I even posted that here.
 
7:22 PM
well it could be multiple adequate questions, but not in its current form
 
Well, for some reason my text widget won't change font to TkFixedFont or TkTextFont. I can change TkDefaultFont size or weight as much as I like, but it doesn't accept those other. Now, I have two problems :)
Somehow I don't see you guys running to try tkinter :)
 
You're not changing the TkDefaultFont, are you? That sounds like something you should change before creating a widget. Sorry if this evident, also I'm just guessing here. Then again if you gave a very short example of what you're trying that doesn't work, I wouldn't be coming up with vague guesses (I'd just shut up :P)
 
I'm not changing the fonts themselves (you can do it by calling configure on a font's instance and then the changes are visible in all widgets that use that font). I'm trying to pass a different font at the widget's creation time. As to a working snippet it's problematic as the setup is quite complicated, but I guess I'll have to try with a bare-bones text widget in Python shell
 
well, that's what an MCVE is for :P
 
8:08 PM
I know, I know :). Well, passing Courier works and the names Courier, Times, and Helvetica are guaranteed to be supported (and mapped to an appropriate monospaced, serif, or sans-serif font) so that's something. Still I don't see why TkFixedFont wouldn't want to work, but I'm sure there's some good reason for it :)
 
8:32 PM
But thx again @AndrasDeak, because your answer was definitely correct. The widget gave me real width, but it probably measures it in some monospaced font (probably the same that get set with Courier) and as I was using the default sans-serif it reported 129 but actually wrapped text further as it could fit more chars than with a monospaced font. Then when I tried to center text with str.center() the result was an off-centered text
Thx to you I at least know now what hit me. That shouldn't be a problem generally because as I learned in the meantime the proper way to center text in a tkinter text widget is to use tags and option justife=center. Still not being able to set font to TkFixedFont bugs but as I wouldn't want a monospaced font in my app anyway that's not really a problem
 
glad to hear that :)
 
9:30 PM
Hello. Python ignoramus here. I found this followup question posted as an answer when reviewing in the Late Answers queue stackoverflow.com/a/48725294/397817 I suggested OP repost it as a question and was told he already had. I see it has been dupe hammered stackoverflow.com/q/48723859/397817 As a non-expert it looks to me like a reasonable followup but ofc it could be utter rubbish! :) Could any of you good folks advise as to whether it is worthy of a reopen-pls?
 
Hello. Being closed as a dupe doesn't imply it's rubbish. It means that it has been asked and answered already, not more and not less.
so the question you should be asking: is it really a dupe?
 
Yes. Is it, under close scrutiny, a dupe? And if it is not a dupe is that an mvce/otherwise on-topic?
 
I don't like the dangling xlim call, but more importantly, I don't see anything of size 200 in OP's edited code
 
Essentially I'm trying to establish it if is a followup, or the same question worded differently :)
 
that suggests that their update is at least missing an MCVE
How is its being a follow-up matter, or what do you exactly mean by a follow-up?
 
9:37 PM
Well if you look at it how I arrived at it (the question posted as an answer), it was presented as "I tried to do something, building on the answers here, and get unexpected results". In such cases we are told to flag as Not An Answer and suggest asking a new question.
 
Oh, sorry, I missed that bit. Yes, NAA+suggesting asking a new one is adequate. But then OP needs to explain what doesn't work, which essentially makes it a debugging question
So you did right, it's just that OP might need some more prodding/exposition
I added a few helpful comments. I wouldn't reopen the question until OP solves their MCVE problem.
 
OK. I think I've done all I can here :) Nice chatting with you, and thanks for giving the OP some guidance. Much appreciated!
 
thanks, no problem
 
11:03 PM
What's the best data structure to use if I have to repeatedly delete objects from it, and the objects can potentially be unhashable?
The only remotely efficient solution I can think of is to have a set of the objects' ids, and a dict to map each id to the actual object
 
that's just a dict?
Do you really need the set to go with it?
 
... I just realized that, too
this serializer thing is going to make my head explode :(
 
It's good to have a rubber deak :)
 
quack ;)
 
11:08 PM
Hmm, but since I'll be deleting values from the dict while iterating over it, I still need a second data structure to avoid getting a dict changed size during iteration error
I wonder if it's more efficient to use a set like I said earlier, or iterate over list(dic.values())
 
can't you pass over it once and create a new dict?
your latter could be viable too
or even set(dic.keys())
(I know you meant keys)
 
no, I meant values :P
the objects are unhashable, remember?
 
I thought you just want to remove the id and you're done. I don't know the context of what you're actually doing with those objects :)
 
...true. Anyways, I should probably stop worrying about this kind of optimization and just try to get this thing up and running
 
that might be a viable strategy too ;)
 
11:27 PM
I know python is a high-level language, but come on. Why is working with low-level data so difficult? AttributeError: 'bytes' object has no attribute 'format' ಠ_ಠ
 
bytes objects support %-formatting
 
If you created those bytes, why not turn it into a string?
 
@vaultah But only since 3.5
I'm working with bytes here; converting everything to string just so I can use format doesn't sound very appealing
 
As I see it, bytes are data and formatting is thus meaningless...
 
besides, the data might not even decode to string correctly
 
11:31 PM
if you want to string-format it, it's ultimately a string which happens to be encoded
 
I'm just looking for an efficient way to insert byte data into other byte data, i.e. something better than repeatedly concatenating
 
Did you time str.format vs str concat?
 
I used b''.join as a workaround, but format would be nicer
 
why?
I'd say that would be abuse, semantically speaking, and maybe even slower on strings (??)
 
@Aran-Fey you could use slice assignment on bytearrays
 
11:33 PM
format is more readable IMO
 
Are we talking about b''.join([bytes1,bytes2]) vs b'{}{}'.wish_there_were_a_format(bytes1,bytes2)?
 
Nah, I'd just concatenate them if that were the case. I have more than 2 values and there are separators between them
 
So you'd build a format string by multiplying?
 
@vaultah Hmm, I don't think that helps. I'd probably mess up the indices for the slice assignment :p
@AndrasDeak Basically it's b''.join([b'a', val1, b'b', val2, b'c', val3, b'd']) vs b'a{}b{}c{}d'.format(val1, val2, val3)
 
zip the fields and the separators for additional obfuscation? :P
 
11:43 PM
Maybe I'm catering to pre-3.5 users too much and should just go with the %-formatting vaultah suggested
 
pre-3.5? :|
huh, released only two and a half years ago
 
Yeah, I usually try to be compatible with 3.4
 
afternoon cbg to all
 
I discovered through a comment that this exists. I'm adding it to my bank.
 

« first day (2674 days earlier)      last day (2272 days later) »