« first day (2440 days earlier)      last day (2507 days later) » 
00:00 - 16:0016:00 - 00:00

i'm a python beginner so i think thats the reason why its that messy ;)
 
Could you please provide a minimal, complete, and verifiable example? You can read the file in the Python shell into a variable, and then use its repr, like >>> decompressed_data -> b'\x12\x34...' in the pasted code. — Antti Haapala 4 hours ago
@enderland I even added this^, but no, not even a weakest attempt to understand what I wrote there...
hmhmhm
 
Their issue isn't actually with zlib, it's not understanding the difference between a hex representation and a string
 
@enderland serves you right for helping. Stop helping.
:)
 
@idjaw I did. downvoted and VtC :|
 
4:02 PM
@KevinMGranger I don't think their data is even deflated...
 
and to be fair, I wasn't totally helping
 
you need to do the thing that is most right
in their case: to persuade them to find another profession/hobby.
 
lol
 
I haven't asked questions that silly ever since I was 13 or so...
 
Ah, the good ol treat beginners who make mistakes but are incredibly polite like garbage. That'll haze 'em in good.
 
4:04 PM
they're not polite
if they were polite they'd try to actually understand what they're being told
 
You don't know that they're not trying, just that they're not succeeding. Attempting to infer intent is a tricky, perhaps impossible, and perhaps harmful exercise.
I mean, yeah, they shouldn't be asking duplicate, poorly formed questions, don't get me wrong. But "persuade them to find another profession/hobby" is a bit much, no?
 
naah is it?
 
Definitely a bit too much.
 
it will have 2 possible outcomes: they give up or they're more determined.
 
Considering one of the rules of SO is "be nice", yes, I'd say it's a bit much
 
4:06 PM
Determined but slightly disheartened?
 
when it comes to programming, I am a social darwinist :D
 
I don't like the possibility of taking away someone's chance at becoming good at something.
@AnttiHaapala classic, but this would be welcome if it were Reddit, probably not SO.
:)
 
@AshishNitinPatil it should be even more on SO
the amount of time that gets wasted "helping" people who cannot be helped is mind boggling
 
let's remember, I've been mostly answering these days...
 
There's no need for social darwinism when SO already has mechanisms to prevent problem users from returning
 
4:09 PM
you'd be disillusioned too...
no one ever has even try to go to a library to borrow a single text book on the subject to actually try to learn something
 
kids these days
 
there is a constant influx of new users, and the questions are truly bad
 
How do you know that though? We sure spend a lot of time telling question askers that we're not psychic, yet somehow know their history 🙃
 
all of them are duplicates, but there are 10 things wrong with the question and one can only close as a duplicate of 5 q's
 
Different people, different methods, different reasons to ask a question. I am okay with existing checks / measures in place.
 
4:11 PM
the python questions usually have just one problem...
 
the indentation?
 
> close as "this question should be deleted and you should feel bad"
 
but the C programmers they write a 375-line program...
 
@Rawing I thought along the lines of "script kiddies"
 
@enderland that would come with a 1-year suspension... and seems that he's just finished serving his sentence.
 
4:14 PM
@AnttiHaapala hah someone got suspended for that? lol
 
@enderland not just once.
 
> the gravitationally-challenged Parking Enforcement Officer downtown.
 
What does that even mean? They regularly float into the sky?
 
> You voted to close this question 15 mins ago Retract Close Vote
 
4:16 PM
@enderland Your profile pic is a good way to enforce someone to be nice to you.
 
@AshishNitinPatil you'd be surprised, lol
 
@enderland Maybe, but it's the internet people. They keep showing their true qualities on a regular basis. So I might somewhat expect it :-p
 
It might just be that your data isn't zlib-compressed, which then couldn't be changed by asking on Stack Overflow for the nth time. You need to produce a Minimal, Complete, and Verifiable Example - MCVE which includes the actual binary data that you believe is zlib-compressed in the format as output by print(repr(open('mybinary.bin', 'rb').read())). — Antti Haapala 7 secs ago
 
