« first day (3120 days earlier)      last day (1820 days later) » 

6:04 PM
I've reconsidered offering a bounty on the dependencies question. Maybe someone who actually knows stuff about packaging wants to offer one? I feel like we could get much, much better answers to that question
 
Thinking about it some more, free_list is empty when python.exe first spins up, but that doesn't necessarily mean it's empty by the time the first bytecode instruction executes.
 
<feels stupid for not understanding why that question is so important>
 
It's super unimportant, I just enjoy getting fixated on unfalsifiable CPython implementation details
 
I was referring to the one that Aran-Fey has posted twice
 
Oh, right. I do think there is value in providing clearer guidance on deploying Python projects. Knowing how to do package dependencies is useful to anyone that wants to share nontrivial code with anyone else.
 
6:12 PM
Sure, but could a good answer even fit in SO format?
 
If you're thinking "sure, but there are lots of things that ought to have clearer guidance, so why this topic specifically?"... Gotta start somewhere
 
Wouldn't it be in the documentation; to revise it?
I really don't know how it works, but the question itself is unremarkable to me, so I doubt I'd find the answer even if a good one is posted
It must have hit HNQ now so it's pulling in the views. The answers are unremarkable - is there a shining answer to be had?
 
I think so, but I might be wrong
Hence why I changed my mind about posting a bounty, because I know jack about the topic
 
I know jack too :)
 
I don't feel qualified to give a strong "yes" or "no" answer to "could a good answer even fit in SO format?"
 
6:18 PM
Something just seems a bit wonky is all
pip install YourPackage
pip install -r requirements.txt YourPackage
 
That's pretty much why I thought the question could be very useful - a lot of people know jack about the topic, even though it's a rather important one
 
That apparently solves the problem, since it was accepted
 
This isn't the first time the quality of a question has been paradoxically dependent on the quality of its answers
 
Packaging & distribution of Python stuff is a problem area, and probably its biggest weak point. If it were easy, there wouldn't be all these people wanting to make executables from their Python stuff.
 
@Aran-Fey why do you not know about this topic? Is it because there's a lack of resources or just because you've never needed to look?
 
6:21 PM
In any case I think a Q&A can be straightforward and short and even dull while still being worthy of canonicalization
If anything, the top voted posts on SO are too fun
 
@roganjosh A bit of both I think. Mostly because I never needed to look, but I did try to wrap my head around packaging once - it didn't end well, and I didn't remember most of it
 
@roganjosh It hit the HNQ 3 hours ago.
 
@roganjosh If there was, surely a definitive answer would be found on python.org. Alas, it seems there is currently no simple universal answer, even for fairly common use cases.
 
I'm the same as Aran-Fey, I have researched it and basically forgot it. Doesn't mean we're going to get a stellar answer on SO
 
m8_
Hey ya'll, if I have the following groupby, groupby_test =df["test"].groupby(df["ID"]), how can I check if the groups contain all items from a list? test_list = ["test1", "test2", "test3"]
 
Pie
6:27 PM
How can i see list of questions which had bounty for python?
 
stackoverflow.com/questions/tagged/… shows questions which currently have bounties. I don't know if there's any way to see questions that have ever had bounties at any time
 
@m8_ do you have an MCVE?
 
m8_
one sec
So I'm cool with changing up the code, but I just want to group a dataframe by a unique identifier and then check to see if each unique identifier contains all values from a list
this is just how I started to code it but not sure if there is a better way
 
6:43 PM
What list should I be going for?
And thanks btw for a clear example
 
m8_
sorry, thought the list was there. it is now
thank you for checking it out!
 
So, each group must contain both of those values, or just at least one from the list?
 
m8_
both
 
Ok. I'll tell you now that I don't have a clear plan of attack, to manage your expectations :)
 
m8_
ha thanks for the heads up
 
6:45 PM
@Kevin I see, guess I will just have to use int()
 
m8_
I'm working on trying to send the group to a df and trying isin
 
