« first day (1579 days earlier)      last day (3594 days later) » 

Anyone know how to change the ipython's background color to black?
user559633
does it work for ipython qtconsole?
user559633
idk
user559633
01:53
i dont know
03:18
(no ping in case you're not actually here but) Hey Martijn - don't you have something somewhere on the usefulness or otherwise of e.g. sending iterators to sorted() etc.? Would like to post a link to back this comment up:
A couple of minor nits – 1: sorted() has to convert testdic.iteritems() into a list before sorting it, so you might as well just use testdic.items() (in fact, it should be marginally faster), and 2: there's no need for key=itemgetter(0): the tuples will be lexicographically sorted anyway. — Zero Piraeus 9 mins ago
 
2 hours later…
05:47
@ZeroPiraeus Are you sure? Those are few canon questions... Many other pages might have linked to these questions... Closing them, fine; but deleting them?
@thefourtheye They're fundamentally wrong for SO - the accepted answers are over five and six years old rspectively, and they're both resource requests, so they're bound to go out of date (and be practically impossible to fix) if they haven't already. Let Reddit answer questions like that.
If many pages are linking to information that can't be considered reliable, and will certainly be flat out wrong at some point, those links should die.
is admittedly something of an ideologue on this point
Hmmm... Its a valid point, but I wish an expert in those areas can update the answers with latest information...
On an introspective note, it's interesting to me that I'm a deletionist on SO but an anti-deletionist on Wikipedia (in theory, anyway – I very rarely edit anything on the big W).
06:09
lol...
cbg @Antti :-)
@ZeroPiraeus so... viewed 134025 times
(5) the first
the snmp is utter shit
Any latest updates on this? Any new Python SNMP libraries? – abarik yesterday
06:34
CBG all
@AnttiHaapala Baleeted :-)
Might have gone "too broad" for the Flask/Bottle one, if it weren't for Armin's answer.
07:01
if anyone says "disclaimer, I'm the author" then it warrants it to be closed as a primarily opinionated
I've seen admirably neutral answers from people heavily involved in the development of a particular technology – as much as many of us owe to Mr. Ronacher, neutrality is not his strong suit ;-)
if it weren't primarily opinionated question, answer could say: "This is the solution, I am the author"
08:02
cbg
Happy birthday to me, happy birthday to me, woof bark yellow puppy... woof bark to me...
Happy Birthday @Jon! (There's gotta be some joke about dog years here ...)
3
or that every dog has his day? or something...
Happy birthday mate.
thanks mate
just waiting for someone to photoshop a D onto the hat :)
Conical hats seem to be the fashion in canine revelry.
08:15
@JonClements Pupppy :-) Happy birthday to you :-)
@Zero wow... just yeah.... sighs :p
It's all the vogue in Paris, daaaaahhhhhling.
Ahhh... blame the French... kinda works for me :p
Goddammit I appear to be entirely incompetent. I was trying to pin your "happy birthday to me" message, apparently failed, and then managed to pin my own message. Grr ...
Nooooo!
Do either of you have anymore comments on the agenda? I know you've already made some Zero, but Jon?
Let me know if you do, and I'll put the stuff on the RO trello into the actual agenda today sometime
08:22
@Ffisegydd I'll have a more thorough look some point today
It's nothing earth shattering.
Well... it's in some sense re-assuring there's not much to discuss...
I didn't say there weren't serious points :P just they shouldn't be unexpected (maybe "earth shattering" is a bad term for that :P)
@JonClements I will try to remember to congratulate you on fourth of April too
@Antti Thanks!?
08:30
like the next year :D
Bleh I should get up and go to work D:
@JonClements Happy Birthday. ;-)
@Ffisegydd probably not a bad idea :)
@Ashwini cheers
09:42
re-cbg
anw, @JonClements Happy Birthday, you're under or over 300 dog years now?
@AnttiHaapala thanks... let's just say... closer to 280 than I'd like? :p
cbg!
guys how can i run my init function of class in class's itself without creating instance of the class?
hi I'm using
subprocess.call(cmd,shell=True,stderr=subprocess.STDOUT,stdout = subprocess.PIPE)
But still getting return code as 1, is there a way to get only output and not return code
my cmd=tail --line=+4181 /my/file | head --lines=222 | egrep --regexp="STRING"
09:53
@KeremZaman you can but really you can't
@KeremZaman sounds like you have an XY problem
@AnttiHaapala What do you mean?
542
Q: What is the XY problem?