@AshishNitinPatil I'm pretty patient and willing to assume good intent
serves me well as an oppressive moderator
 
ok now someone even upvoted that q
 
4:24 PM
They probably saw it with the latest edits, I hope.
And didn't see much further...
 
In essence you're asking "what does the English language sentence "xe vys lfonclame ptsi n jo dria onestas u rasha lillinsre ppav gossc garidd" mean?" I have absolutely no idea what it could possibly mean but it sure doesn't look like English to me. — Antti Haapala 5 secs ago
lol awesome :D
 
@enderland Just curious, isn't workplace.stackexchange more like a subReddit? How do you even enforce SO-like rules over there?
 
I used a markov chain to generate that text from English words :D
so Google Translate detects that as English
 
ooh, nice way to hide sarcasm?! :D
 
I can't tell if Dive into Python is aimed at complete beginners or at people coming from other languages... the hell is this author doing
 
4:29 PM
@Rawing shouln't you be reading LPTHW?
 
I am, but I realized I'd never read any of the other python tutorials, so I wanted to compare
 
@AshishNitinPatil it's really, really hard hah
 
I guessed so. Good luck being a mod :)
The QnA look quite good though. Without memes, it's just not reddit hehe
 
4:42 PM
It's hard because everything is by nature more "discussiony" and people feel compelled to make their opinions on everything known
 
37
Q: MCVE shortcut link in chat