err, before I even start, there is no solution?
 
m8_
That's what I'm trying to figure out
 
Bob is the only person to score 18, and he never scores 16
 
m8_
oh gotcha
i'll edit it, sorry
 
6:53 PM
Hi all...I am trying to parse a Jinja template (modify it to certain needs) and then evaluate them. The problem is I cant seem to figure out how to evaluate the result of Environment.parse(source). I read that it is an ast but when I attempt ast.literal_eval(parseresult) I get a malformed node error on the outermost template object. PS: I am not modifying the ast yet.
Anyone attempted to evaluate the Jinja ast?
 
7:15 PM
@Kevin probably via SEDE but don't ask me for details
 
@tripleee do you have any details?
 
the query could be shined up some with proper question titles etc
and those are only unanswered questions according to the query ...?
 
wim
These chocolate brownies at PyCon are so good. I had 4 already.
 
here's an edited version with live link and post title data.stackexchange.com/stackoverflow/query/1041143/bounty
11043 results
 
Same error as this stackoverflow.com/questions/9233027 but with fileinput.input(). Any solution with py3?
 
7:27 PM
@Biswapriyo don't use Windows is my go-to solution
 
@tripleee Good sir..
 
more seriously, can you configure your Windows console to display Unicode? Or your program to only output cp1252
 
@tripleee New to python, may you explain please?
I download a file and parse it.
It works with py2.
 
not really a Python problem per se; the Python environment on Windows is usually constrained by whatever character-set settings the system was configured with
 
Is it a CSV?
 
7:29 PM
JSON.
 
"works with Python 2" often just means that you don't get a warning when the output is garbage
 
JSON in cp1252 encoding?
 
What is the type of fileinput? I'm blanking on built-in types that have an input method
 
@tripleee yes
 
7:31 PM
Hmm, ok
 
JSON is Unicode by definition; the error is probably that you are trying to print it to an output channel which is configured to only support some legacy 8-bit character set, such as what Windows misleadingly often calls "ANSI". The modern solution is to configure it to handle Unicode but I hear that's only finally really possible in some recent versions of Windows 10
 
@tripleee Windows really doesn't do this. The only time I've encountered cp1252 is from the AS400 garbage heap that they call a server where I'm at
 
@roganjosh then explain why many Windows users get this same problem?
 
I haven't seen it (truthfully)
 
anyway, a common workaround is to set PYTHONIOENCODING=utf-8 in the environment where you are running Python, and then maybe something like chcp 65001 to configure the system to display UTF-8 correctly
this is all hearsay though, I don't own a Windows system
 
7:37 PM
@Biswapriyo Sadly, there's a lot of Python 2 code out there that doesn't handle Unicode properly, but it appears to work correctly if it only has to handle codepoints < 256, but will break when it has to handle larger codepoints. And even with the codepoints in the range of 127 to 255 it can make mistakes if it assumes Latin-1 but gets cp1252, or vice versa.
 
Or, if it's simple enough (i.e. not too nested) you can use pandas and set the encoding when it reads the data
 
> This character encoding is a superset of ISO 8859-1 in terms of printable characters, but differs from the IANA's ISO-8859-1 by using displayable characters rather than control characters in the 80 to 9F (hex) range. Notable additional characters include curly quotation marks and all the printable characters that are in ISO 8859-15 (at different places than ISO 8859-15). It is known to Windows by the code page number 1252, and by the IANA-approved name "windows-1252".
cp-1252 is what passes as latin 1 in Windows land. Almost latin 1 but not. So how is Windows not to blame here? :P
 
Well, it is, but it just doesn't happen on regular Windows. Maybe Windows Server or something
 
Have you considered the fact that you live in a country where the locale fits in ASCII?
 
stackoverflow.com/questions/2737479/… doesn't have a bounty but is returned by the query above, otherwise all the results I looked at seemed correct, i.e. had a bounty
 
7:40 PM
100% of my 2.7 code was definitely in the "only works on unicode by coincidence sometimes" camp
 