GnomeWhat is the XY problem? When asking questions, how do I recognize when I'm falling into it? How do I avoid it? Return to FAQ index

59
A: What is the XY problem?

Steven PennyThe X-Y Problem, as it is sometimes called, is a mental block which leads to enormous amounts of wasted time and energy, both on the part of people asking for help, and on the part of those providing help. It often goes something like this User wants to do X. User doesn't know how to do X, but ...

@KeremZaman ^
can anyone plz help on my previous post
is there a way to get only output from subprocess and not the return code
10:14
@AnttiHaapala no, my question isn't xy problem, it isn't about a problem, it is about the method which I will/should follow
ok: you shouldn't call an __init__ method without an object, it is called to initialize a new object
@user1977867 do not direct stderr to see the error message:
do...
and do not redirect stderr
@AnttiHaapala when i use subprocess.call(cmd,shell=True,stdout = subprocess.PIPE)
tail: write error: Broken pipe
1
yes
because you need to use subprocess.check_output
Bam. I now have the most commonly closed dupes in the Python tag.
@davidism I have a present for you :P
-2
Q: I'm stuck with a advanced questions with printing errors

William DILLONI am here today to ask you a question! It will be fun times with us! I am having the issues with a printer! Oh no you are crying. Well yes, the shock is true. I try and try to print my text but it is having a fail. my code is as follows: pront ("hello stackers")

BURN IT WITH FIRE
10:21
Smells like a troll.
@AnttiHaapala i mistyped the last post. I'm using
subprocess.check_output(cmd,shell=True)
tail: write error: Broken pipe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'tail --line=+4181 /my/file | head --lines=222 | egrep --regexp="STRING"' returned non-zero exit status 1
pront that's clearly an i/o problem
now, what is the regexp
probably shell breaks it
10:24
no @AnttiHaapala , it runs fine on unix
@AnttiHaapala thanks
@user1977867 You do know that grep (and its variants) return 1 if the pattern is unmatched, right? Also, why are you running grep inside Python? Why not just use the re module?
@PM2Ring there is still the write error with tail
guess there is something funny going on with the shell and it is not sigpiping right
ah no
@PM2Ring you're right
ummm... appear to have gotten 2 silvers and a bronze all of a sudden... that's nice
@user1977867 the tail error means that your file is very large compared to the pipe buffer in Unix
10:29
@AnttiHaapala user1977867's last comment indicates that the command runs ok in the shell, so I'm assuming that tail & head are succeeding ok.
@PM2Ring thanks, I just used to use status,op=commads.getstatusoutput, then check if op =="" , which meant no match.
and as @PM2Ring said, it always returns the error 1
hello
i am in amazon hell
yes
@PM2Ring subprocess.check_output does not do SIGPIPE right
% tail --line=+1 bigfile | head --lines=2 | egrep --regexp="root"; echo $?
1
so I get 1 in zsh, but with python one gets the write error additionally (along with the 1)
so your command didn't work well in shell either
@AnttiHaapala although I'm new to python, but 1 thing i realised while debugging is tha, when this file is created by cron job, no broken pipe error occurs however if i kill the process that created the file and restart the process using nohup, broken pipe occurs
10:32
@AnttiHaapala Interesting. All the more reason to use re instead of grepping in a subprocess. :)
@PM2Ring actually it is python 2 that breaks the sigpipe somehow
I run on Python 3 and I do not get the pipe error from tail
>>> subprocess.check_output('tail --line=+1 Untitled-2.psd | head --lines=2 | egrep --regexp="root"', shell=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.4/subprocess.py", line 616, in check_output
    raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command 'tail --line=+1 Untitled-2.psd | head --lines=2 | egrep --regexp="root"' returned non-zero exit status 1
@AnttiHaapala Ok
>>> subprocess.check_output('tail --line=+1 Untitled-2.psd | head --lines=2 | egrep --regexp="root"', shell=True)
tail: kirjoitusvirhe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'tail --line=+1 Untitled-2.psd | head --lines=2 | egrep --regexp="root"' returned non-zero exit status 1
sorry for using finnish locale there :D
so python 3 above, python 2 below
used a .psd file I had in my home directory bc it was large :d
@user1977867 so, the question is not only about python, but how your pipeline should behave
@user1977867 IIRC, AnttiHaapala posted something here last night about there being an old Python bug about signal handling, specifically relating to restarting interrupted jobs.
maybe you can do: 'tail --line=+1 file | head --lines=2 | egrep --regexp="STRING"; [ "$?" -le 1 ]'
@PM2Ring yeah, not the problem here though
10:37
FWIW, according to the grep docs "Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to run unmodified." IOW, grep -E is preferred over egrep in new code.
A picture of all the python dupes. Yes I know it's ugly.
@AnttiHaapala ok,u mean i modify my command. I'll try that. But I'm afraid I did not understand what's the problem here, can you please explain.
check output raises an exception if command returns non-zero code
which might be a good idea...
however for grep, exit code 1 is normal behaviour when no lines are matched...
@user1977867 I bet Kevin's "asking a user until they provide valid input" is big there?
10:39
alternatively you can do
@JonClements you mean me? :P Yes it is, it's second place! But because it's actually closed as a dupe of a Martijn answer, Martijn wins.
I'm not convinced I've got all the dupes though, seems like the number is too low.
@JonClements Happy birthday!
ummph... not even like f and u are next to each other on the keyboard - interesting typo
nor typed with the same paw :)
@PM2Ring cheers :)
p = subprocess.Popen(cmd, shell=True, stdout=PIPE)
output = p.communicate()[0]
if p.returncode >= 2:
    raise Exception("Command failed with exit code %d" % p.returncode)
