« first day (1645 days earlier)      last day (3294 days later) » 

1:42 AM
cbg
 
 
3 hours later…
5:03 AM
bleh I'm struggling finding sqlalchemy info
Either the docs are poorly formatted for the beginning user, or I'm just dumber than I think I am.
writing a unit test for a declared model and I want setUp to create a new blank sqlite db, write some test data, and cleanUp to delete the db afterwards because I don't need it anymore. What do I have to do to my engine or session or something to make sure os.remove(db_path) doesn't throw an OSError since it's being used?
 
6:03 AM
@AdamSmith use linux? :D
(ducks)
 
Am, actually :P. It appears I was overly concerned.
 
Cbg
 
it just worked.
 
only in windows you cannot delete a file that is "being used"
 
6:40 AM
@Kneel-Before-ZOD Hello!
 
cbg
 
cbg avinash
 
cbg
 
7:03 AM
cbg
 
Hey up
 
I'm here for the first time and the salad language is bananas :D
 
I have an object (a function)
how do I get its source line?
and file
hmm I get it from code
 
Does inspect have something?
 
no
or dunno
 
7:11 AM
I've just found it in function.__code__
 
but anw, func.__code__.co_linename, co_firstlineno
what I realized was that why don't I have a code in ipython or so
that I can type edit(function)
and it will open the right file on the right line :D
but how do I get class body's first line?
 
Someone who has experience in SQLAlchemy: this is an old answer is it still valid?
 
dunno
 
@AnttiHaapala are you seriously asking, or just making a quiz show?
 
i'd not use sqlite for anything
@Vyktor seriously asking
but you are asnwering so slow that i find the answers faster myself
 
7:16 AM
I'm packing :D
 
Nothing wrong with sqlite =/
 
hmm
inspect.getsourcelines(b.update_package_from_json)
works
returns a tuple of lines + first line number
 
Second Rikudo - Any reviews?
 
works
    _, lineno = inspect.getsourcelines(obj)
    filename = inspect.getsourcefile(obj)
    subprocess.call(['nano', '+%d' % lineno, filename])
hehe :d
saves 1 minute each hour
 
Dan
if anyone has a moment, I'm a little confused on how to inherit init fields from a parent
i.e. I have fields the parent has and I want children to get those fields plus new ones in their instantiation
 
7:24 AM
@Dan ask away :P
 
Dan
 
yuck. Give us text.
 
Dan
^^ how do I get mc to take three numbers?
 
@Dan your childclass must take all those arguments
and then consume some and pass others to the parent...
in this case your childclass __init__ must be
 
Dan
@AnttiHaapala example code link?
 
7:26 AM
class ChildClass(TestClass):
    def __init__(self, num3, *args, **kwargs):
        self.num3 = num3
        super(ChildClass, self).__init__(*args, **kwargs)
 
def __init__(self, num1, num2, num3):
    super().__init__(num1, num2)
    self.num3 = num3
 
though note that now you're constructing as mc = ChildClass(3, 1, 2)
 
Dan
@AdamSmith ahh ok
that makes sense
 
@Dan ^
this
 
Dan
^^ awesome!
Thanks, that always throws me off for some reason
 
7:31 AM
How do I unit test a table with a ForeignKey? Can I mock the foreign class, or do I have to build a real one?
 
@AdamSmith you don't really unittest with db
so you can stop pretending :D
 
That sounds like lunacy. Unit tests are amazing
 
Missing monitoring is amazing ;)
 
7:56 AM
@AdamSmith no, the point is that you're not testing your unit
because sqlalchemy crosses the unit boundaries :d
ah this too
 
Yeah that blog post was one of the google results that I got. Doesn't really apply to me, since I will be deploying on sqlite and I was already doing pretty much the same thing as far as the framework goes.
ty though
 
Cbg
OK, so, disclaimer: I'm an idiot, but that aside, is what I'm saying sensible stackoverflow.com/a/29714335/1773904 - perhaps you could also achieve the same result more simply?
 
8:12 AM
No I think it's great
 
TY :)
 
Dan
Anyone ever use ObjectListView with wxPython before who knows if its possible to exclude/hide/specify columns from the objects passed to the list control?
 
Second reminder for everyone to vote, help our good Pythonistas out! :D
 
8:27 AM
adding to the list of relevant xkcd's for every occasion:
 
Hah, saw that yesterday :)
 
8:52 AM
@AdamSmith copy-paste the link only, SO chat will recognize it is an xkcd comic
 
^ like this ;)
 
huh. Cool!
 
ikr?
 