@tripleee Interesting, Your explanation gave me this idea. I've tried it in Linux distro and it works. Thank you. How did you find?
 
the last time someone had cp-1252 issues here they were German or Danish or something, very much non-ascii land
 
God help you if you needed to type an umlaut
 
Then why is a server in my country giving me these issues?
 
@Biswapriyo this is a very common FAQ
 
7:41 PM
@roganjosh Beats me. Because the admins there are extra incompetent?
 
Ha, I'll buy that
 
@tripleee Common?? Google doesn't show it.
 
note that you're saying "this can't be windows' fault because I only see UK issues on a server", I'm saying "there are probably a lot of crap desktops out there on the mainland"
 
@roganjosh Vast amounts of HTML has been generated that claims to be ISO 8859-15 in its <meta> tag, but which is actually cp1252. The blame for that is squarely in Microsoft's court.
 
stackoverflow.com/posts/2737479/timeline oh it had a bounty but it was never awarded
@Biswapriyo we see it every week here
 
7:42 PM
@tripleee nice
 
Are we fixing the issue here, though? Fun as it is to bash Microsoft
 
not me
 
@Pie ^ see above, you have to register for data.stackoverflow.com separately IRC
 
@KananAbdullayev hello, please stop before you go on
this is not the right place for this, sorry
You can seek legal or medical help in real life, if you wish.
 
@roganjosh finding and promoting a good canonical would be a step in the right direction, I have been meaning to clean up the morass of probably a hundred or more similar questions with so-so answers
 
7:45 PM
I've only experienced it with CSVs and thankfully pandas can cope with it
 
Sorry, that should've been ISO-8859-1 in my previous post.
 
Maybe the issue is more prevalent than I know
 
ISO-8859-1 == Latin-1
 
#anglosaxonthings
 
But @Biswapriyo might be able to pass it through Pandas, pinch their encoders, and then back out. Crappy/cheap but it might work
 
7:49 PM
also depends on what you want to accomplish, "I want to print('💩') at the console" is different from "I want to put UTF-8 in a file"
the latter can easily be done portably without problems
 
The fake ISO-8859-1 thing got so bad that all modern browsers assume that pages claiming to be ISO-8859-1 are really cp1252, and HTML5 made cp1252 the default text encoding, rather than ISO-8859-1. Of course, modern pages ought to use UTF-8, but there's still plenty that don't.
 
When software assumes you're lying about your data format and goes ahead and parses it some other way, that's where you enter the Dark Timeline
Browsers have got it both coming and going since they do wacky things to page encodings as previously established, and add "mozilla" to their user agent string even if they're not part of mozilla
 
"even if they're not part of mozilla" has always confused me
 
Partial credit to Opera for trying to start their user agent string with "Opera", but eventually giving up; and partial credit to Firefox for actually being a mozilla browser, but this is basically a coincidence so let's not congratulate them too thoroughly
 
I'm happy to say all these web dev trivia are alien to me
mo zilla, mo problems
 
8:02 PM
There is no encoding that can convey my cringe right now
 
@tripleee I love that my python console allows me to cut and paste that emoji to the console, even though it says it's an invalid identifier..
 
@roganjosh this goes back to the browser wars in the 90s, Microsoft IE decided they could lie that they were actually Netscape (the original Mozilla) in order to improve their compatibility with sites which were (more or less) designed for Netscape
 
@toonarmycaptain hmm, wouldn't that error only come if you try to assign to it?
 
@AndrasDeak True, you can assign it to a string.
 
or use it in any way without quotes
in Swift (and probably some other languages) you can call your variables unicode poop
 
8:07 PM
Although entering a letter by itself is a NameError: 'd' is not defined, 💩 is a SyntaxError: invalid character in identifier
 
this is not something that I miss in python :P
 
@tripleee I'm kinda glad, in some ways, to not have been part of it. But it is interesting to see the remnants :)
 
anyway, rhubarb
 