@JonClements Happy birthday! , btw i didnt understand "I bet Kevin's "asking a user until they provide valid input" is big there?
10:42
@user1977867 guess that was destined to @Ffisegydd, right @JonClements
@user1977867 I was responding to @Ffisegydd but was reading stuff at the same time, mind just went on automatic when doing the @ - my bad
Bleh I need to learn more SQL.
ok no problems, people use slang here which sometimes goes overhead. I'm glad it wasnt the case this time :D
@Ffisegydd ask :d
10:43
An ex-colleague of mine when I asked him quickly... (he was having lunch - reading a paper), "is the job going out on Wednesday" - he said "yeah, it'll be ready strawberry"
@Antti at the moment data.stackexchange.com/stackoverflow/query/272476/… gets every single dupe close. But ideally I just want the dupe closes for the Python tag. And ideally I don't even want them, I just want the count.
he was reading an article about UK strawberry production at the time... but it made me chuckle
Basically I've got 9000 results in my graph, and that seems too low.
umm... 9000 nodes can sound right...
@AnttiHaapala in your code, I do get output=="", and solves my problem. But that grep thing, does that mean this==> grep returned an exit code $? as 1 , which for check_output is an error
10:46
Really? We've got 330,000 Qs in the tag as of the dump roughly, does 9000 sound enough?
@Ffisegydd well - how many edges do you have?
yes, check_output checks the return code of the subprocess, and raises exception if != 0
Actually, maybe that does sound okay, that'd be ~3% of Qs as dupes.
and grep OTOH:
@Jon I'm not doubting my graph work yet :P I'm doubting I've gotten all the dupes out of mongodb in the first place.
10:48
EXIT STATUS
       The  exit  status  is  0 if selected lines are found, and 1 if not found.  If an error occurred the exit status is 2.  (Note: POSIX error handling
       code should check for '2' or greater.)