There is a question in Quora. "How do you judge a Python programmer by only 5 questions?"
 
8:54 AM
If the first question isn't the implied question in the greeting: "Cabbage," the answer is wrong.
 
^^ :D
 
9:28 AM
okay so
it's 2:30 in the morning
how'd that happen? Rhubarb all
 
9:46 AM
@thefourtheye the first one would be: "python 2 or 3"
 
@AnttiHaapala "Why" would make a good next question I guess ;)
 
the thing is:
if one says "Python 2 bc that is what I like"
then he is not a python programmer :D
just a luddite:d
I mean any person who says "Python 2 because it didn't get things wrong like Python 3"
like... ???????
it is different thing to say "I am using Python 2 because I am forced to, but I'm unhappy with it.
 
Following are the five questions suggested by one guy
 
Does anyone have any good examples/websites/resources for interview logic questions/case studies/stuff?
 
> 1) What do you prefer/use for indentation purpose, Space or TAB?
2) What is iterator, generator? example of both.
3) What is List-comprehension and Dictionary-comprehension? how and where would you use these, example?
4) What is decorator? create one.
5) Why are there 2 versions of Python? which one do you use/prefer and why
 
9:59 AM
I probably should have asked last night when it was busier.
 
Hi all. Anyone have any direction to point to start with python? I have couple of years experience with "php/js/html/css" -stuff and I am willing to learn new language just for fun at this point.
 
10:16 AM
@makallio85 the most important is: use Python 3, check that your tutorials are Python 3
do not trust anyone who says "Python 3 is not mature enough", instead at this point you should skip whatever does not support Python 3 :D
 
What is the main diff between 2 and 3?
Or is chat room too small to explain? :D
 
I propose including the following as a Canon dupe. This has better answers than most of the dupes for this problem
61
Q: Loop "Forgets" to Remove Some Items

user2520385in this code I am trying to create a function anti_vowel that will remove all vowels (aeiouAEIOU) from a string. I think it should work ok, but when I run it, the sample text "Hey look Words!" is returned as "Hy lk Words!". It "forgets" to remove the last 'o'. How can this be? text = "Hey look ...

 
they are not strictly compatible
if you have bad python 2 code it will not work in Python 3
whereas most of python 2.0 code would work in 2.7
Python 3 has been out for 7 years now, and python 2 gets bugfixes only
 
Okay, that explains enough :D
 
but loads of code exists for Python 2 only
 
10:18 AM
@AnttiHaapala lol, I like the way you handled it. "bad" Python 2 code :D
 
I guess it is widely supported currently then
 
and there are ppl who say "I do not want to convert"
but more important is to realize that ... those libraries which were not ported will be usually replaced by something else, and better for Python 3
ppl are arguing that out of 55000 packages on the Python Package Index, only 5000 support Python 3
 
but 50 % of those remaining packages were abandoned 10 years ago... :D
 
@AnttiHaapala umm.. actually that's not a python specific problem at all: look at the adoption of C99 => it has been 16 years, and still not all compilers can produce C99 compliant code.
 
10:20 AM
and replaced by something else...
 
Someone destroyed his own question. What should i flag it for?
 
Strange for me as I have used to PHP's backwards compatibility and deprecated methods
 
(not to mention C11)
 
@PeterVaro microsoft does not have a C compiler
@makallio85 php 4 -> 5 was even greater incompatibility
than the rift between python 2 and Python 3
 
@AnttiHaapala it is not about that, it is more like: developers are lazy fudgers..
 
10:22 AM
Okay, I thought it would have been bigger hop in Python... But Ill guess ill go with 3 then
 
@makallio85 if you find something that is Python 2 only, come here and ask for alternatives or I can help porting it...
 
I guess Ill spend enough time with basics at this point :D
 
if you want to do web applications, I'd suggest looking into flask and/or django, after which you should look into Pyramid (whose slogan is "your 2nd and last python web framework)
for Python 3 tutorial, read the official one first :D
 
Actually, I dont have anything spcific in my mind... I guess I have good tools for webapps in PHP scene. I want to learn something new :D
Bu thanks anyway
 
"good tools for webapps in PHP scene"
:D
so they all say
 
10:25 AM
lol :D
 
I do not do PHP myself anymore, thank god, but all my friends who have to deal with it and also know python, say it is still the worst s**t ever :D
@makallio85 where are you living btw?
 
I have come to the wrong chatroom.. "Go away heretic" :D
 
no, there are no heretics
 
Täss Jyväskylässä ollaan :D
 
I don't know much Python folks in Jyväskylä :D
 