Code-ApprenticeMany of the shortcut links to help topics work in chat, including [ask], [answer], [main], and [meta]. This is a very useful feature. However, [mcve] does not work. Can we get the [mcve] shortcut in chat? While you are at it, enable the help/* links as well.

 
@enderland and how about laws and regulations then :D
with Python it is easy: Guido's word is law.
 
This would be fantastic. The process of 1. open tab 2. look up "mcve stackoverflow" 3. copy link 4. past link back in chat. 5. question why I do this.....is not fun. — idjaw 13 secs ago
 
@AnttiHaapala explicit legal questions are off topic
 
but everything is implicitly related to laws and regulations and culture...
 
4:45 PM
@AnttiHaapala BDFL!
 
like, the language that we use in professional settings in Finland would get us banned in no time on stack overflow.
5
 
Yeah, well, a lot of people don't realize how company/geographic culture vary
 
@AnttiHaapala I am curious now. Links? Pastebin?
 
Hah, Linus himself! Thanks.
 
4:52 PM
@idjaw I saw that
 
@Code-Apprentice lol....you know...I never use bookmarks
If I can't fit it on my bookmarks tab under my address bar, then I'm saving too many things
I feel like I'm not being very effective in my browsing
 
I wish Chrome allowed for double bookmark rows, or at least double-tab rows
 
I have to many bookmarks. I don't know why I bother because google
 
there is no culture of PC in Finland.
 
4:54 PM
culture of PC?
 
political correctness
 
I use a few bookmarks regularly. But the vast majority are just noise
@AnttiHaapala how do I move there?
Do I need work visa, employer sponsorship, etc?
 
I think you primarily need resistance to cold.
 
@Code-Apprentice well, Usians do need a residence permit...
I am not sure if you could be granted asylum yet :D
easiest to marry a Finnish girl (or guy)
 
5:21 PM
man I love that feeling where you aircode something for like 3 hours and it magically works first try
 
what's aircode?
 
coding without running/testing anything as you go
 
@MarcusS when that happens, I get really scared because I know I didn't actually get it right on the first try lol
 
@mkingsbu Yeah I definitely get that fear, too, haha -- "This can't be right... where's the error?"
 
Hi, `check_call` is not working with this command, do you know why?
```
from subprocess import check_call
check_call("echo 'my string' >> test.txt".split())
```
 
5:25 PM
>> is a shell feature. Should work if you pass shell=True to check_call.
and don't .split()
 
alternatively, since preferably not using shell=True is preferred, you will have to do a bit of extra work to redirect shell output to a file inside Python
this is well explained in a couple of answers...1 min
 
I love the silence here... perfect coding environment.
the city has opened the libraries for self-service outside regular hours...
 
@mertyildiran how about:
with open('test.txt', 'a') as f:
    print('my string', file=f)
 
@mertyildiran As a side note - you need to split your code into its own message and use the 'fixed font' button to the right hand side: SO chat is a little different
 
5:29 PM
don't use the shell, like, ever, unless needed.
 
from pathlib import Path
Path('text.txt').write_text('my string')
 
even better
and as an extra it doesn't work out of box in Python 2 :d
 
Also Antti's approach is a lot healthier for doing what your example is trying to do, unless you were creating a contrived example that wasn't an MCVE
only problem with the pathlib approach is it's equivalent to echo "my string" > text.txt, not >>
 
pathlib is my new favorite module in stdlib
 
^ me too
it's been shockingly great
 
5:31 PM
the thing that I hate about pathlib is that it is really hard to keep track of which python 3 version each feature appeared in
 
Yeah right, I can write to a file using open() is better. @Rawing check_call("echo 'my string' >> test.txt".split(),shell=True) did not work.
 
ubuntu LTS still runs 3.5
 
@PaulMcGuire YES!
 
@mertyildiran then remove the .split() part there
 
@mertyildiran you're better off just not bothering with shell=True and yes, you would have to not pass a list with shell=True, therefore as mentioned, do not do the split() call
 
5:33 PM
@idjaw Is that right? I think you can pass either a list or string, regardless of what you set shell to
 
@Rawing no it doesn't work with .split() there
 
hmm
 
@AnttiHaapala @idjaw @Rawing removing .split() and adding shell=True argument solved the problem. Thank you so much!
 
I am not sure yet why
@mertyildiran it solved a problem, but not all of your problems.
you're still using the shell which is another problem
 
@mertyildiran necessary information on what it means to use shell=True -> stackoverflow.com/questions/3172470/…
 
5:34 PM
@AnttiHaapala of course, but that's not because it's a list, it's because .split() turns it into an invalid list
 
just to make sure you are sure you are OK with having shell=True in your code
 
so you're using a screwdriver to hit a hammer to drive a screw into a wall.
 
@AnttiHaapala that's a post installation command...
What is the disadvantage of using shell=True
 
@Rawing what invalid list?
 
@Rawing you are right, passing a list of strings with shell=True does work for check_call.
@mertyildiran read the link I gave you
 
5:36 PM
@AnttiHaapala With .split() you get ['echo', "'my", "string'", ...] instead of ['echo', 'my string', ...]
 
of course
 
I guess "invalid" wasn't the best word to use there
 
@idjaw security concern right?
 
yes
 
@idjaw OK thanks a lot!
 
5:37 PM
[pid 26740] execve("/bin/sh", ["/bin/sh", "-c", "echo", "'my", "string'", ">>", "test.txt"], [/* 123 vars */] <unfinished ...>
 
@mertyildiran +1
 
@mertyildiran ^so that is the reason.
it executes /bin/sh -c 'echo' "'my" "string'" ">>" "test.txt"
 
Use shlex.split to preserve quoted strings
 
@PaulMcGuire that has nothing to do with this.
 
Ok - I thought @Rawing's post was about that
 