@Ffisegydd What mongo query did you execute?
see there: exit status is 1 if lines not found
@Ffisegydd wouldn't count on mongodb on that :d
when I get the tax return stuff out of hands, maybe I should look into nidaba etc and hack some nice sqlalchemy with postgresql
@Antti any and all effort is welcome :p
That'd be awesome. I'm having a break from it right now due to other stuff I have to do, but I'm doing this one duplicate question as davidism asked for it and it shouldn't take too long.
@Ffisegydd the worst part about mongo is that it uses enormous amounts of diskspace and ram for even an eeny teeny weeny db.
10:51
@Antti that's true - but we've got an 8gb RAM server and nearly 200gb SSD - so that's not an issue
ok, makes sense @AnttiHaapala , and what does p.communicate()[0] do here, I tried

p = subprocess.Popen(cmd, shell=True, stdout=PIPE)
>>> tail: write error: Broken pipe

>>> p.communicate()[0]
''
p.communicate returns stdout, stderr
so I took the first of them with [0]
or you can do stdout, _ = p.communicate()
but i tried viwing[1] also
p.communicate()[1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 746, in communicate
stdout = _eintr_retry_call(self.stdout.read)
File "/usr/lib/python2.7/subprocess.py", line 478, in _eintr_retry_call
return func(*args)
ValueError: I/O operation on closed file
10:53
ah because it is not piped
ok i got it
we didnt use sterrr=PIPE
right
@user1977867 Exactly, so stderr is still going to the terminal
and is there a way to write this in a way that broken pipe does not occur
although I'm only concerned about output
One of my favouite Finns, Erja Lyytinen, playing her song Grip of the Blues (audio with still photos).
was WTF when just living to if live: lbc.co.uk/…
how an organisation (in this case a union) can choose to put someone like that on the air... wow... way to go fellas
11:06
Managed to sort that SQL query out. 9k nodes does look about right, but I am missing some old old old dupes (they used a different numbering system back in the day)
Ok we have 14153 nodes in our graph.
@Ffisegydd What are you using to make the graph?
@PM2Ring I got the results out of mongodb into a dict then constructed my graph object using networkx from the dict.
In the dict each key is a child and the value is a list of parents.
So I just iterate over the dict, add the nodes, then add edges between child and parent.
@Ffisegydd I've never used NetworkX, but it might be worthwhile creating the graph as an SVG for nicer zooming. Or exporting it as a GraphViz DOT file, which can easily be manipulated and displayed in a variety of ways, and saved in a variety of image formats, both bitmapped and structured graphics.
@PM2Ring yeah I'll probably export the json and use D3.js to produce a nice SVG so we can put it on the web.
But that's a job for later, for now I should do some work :/
Yeah. Making big graphs look better can be a never-ending task.
11:21
I found a nice D3.js tutorial that I can start with, allows dragging and zooming etc. The only issue to start with is exporting the data from Python into the appropriate format for D3.js to work with.
@thefourtheye Try Better Call Saul. Two episodes are out. Looks good.
@AshwiniChaudhary Awesome :-) Are they continuing with Jesse?
> Aaron Paul announced having had "serious talks" with Gilligan for possible guest appearance but later told The Huffington Post it was not going to happen.
Trivia page said otherwise :'(
No Jesse so far, he and WW may show up in guest apperances later.
@AshwiniChaudhary But WW cannot come right?
p = subprocess.Popen(cmd, shell=True, stdout=PIPE) , when i use this on python command shell, it doesnt retrun to the usual
>>>
until i press enter. Using this in my parent python script doesnt work
strange that in the .py script it does not work. However on python terminal it works fine. Does it have somthing to do with waiting for output?
11:27
@thefourtheye Only Saul Goodman, Mike and Tuco so far. Why not? The writers can adjust the story to make that possible. You know Jesse was supposed to be killed at the end of S01, but he acted so well that they had to adjust. :)
@AshwiniChaudhary Oh, Good that they didn't kill him... Many episodes were interesting simply because of him...
@poke and his problems :D
Accidentally deleted half of the data on my phone… Only reason it's half is because it happened while I was backing up the other half… >_<
:(
I wanted to free space from my phone, so I moved all the stuff I didn’t need off it. Only the stuff I thought “yeah, you probably still need that” I left on the phone.. and then I continued cleaning up stuff and accidentally deleted a folder that apparently ended up deleting everything (I hate MTP…)
@thefourtheye Specially his "Yo Bitch!"ing. :D He even released an iOS app, and all it does is that it says "Yo Bitch" in various tones.
11:40
So the stuff I wanted to keep on the phone is gone now >_<
Currently making a raw partition backup, so I can try running a data recovery on it…
@AshwiniChaudhary I liked the conversations between him and Skinny Pete very much...
Don't forget Badger, his voice is very similar to Vince Gilligan: youtube.com/watch?v=Y6swv4aAZ4U
What do you flag a non-English answer as?
12:10
Cabbage
Could someone check this answer for me?
1
A: Autopopulate a set of generic many to many fields in Django?

AnentropicIt looks to me like CharacterSkillLink itself is your through model in this case... it generically joins a content type to a SkillAbility If you think about it, it also makes sense that if you're doing a bulk_create the objects that you pass in must be of the same model you're doing a bulk_creat...

sorry for fly-by chat room posting, hope this doesn't count as asking about a question....
@MartijnPieters, @Kevin I want to modify my original score on Whiplash, it is not 10/10, it is 9.9/10 (because of the car scene => you will understand I'm sure)
@MartijnPieters thanks for catching my python question earlier. I did try googling 'list of nones' but I didn't see anything
@Pureferret google for "print returns none" instead. :-)
@MartijnPieters Thanks, I didn't think it was specific to Print, but obviously I should have tested that
12:45
cbg
SyntaxError: Missing parentheses in call to 'print'
>>> print 'foo'
  File "<stdin>", line 1
    print 'foo'
              ^
SyntaxError: Missing parentheses in call to 'print'
>>> pront 'foo'
  File "<stdin>", line 1
    pront 'foo'
              ^
SyntaxError: invalid syntax
didn't notice this ever before
>>> exec 'foo'
  File "<stdin>", line 1
    exec 'foo'
             ^
SyntaxError: Missing parentheses in call to 'exec'
re-cbg
is this new?
yes, that is most welcome
@Antti yeah Nick Coghlan also made an SO post for canonical closing.
20
Q: What does "SyntaxError: Missing parentheses in call to 'print'" mean in Python?

ncoghlanWhen I try to use a print statement in Python, it gives me this error: >>> print "Hello world!" File "<stdin>", line 1 print "Hello world!" ^ SyntaxError: Missing parentheses in call to 'print' What does that mean?

yeah found
stackoverflow.com/a/7246700/918959 flagged this as NaA, 110 upvotes
13:04
I hope they close that question, it's clearly OT.
Closed.
Just edit 95 inlined images into that answer, I don't see what the problem is
@AnttiHaapala I'm a little surprised there isn't a specific flag for link-only answers, since there are quite common.
@Kevin Or insert the video itself as a data URI.
Oh, it's not even 95 slides, because most of them are the same as the previous slide except there's one more bullet point
I was joking before, but it might be possible to do this. Do posts have an image limit?
@Kevin In that case, it could be converted to an animated SVG. :)
13:10
Ok, it gets much more dense after the 30th slide, so maybe not again.
Yay! I just got an Excavator badge for fixing the spelling of "pseudocode" in stackoverflow.com/a/434411/4014959
So close to Marshal. Just need the mods to accept 5 more flags :P
@Ffisegydd Cool! I've got a long way before I get that one. I'm a bit scared of flagging things in case they get declined. OTOH, almost all my flags have been accepted.
I only have 481 helpful flags to go!!!
Start now and you may be ready in time for Christmas hats!
13:18
@Kevin how many helpful flags do you want?
481 plus the number of helpful flags I already have :-)
Making a total of?
500. Just enough for the badge.
13:19
you do not follow the room well enough
Yeah, once you get the badge it becomes pointless obviously.
during 1 week i have made almost 100
I was being snarky because I thought "He can just look at my profile to see how many I have!" but maybe that's something that only I can see.
only you can see afaik
at least i cannot see in anyone else's profiles
I can see them, but that's because I've got my x-ray glasses on.
13:21
Hmm, map-territory confusion in this post? Or just the OP not knowing what a list is?
Maybe both.
I'd say both.
@Ffisegydd I have X-ray glasses too, but they're too good. All I can see are stars.
close it asap
Hmm, that joke might not actually work, since I think the atmosphere blocks X-rays from beyond our planet.
@Kevin Badge? What Badge? Note: if you care about badges, you are tools of the Man.
@Kevin It's always Ok to be snarky. As long as you are also witty.
Snarky without witty is just sad.
13:25
I'm already a tool just by answering questions. None of that sweet ad money is going into my pocket.
@Kevin we need to have a revolution.
From now on, all of my answers will be encrypted, with the key available for 0.01 bitcoins.
that's way too low.
0.02 bitcoins!
I assume most 1 rep users are 12 year olds. If they're going to charge to their mother's borrowed credit card, the fees need to be relatively small.
13:28
hey
that's actually pretty cool...
should suggest that with stackexchange...
"2 dollars? Little billy must have bought a five pack of lives for Candy Crush again"
they could take 2 % commission
I'm pretty sure "thanking" people with e-money has already been suggested, not sure about charging people for the answer.
seriosly someone even had to UPVOTE this insightful question
13:29
Well, I think that [the rest of this comment is only available to Gold level subscribers]
@Martijn what are we flagging with? A custom message? Do you have one prepared?
Haha, "pront". That made me smile.
Not sure what to flag as though.
everyone flags with offensive :D:D
@Ffisegydd custom message, yes.
Asking a moderator to apply the nuclear option; remove the account altogether.
I went with something like "probably a troll, as a good-faith user wouldn't make these kind of mistakes"
Although the mod might read my flag and say, "I'm no Python expert, how am I to know that these typos are basic?"
13:33
this is the second pront from the same user guy...
Maybe pront is a classic newbie error! Who knows!
Voting to delete.
There we go, Cyber bit and now gets a troll response.
Needs reproducing code (ideally with English input prompts)
enter a speed.
Yay, I still can read (some) French.
If the turtle is supposed to be tracing out a parabola, then the second part works on my machine.
13:44
@Kevin pront is an i/o error... or to be more precise s/i/o/ :)
Oops, looks like numinput is a valid turtle function, but only in 3.X.
@PM2Ring Heh.
@Kevin I suppose the OP didn't realize that it's a Python3 thing, so I guess we can't criticize him for not using the Python 3 tag... But we can criticize him for not trimming his code down to a MCVE
2
Q: Apply Python syntax highlighting for [python-3.5]

Samuel LelièvreThe still-in-the-works Python 3.5 already has a tag on StackOverflow. Can someone make the python-3.5 tag trigger Python syntax highlighting? Note: tag info pages for similar tags python-2, python-2.1 to python-2.7, python-3, python-3.1 to python-3.4, all end with the line: Code Language (u...

Whoops, usually when I get that wrong it is in the other direction.. :-P
@PM2Ring Yeah, he even wrote "From this line until the while True it is only the drawing section, not very relevant" as a comment, so he's knowingly subjecting us to more code than we need!
It seems to be a common problem with tkinter / turtle programmers. And they tend to write vast amounts of crap that could be condensed with a few strategic functions, or even simple for loops.
13:52
(Devil's advocate: the code that he doesn't think is relevant kind of is, as it might be harder to debug the program if the background doesn't get drawn)
True, but he could still do a MCVE with a basic background.
That whole first part just draws a green rectangle and a brown triangle. You could definitely do that with ten lines if you write a fill_poly(coords, color) function.
Yep. But I guess he might not be familiar with such "advanced" functions.

« first day (1579 days earlier)      last day (3594 days later) »