in Helsinki they have meetups every month at some company
attendance is free and usually there is also snacks and drinks and maybe even beer
for free
and here in Oulu, nothing at all :D
 
Ill guess ill find something reasonable mini-project to start with
beer+programming != good for me :D
 
I didn't mean that it is mandatory
 
Of course it is. It is free :D
 
still a student eh?
:D
 
10:30 AM
I was thinking same, but no
 
anyway, if you get stuck then do come and ask here
 
yep, thanks seeya
 
@thefourtheye That wasn't low-quality-flag worthy.
Keep LQ flags for nonsense posts, not for bad unhelpful answers.
 
just delete :d
 
Foreign language answers, for example.
 
10:33 AM
@MartijnPieters actually it was just a comment/criticizing
if you mean the m/d/y
 
@AnttiHaapala Right, at which point it be a NAA flag.
Not VLQ.
 
@makallio85 nice pike btw
 
I do think it was meant to be an answer though.
One spectacularily wrong.
 
Murica
 
cbg
 
10:40 AM
@MartijnPieters Oh okay.
 
Ah @Antti you here! Have a small doubt for you
This is true?
 
yes, though you could remove the 'of them' :P
 
Kuusi Palaa
 
actually there is much less possibility of confusion
just that you cannot ask "what is 'kuusi palaa'" in English without getting at least that many answers
 
11:05 AM
There are 4 universities in Illinois. I just counted them. — Lego Stormtroopr 4 mins ago
 
cbg
 
@thefourtheye yeah, very funny but not helpful..
Flagged it as non-constructive.
 
Yay! Another flag!
 
Should this be closed as a typo? The OP's problems were caused because he accidentally defined his turtle twice. stackoverflow.com/questions/29715183/python-turtle-trouble
 
Oh, we ll get to flag a lot of comments then :-)
 
11:09 AM
@thefourtheye yes, any comment that is making fun at the expense of the question asker is fair game.
117
Q: A guide to moderating comments

Shog9Commenting is one of the unsung heroes of Stack Exchange. The help center suggestions that you should submit a comment if you want to: Request clarification from the author; Leave constructive criticism that guides the author in improving the post; Add relevant but minor or transient i...

 
Cool, I ll keep this in mind. Thanks @MartijnPieters :-)
 
> Even if you don't personally find them offensive, those one-liner contests are often good examples of non constructive comments: "pithy" jokes at the authors' expense, "snarky" advice meant more to score points with the commenter's peers than to inform or educate, and tangential personal observations all fall into this category.
 
this answer made my day askubuntu.com/a/436491
> None of the above worked for me so I am copying the answer from stackoverflow.com/questions/16093331/…
:D
 
dunno why the quesiton is closed :d
 
I spent half an hour trying to update R
Finally I googled
:(
Forgot that Google is the answer to the universe and in terms of distress, we have to look up to Google first
Huh!
What an error!
Depends: r-base-core (>= 3.2.0-1precise) but it is not going to be installed
but it is not going to be installed
Why?
Aargh Python is soo easy
 
11:25 AM
@AnttiHaapala arguably that's a computer support question, not a programming problem.
 
@user5061 I suspect that this is homework & the OP is trying to destroy the evidence that he got help on SO.
 
@MartijnPieters tools related to programming, of course it could be "offtopic, ask on ask ubuntu"
but it is a real question
 
@AnttiHaapala which is why there is a post on Ask Ubuntu reusing the procedure now.. sigh.
 
I can roll it back to the previous revision, but I guess it also needs a flag so a moderator can lock it to stop the OP from re-vandalizing it.
 
Yeah, the close reason is a little.. out of date.
But I don't see any point in re-opening then reclosing.
 
11:27 AM
@MartijnPieters notably it was a self-answered question
 
@PM2Ring If the OP rolls back again it'll be auto-flagged for mod attention.
So leave it be for now.
 
Cool. Thanks, Martijn.
 
And PM, I'm clickin the yellow star on that :)
 
If they make another vandalism edit, then by all means flag it for mod attention though.
 
Just to track changes to it
 
11:29 AM
@BhargavRao exactly, adding it to your starred questions lets Stack Overflow do the work of watching the post for you.
 
Yep! You had taught me this a few months ago!!!
:)
Fond memories
 
The downside is that really dubious questions can win the OP a favorite-related badge. :)
 
40 people watching on a question just to check if he rolls back?
Err far far thoughts
:D
 
which reminds me
 
11:37 AM
Hmmm, Death of meta tags makes a meta tag, if OP actually tagged or
 