rbrb
 
Endgame tomorrow :)
 
8:08 PM
have fun :)
 
It's like AMD sticking around on Windows, even though we're (probably) all on Pentiums. Still there in e.g. the unofficial binaries
 
is this more than the usual naming convention of 64-bit architectures as amd64?
 
I don't know why it takes the name "amd"
I assumed it was from the processors, but happy to be schooled on it because I've never known and, really, not bothered looking it up
 
I don't think that's a windows thing
@roganjosh started as AMD, apparently, and intel implemented almost the same thing later
see for instance Ubuntu 64 bit downloads (relating to "not a windows thing")
 
there was an intel 64-bit architecture code-named Itanium which flopped, the AMD alternative which was broadly backwards-compatible with the old 32-bit Intel architecture succeeded
 
8:17 PM
I did have an AMD processor
 
by the way ATI Radeon cards are also AMD now
 
Long, long before I programmed. I used to work at a computer market, albeit in the kitchens serving slop.
 
I think my previous laptop's lshw or something similar called it "AMD (nee ATI) Radeon"
 
"nee" :P
 
I'm pretty sure it was lacking the acute accent :(
 
8:20 PM
It was, but I'm pretty sure we understand
 
I mean the output of "lshw or something similar". I know how to spell née. I even suspect it should be né for a male, just like fiancé[e]
 
But they (AMD) were big at the computer market and just got obliterated
 
They did?
 
Yeah, Pentiums looked cool
I haven't checked the overall market movement, but in that microcosm, AMD looked poop
 
are you talking about the mid-1990s? Intel Pentium was introduced 1993, Intel Itanium 2001, the AMD x64 architecture 2003 which basically ate Intel's 64-bit lunch for several years
 
8:30 PM
I'm 31 and I'd guess I was 15 at the time, so 2002/3
I used to go to the markets before I worked there
 
♫ To market, to market, to buy a fat CPU, home again, home again jiggety-jig ♫
 
You'd probably not believe me but there were guys walking around with pockets sewn into the inside of trench coats where they stashed their copied discs
Fun times :)
 
haha
 
Neo
8:57 PM
Hi, need some assistance on a regex
 
hello
 
Neo
import re
value = "[<SNMPVariable value='15.3.1.4 patch1-29' (oid='iso.3.6.1.4.1.1916.1.1.1.13.0', oid_index='', snmp_type='OCTETSTR')>]"
os_version = re.findall(r"value='(\d{1,4})", value)
print os_version
I am trying to only grab value "15.3.1.4 patch1-29"
 
do you get 15 instead?
 
Neo
yes
 
\d{1,4} matches 1 to 4 digits
 
Neo
8:58 PM
I tried multiple things but cant get a match
 
you want to match until the second single quote, right?
 
Neo
yes, thats what I have as a place holder
 
something like re.findall(r"value='[^']+'", value) might work
 
Neo
value='<match inside>'
 
you can add the group back if you like
side note: consider using python 3 instead :)
 
Neo
8:59 PM
re.findall(r"value='[^']+'", value)
oops
"value='15.3.1.4 patch1-29'"
Can I remove value?
 
46 secs ago, by Andras Deak
you can add the group back if you like
>>> re.findall(r"value='([^']+)'", value)
['15.3.1.4 patch1-29']
 
Neo
just 15.3.1.4 patch1-29
thanks!!!!
 
no problem
 
Neo
I tried searching but did not find an answer. Should I be able to get a value only from snmp walk
where I can do like snmp_walk_result.value
 
No idea, sorry, I don't even know what that is. Does it have decent documentation?
 
Neo
9:02 PM
and it gives me only value and not other junk
 
@Neo looking at what you have suggests that yes, that should be possible
parsing a repr() with regex should be a last resort
 
Neo
snmp_query_result = easysnmp.snmp_walk(oid, hostname = switch, community = community_string, version = snmp_version)
this is what I am using
 
Neo
yea, I went over this and did not find a way. It just makes sense to do it
 