5:40 PM
so what will happen is that /bin/sh -c 'echo' will execute echo in shell; that will cause one newline to be printed to stdout. Then 'my, string', >> and test.txt will be provided as arguments to this inline script (i.e. the script echo, which naturally doesn't use any arguments)
 
It kind of was. I wasn't aware python would quote the >> operator
 
perhaps that should be asked on SO
 
subprocess is super weird on windows. I've learned to never use lists if I'm planning to run a script on windows
 
           -c               Read commands from the command_string operand instead of from the
                            standard input.  Special parameter 0 will be set from the command_name
                            operand and the positional parameters ($1, $2, etc.)  set from the
                            remaining argument operands.
Windows is weird, I've learnt to never use it for any work.
 
unfortunately some programs don't work on linux :(
 
5:48 PM
someday I will be able to do rudimentary CSS :\
 
the first time I tried my hand at CSS I was like "I heard bad things about this, but how bad can it really be?". 3 hours later I was like "Nothing makes sense D:"
 
I "learned" CSS in a C# class in college. The professor breezed through it in like 5 minutes and was like, "super simple, right everyone? So that'll be on the final next week! Okay its been a good semester, see you at the final!"
All of our finals looked like they were coded by a middle school student in like 1995
 
For the life of me I can't get a relatively simple component to allow for two directions of scrolling
 
Hi, I have one more question. Someone edited one of my old answers and put # PUT YOUR PRE-INSTALL SCRIPT HERE or CALL A FUNCTION text but it seems like pre-install execution is not possible. stackoverflow.com/a/36902139/2104879
Do you have any idea? Am I doing something wrong? Is it possible to execute a pre-installation script? Also from pre-install what do we mean? Before the installation of dependencies and package itself or what? What this function is doing for example: github.com/pypa/setuptools/blob/master/setuptools/command/… (briefly)
 
No, that's exactly what it means
if you want to do something before your install stuff is run, or after your install stuff is run, you put that code where the comments tell you
 
5:58 PM
No but putting before or after develop.run(self) does not make any difference.
Both of the positions are executed after all dependencies and package installations done.
 
you sure about that?
 
6:11 PM
@WayneWerner yes I'm pretty sure. Please try it yourself: github.com/DragonComputer/Dragonfire/blob/master/…
 
that's way more than an mcve
 
@WayneWerner then add a similar code block to pypa/sampleproject and test it yourself.
 
6:36 PM
since laughing at yourself is important....I'm going to share this one
I just discovered what spacebar does when you highlight a file in MacOSX
I never knew I could do that....
you're welcome btw
 
@idjaw Mac OS X is full of surprises :D
 
I'm putting this on me using the shell more than the finder
that's what I'm going with
 
6:52 PM
@idjaw why are you using finder? :P
 
@enderland Midnight Commander? :D
 
wim
LMAO "obviously that is incorrect" stackoverflow.com/questions/44684101/…
shame-deleted ... maybe +10k users can still see
 
is there a dupe for "I didn't use a raw string literal for my file path"? I can't seem to find anything that fits
 
This looks decent.
 
That works. Just need to add an answer that uses r-strings. Thanks
 
7:17 PM
hello guys i have some srt files that have .en in there names, I want to remove that, I tried string.replace and many re tricks including re.sub nothing works

if file.endswith('.srt'):
file = re.sub(r'.en', "", file)
 
@PetterFriberg thanks! :D
 
alt +c inst working on my keyboard and indent is gone sorry
 
if file.endswith('.srt'):
    os.rename(file, file.replace('.en', ''))
 
thanks im getting OSError: [Errno 2] No such file or directory

wrong path from my side?
 
Try using the full file path instead of just the file name: file = os.path.join(r'/path/to/wherever', file)
 
7:24 PM
We'd need to see more of your code, like what is file and where does it come from. Even if the keyboard shortcut isn't working, you could use the right click menu
 
8:11 PM
TMW you realize why your local changes are not getting reflected in the interactive python shell... the shell was on the remote test machine... glad it wasn't production (likely would not have been).
 
8:21 PM
@enderland haha...a very good question. I'm in the very rare occasion of doing some minor front end tests for a backend piece I'm trying to fix and it requires downloading a file that is crafted by making a bunch of API calls. So when I download the file, I want to quickly look at the contents, and it was just really easy to just use the finder in this case.
 
why don't keyboard shortcuts for mac work here?
 
agh anyone else get weird knuckle-lock after using their laptop a while?
 
^^ yes
I thought I was alone in this too
 
copy on a mac is Cmd/Super+C, not Alt+C
 
 
8:33 PM
@idjaw our neighbors grill started on fire recently lol
 
@enderland lol that happened to me on saturday
it was stupid
I finished bbqing and I guess there was too much fat dripping down the grill
 
there's was a grease pan fire in a gas grill
 
I thought copy was forbidden by Apple products.
 
so when I closed the bbq and come back to scrape the grill there was a big woooosh
 
wim
anyone used + together?
I had a pretty nice setup where there was a session fixture in conftest
and I would pass the session around explicitly (so code under test would get passed a session bound to a test engine, and that transaction would be rolled back between tests)
but now when you have to test some code which doesn't accept a session , it needs to creates its own session objects - multiple ones - how do you test it ??
i know you can bind the Session object (capital S) , but how do you do the transaction rollback thing
 
8:39 PM
I've never done that combination explicitly. However, if you can bind the session object, then wouldn't the teardown-type code you are using after each test take care of the rollback?
 
@wim I ran into a very similar issue recently. I solved it by making the "session" part of the object I used to coordinate the requests, and then my tests can just assign that as needed :\
 
wim
who has the responsibility to close the session instance? code under test, or test code?
 
it depends. Does your code under test handle session closing already?
I believe it should
does sqlalchemy have some kind of test client that still opens/closes sessions to handle all this for you?
 
wim
not that I could find, sadly
and pytest hangs hard at teardown if you don't close the session, e.g. unhandled exception
it's tricky!
 
@wim too bad :D
I use Pyramid, all my functions will get the session (or actually the request, which will contain a reference to the dbsession as an attribute).
 
8:49 PM
in the sqlalchemy code, they seem to handle all the session teardowns in different tearDown and tearDownClass methods
don't know if this might provide some inspiration. But they seem to be doing this: github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/testing/…
 
9:23 PM
Man, why are so many official docs/tutorials so poorly written
craziness
 
Because you haven't sent improvements to them yet
boom
 
@MarcusS let's make Docs.SO to fix it! /s
 
they haven't given up on that yet/
it's still a thing?
 
9:40 PM
interesting. on google maps, I've noticed that the pins that show up as "orange" are places that I've searched for and went to. I just realized that a "new" place that I went to on Monday is now just sitting on my map as a point of reference
interesting
 
@poke wooooooo awesome job, man:)
thanks for the ping
in other news: hope y'all weren't too interesting today because I can't read through more than a day's transcript tomorrow :P
 