nahh
I just hate [ansi]
the truth is all the frikkin answers need to be retagged by hand
 
:D
Antti and Ansi, A better love story than Twilight
 
I do some at a time...
but the thing is [ansi][c] actually does not tell at all what is it about
what is ansi/sparc
 
Thinking of adding your name here
As the burninator of Ansi
 
11:45 AM
Er! Wait
> Antti Haapala (born 19??) The burninator of ANSI
 
I created a new tag
 
Perfect entry
 
I created a tag for ansi-sparc :d
total 2 questions ever fit under this
 
Aargh Download struck on 99%
 
@MartijnPieters I removed the comment.
 
11:51 AM
@davidism maybe I need the "web developer" script for ansi
 
I hope you're using a resumable downloader, Bhargav...
 
Obvi!
\o/ finished downloading, now back to work
Rbrb all
:D
 
I have soon verified that all [c][ansi] remaining need to be [c89]
 
I am trying to print the histogram on an image and get the following error:
Traceback (most recent call last):
File "C:\Users\Raj\Desktop\arrowOCR\test.py", line 6, in <module>
print(im.histogram())
File "C:\Python34\lib\site-packages\PIL\Image.py", line 1225, in histogram
self.load()
File "C:\Python34\lib\site-packages\PIL\Image.py", line 751, in load
self.im.putpalette(*self.palette.getdata())
ValueError: unrecognized raw mode
any idea what this means please?
 
12:02 PM
@Ffisegydd I've just rediscovered some of my muscles in my body => I've totally forgot they were there all along -- but now they are burning as hell :) Are you still rowing btw?
 
@Peter nah. When I was an undergraduate I used to use it when I went to the gym for cardio.
 
@SurajKhosla Do you understand what "raw mode" means?
 
@Ffisegydd I see.. however these ergometers nowadays have fantastic computers
you can connect them to real time 3D rowing competitions and such
 
@PM2Ring no sorry, I am new to this, checking google.
 
(so if you were still rowing, we could race against each other)
 
12:06 PM
@SurajKhosla Ok. A raw image is one with just the pixel data and no width, height or depth info. So PIL doesn't know how to interpret your data. BTW are using the old PIL or the new version, Pillow ?
 
@PM2Ring thanks for explaining this, I will check this now
 
@PM2Ring does PIL even support python3.4
The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later.
guess this tells it all :D
 
hmm that's strange, I am using the following code:
from PIL import Image

im = Image.open("testimg.gif")
im = im.convert("P")

print (im.histogram())
I get the error
however, as soon as i change to png and change the file format, it works
 
is the file even a gif
 
yes, saved from paint
 
12:15 PM
wow that didn't actually convince me at all
can you print(repr(im))
there right after Image.open()
it will actually tell what kind of image PIL(low) expects to read
ah no
I concur that
@SurajKhosla GIF is in palette mode already
 
output: <PIL.GifImagePlugin.GifImageFile image mode=P size=84x22 at 0x2AA47D0>
 
so remove im.convert('P')
that will just do something fishy with the existing palette
 
woohoo, thank you!
 
>>> x= Image.open('ds_obj.gif')
>>> x.histogram()
[0, 1, 1, 1, 1, 4, 2, 2, 5, 2, 2, 5, 2, 6, 2, 1, 1, 1, 1, 12, 1, 1, 2, 2, 2, 1, 2, 2, 22, 5, 2, 1, 3, 2, 5, 1, 1, 1, 1, 3, 2, 5, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 6, 3, 5, 2, 8, 1, 2, 2, 2, 3, 2, 3, 8, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 
works perfectly, thank you!
 
12:19 PM
you can check: if im.mode == 'P' or so...
and complain that the image isn't palettized
alternatively, convert to greyscale (stackoverflow.com/questions/4199522/list-of-image-modes) (mode L)
 
will check it out, thank you
 
@AnttiHaapala Yeah. I've never use the 'P' mode for convert() in PIL/Pillow. The docs aren't very clear what it does when applied to an image that has its own palette.
 
ah someone should contact PIL already and tell them to die
I hate when I google
Maybe we should hire some chinese hackers to replace the PIL docs with a redirect :D
 
:)
I suppose it's sort of understandable that Pillow throws an exception when you tell it to convert an image to P mode when its already in P mode. But it's still not very nice; it should just return a copy of the original image, IMHO.
 
now I could really use some tool to replace [ansi][c] with [c89] [c]
262 of those
 