trying to find the docs of the SNMPVariable class
 
Neo
9:05 PM
I tried this too:
snmp_query_result.value
 
the github repo doesn't look very good
> [MAINTAINER REQUESTED/HELP WANTED] A blazingly fast and Pythonic SNMP library based on the official Net-SNMP bindings net-snmp.org
last commit almost a year ago
@Neo anyway, accessing .value should work unless you're trying to apply it to a list of SNMPVariables as the repr() suggested
so instead fo snmp_query_result.value you want snmp_query_result[0].value because you really have a list of SNMPVariable objects... (note the enclosing [] in the repr())
otherwise your expectation was correct
if you read the error message you get you'd notice that it complains that list objects don't have a .value attribute
 
Neo
damn .... snmp_query_result[0].value worked
I always miss something lol
Thanks!!!
 
Read and understand the errors, you'll miss less things that way :)
 
Neo
There were no errors, it just print nothing
 
I doubt that
 
Neo
9:10 PM
let me try again
 
unless what you had wasn't a list of objects, only something that looked like a list in its repr()....
 
Neo
it did not print anything
 
not impossible, of course
what's type(snmp_query_result)?
 
Neo
<type 'list'>
 
humm
 
Neo
9:12 PM
when I do print snmp_query_result.value
It doesnot return any error but also ignore all lines below
 
Are you not catching all exceptions outside? In a try: ... except: pass or similar block?
 
Neo
try:
        snmp_query_result = easysnmp.snmp_walk(oid, hostname = switch, community = community_string, version = snmp_version)
        print type(snmp_query_result)
        print snmp_query_result.value
        print type(snmp_query_result)

    except:
        snmp_query_result = "Query Failed"
    return
oops alignment messed up
 
Hehe, there you go. No paranormal activity.
 
Neo
try an except are aligned
 
And that is why you never* write bare except clauses
 
Neo
9:15 PM
no, paste messed up alignment
 
Exceptions are not pokemon, you shouldn't catch them all. Only catch what you expect to fail and what you're willing to handle.
@Neo I get that, it's not that what I'm talking about
 
Neo
ohhh I get it now .. it was going in Except
man .......
I am dumb
 
Yup. You should only catch these
@Neo you just need to fail a few times in an educational manner ;)
catching easysnmp.EasySNMPError unless you know you can be more specific should probably suffice
but do note that the library you're using is not being maintained, so it's probably not a good idea to rely on it for anything important
 
Neo
ok, thanks for the help :)
 
no problem
 
9:22 PM
cabbage
 
cbg
 
9:42 PM
Question Title that made me chuckle "How to properly iterate over a for loop?"
 
hehe
 
How to do it improperly: exec('for i in range(42): print(i)')
 
@AndrasDeak LOL
 
I just saw a contender for worst dupe ever on Physics: a screenshot of an existing question.
 
bah, properties are the bane of my existence. By observing them in a debugger I appear to be modifying the code's behavior.
 
9:48 PM
To be fair, the new OP just wants additional background info relating to the old question. But why a screenshot rather than a simple link?
 
@PM2Ring that is too funny. Were you tempted to answer with the associated screen grab of one of the answers?
 
@alkasm He pinched that slogan from Martijn Pieters.
 
not sure about the first source but it's been mentioned here plenty of times chat.stackoverflow.com/search?room=6&q=pokemon
 
@piRSquared The thought did occur to me... :)
 
@PM2Ring I figured it wasn't just originated, but good to know the source.
how is it that Martijn links to this canon while mentioning Pokemon exception handling and the canon is from poke?
the world is too good sometimes.
 
9:58 PM
Because he's a room owner here or because pokemon starts with poke? :P
 
10:17 PM
Django does some black voodoo with my ModelForm sublcass when I use it in a formset
 
^ some game engine implemented in ancient factorio (?)
 
@AndrasDeak second one
 

« first day (3120 days earlier)      last day (1820 days later) »