Some of us figured out the sole universal truth but other than that it was same old, same old.
 
Has Kevin finally figured out whether his code halts?
if he did, I don't see it on the starboard
 
@KevinMGranger I wasn't one of them. I was reading LPTHW the whole day.
 
@poke I also grudgingly note how I wasn't implicitly included in "gentlemen" :|
 
10:02 PM
alright. big bug finished. deployed, and working
time to go home
rbrb
now the question is...did I fix a bug? or did I just deploy a bug?
I'll never tell
 
writing big bugs is much harder, especially the kind that lingers and hids in the rug
rhubarb, idjaw
I'm off too
 
10:58 PM
@AndrasDeak Oh, no no, I just wanted to point you out explicitly since you gave me the ultimate motivation to get this done!
So thanks for that!
 
11:53 PM
I have kind of a beginners question, but I can't seem to find the right search term. I have some for loop over l from say 0 to 4 that is supposed to execucte the command line command "python3.6 script.py --l l" for all the values of l I am looping over. However, after running l = n it should wait until that command finishes executing before continuing the loop to l = n + 1. How should I do this? docs.python.org/3.5/library/subprocess.html#subprocess.run sounds like it should be related
 
for i in range(4):
    subprocess.run("python3.6 script.py --l {}".format(i))
 
00:00 - 16:0016:00 - 00:00

« first day (2440 days earlier)      last day (2507 days later) »