12:35 PM
I don't do much C these days, so I must admit my in-depth C knowledge is a little rusty. But I can still do C (but not C++) so I had a look at the C tag a few weeks ago, thinking I might be able to answer a question or two. But the quality of the questions I looked at was depressingly bad.
 
@MartijnPieters I wonder if you'd get 2 great answers there with 1 hit :d
@PM2Ring ofc it is
there should be a special offtopic close reason for undefined behaviour
like there are questions that "why does this work this way"
I guess everyone who really needs C already can do it
and those who can't and need to learn it are hopeless :d
 
@AnttiHaapala Yep. On the one hand, I'm kinda glad that there are still people who want to learn plain C in this day & age; OTOH, they seem to be a pretty weird bunch, judging from the quality of the questions they ask on SO. :)
:slaps OP with a wet albatross:
I managed to fix the problem i realized it was impossible or catx == 50 because my programs has it go up in sixes and 6 is not a factor of 50 — Towtow10 42 mins ago
 
delvd
 
And rightly so.
 
@AnttiHaapala :-P I wanted to illustrate that it is easy to reproduce the issue, and show screenshots about what the difference looks like. When creating the screenshot for the historical revision it hit me that if I posted an edit to that form I'd illustrate it even better!
 
12:48 PM
You can't tell from the comment timestamps, but the OP didn't respond to requests for clarification for almost an hour. So he deserved to get his question closed.
 
@thefourtheye: I keep seeing Lego Stormtroopr trying to be snarky; he has different ideas about what comments are for.
At some point he'll reach 'moderator attention' level with the number of flags his comments must be raising.
 
@PeterVaro Mate you could set your Rift up and pretend you're rowing in the Oxbridge Boat Race :P
 
@Ffisegydd believe it or not, I had the exact same idea -- not specially with the OBR but simply rowing in VR
 
1:09 PM
Do I have to cast all 3 votes?
P.s. Cbg
 
@Robert no you don't
 
I rolled the dice and did so anyway :)
 
1:34 PM
If people don't mind divulging, who's their 3rd vote?
 
Matt. Voted for him last year too.
 
Good, that's who I was hovering over too
I'm a bit gutted that no female candidates made the cut
Can't you just use split()?
 
I have a question people. There is this programming question that doesn't have any limits in input lines, so the input instead of being given in one line, it is given as multiple lines of varying length. How can I get the input seperated by white spaces
 
Damnit, am I invisible again?
 
1:45 PM
Yes, yes you are.
 
I need to keep away from the GC-161 then :/
 
cbg
 
Please, I really need help!
 
From file or from stdin or from where @MikhailTal ?
 
See the exercise and evaluate from yourself
I think it uses something like freopen for c++
That is exercise 1
 
1:54 PM
How does the salad language work? Is saying "garlic" appropriate here?
 
I need help because this time the inputs have been made to purge python users
 
cbg(vyktor)
 
@IntrepidBrit third was Jeremy Banks, but can't really tell you why. Just picked one :)
 
Anyone here that can help me?
 
2:10 PM
@MikhailTal Your question is unclear, and your link doesn't seem to be relevant.
 
Okay let me explain again
Normally the input should have been:
6
1 2 3 4 5 6

But now it is:
6
1 2 3
4 5 6

In the test files it might be:
6
1 2 3 4
56
 
@Vyktor Cabbage, Vyktor. Yes, "garlic" may be appropriate at this point in time.
 
So I need to know if there are any other ways to take python input other than the line
 
Garlic!
 
ANyone?
 
2:14 PM
Garlic!
 
@MikhailTal You can solve this problem reading the file line by line. Read the first line to get the total number of integers, then read subsequent lines, gathering integers from them until the desired amount of integers has been read.
Now try to convert my suggestion into code.
 
is there really no space between the 5 and 6 there?
 
Yeah sure, a space @AnttiHaapala
Thanks @PM2Ring
 
V jnf tbvat gb jevgr fbzr pbqr ohg gur fzryy bs tneyvp vf gbb fgebat.
Arrgh! OP doesn't know the difference between accepting & upvoting. stackoverflow.com/questions/29717424/…
 
I gave them os.path.join(os.getcwd(), 'www.example.com/images/dog.png') they said "Not quite the answer I am looking for"
With no explanation
 
2:25 PM
@PM2Ring: npx
 
npx ?
 
ebg13?
 
@vaultah Yes, I saw that. But I wasn't expecting you to delete your answer. So I figured they didn't know how to make the multiple directories and expanded on your answer a bit. :)
@vaultah Lrf
 
cbg all
 
cbg Jon
 

« first day (1645 days earlier)      last day (3294 days later) »