« first day (3283 days earlier)      last day (1651 days later) » 

user10984358
6:15 AM
heya, not a python question directly but my default shell was recently changed from bash to zsh after an OS update and my anaconda python is no longer accessible with python or python 3, I assume its from the aliases and the whole .bash_profile not being loaded in zsh, can I source it if I know the equivalent zsh_profile or something?
 
user10984358
thenamesalc@TheNamesAlcs-MacBook-Pro ~ % python
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
thenamesalc@TheNamesAlcs-MacBook-Pro ~ % python3
Python 3.7.3 (default, Sep  5 2019, 17:14:41)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
thenamesalc@TheNamesAlcs-MacBook-Pro ~ % /Users/thenamesalc/anaconda3/bin/python3.7
 
user10984358
this is what I am faced with
 
user10984358
I would appreciate anyone who takes the time to give me any insight
 
user10984358
weirdly enough the sublime version (build and run) still uses the anaconda python for all of its execution as I dont have numpy or anything else on the other versions
 
8:03 AM
@TheNamesAlc take look at your .bashrc, there should be some assignment of an anaconda path to PATH inside. move that to your zsh initialisation file.
 
8:31 AM
I think I've finally snapped with Spyder 4 (beta). I thought that I needed tab completion but it seems that this is not more valuable than any syntax error highlighting, or a console that take 10 seconds to parse a complete expression instead of thinking it's going to be multi-line when you press enter. The dark theme was cool, though
How does that even make it into beta? A simple assignment goes to multi-line on enter... unless I wait a few seconds before hitting the key
 
9:21 AM
The more I read those sentences the more hilariously ridiculous they sound in light of them setting bombs in the community and booting Monica and going to the media. I swear it must only have just been pinned, I would surely have spotted it earlier otherwise.
 
I've seen it before, but wasn't interested enough in reading it. After reading it just now, I realize I was right all along
 
Seen it and not read it.
 
It is a worrying read. I picked those sentences out in particular since they seem quite foreboding.
 
9:42 AM
@roganjosh Usually that kind of nonsense is created in solutions from people who don't understand the problem. I wonder who they think their market is, and what it needs.
SIX betas? Tells me they're feature-obssessed.
 
Against a backdrop of tab completion being inexplicably broken in lots of cases in the release version. That's the only reason I went with the beta, because I tried every fix I could find with Version 3 and they gave up trying to fix it. It's not looking good :/
 
Alternative CoC FAQ proposal, very reasonable, very much worth the read
@holdenweb twitter influencers (not really joking)
 
9:58 AM
What's the upvote downvote on that, if someone could tell me? Just curious.
 
@AndrasDeak So this isn't some dystopia. Finally some sense
 
Well it's a community proposal :P
@ParitoshSingh agreeing with the things therein, most likely
 
sorry, i meant what's the current upvote downvote count on it
i can't see it on that site.
 
I think Paritosh is asking about how contentious it is
 
Aye, just wanted a sense of how it's being received so far.
 
10:06 AM
@ParitoshSingh ah
 
Alas, I cannot see the vote count either but I'm also curious
 
+60/-7
 
i see, thanks!
 
Seems like a sincere attempt to pour oil on troubled waters. Watching SO handle this situation incredibly badly reminds me of the minefield that is community relations.
 
I really liked it honestly, i think the OP went through a lot of pain to carefully get everything right
 
10:08 AM
Not a bad innings so far :)
 
@holdenweb I disagree, it's a great attempt at making sense of the situation
 
@holdenweb You've eluded to past issues a couple of times. Did this break out in the Python community in particular?
 
@AndrasDeak That isn't disagreeing with me, is it?
 
Oh, I only read half the idiom and thought pouring oil on fire...apologies
Faulty error correction, apparently
 
we get a glimpse into the faults of the AI driving AD
the autocorrect needs more training data.
 
10:12 AM
The meta behind having to edit the statement is big news. We've finally found the corner case for the software :P
 
I was the PSF Chairman when the Foundation adopted its diversity statement. The vote was preceded by a fairly intense education on matters of privilege and so on, and a six-month period during which I was regularly engaged by members of two largely but not entirely disjoint groups who were also making random cross-postings to guarantee that context would be lost. It was a time during which I didn't do much programming ...
 
It seems that you navigated it well, though, because I'm not aware of such similar issues
 
@ParitoshSingh guess one shouldn't chat in a rush... :/
 
10:32 AM
if I use on cookies sameSite=lax and my domain is only accessible from https. Would also adding secure=true be redundant?
because sameSite only sends the cookies to my domain and secure ensure that cookies are sent only to https domains right?
 
I don't know what sameSite=lax is; is this just JS functionality? I doubt I can answer your question, and I'm not sure it's a Python question, but I am curious
 
;samesite SameSite prevents the browser from sending this cookie along with cross-site requests. Possible values for the flag are lax or strict.

    The strict value will prevent the cookie from being sent by the browser to the target site in all cross-site browsing context, even when following a regular link.
    The lax value will only send cookies for TOP LEVEL navigation GET requests. This is sufficient for user tracking, but it will prevent many CSRF attacks.
taken from there
 
I really think this would be better asked in the JS script room; at least there are people working on front-end
I mean, there are such people here too, but I suspect that the density is higher in that room so your chance of getting proper advice is higher
 
thank you
 
I shall silently watch :)
 
10:41 AM
the javsacritp chat room was very inactive and this was very active instead at the moment
that's why I tryed here
 
11:08 AM
@Aurelius redundant security ("belt and braces") is rarely a bad idea. If you are absolutely sure your domain will never be served over HTTP then your assertion is correct. Setting cookies secure guarantees the cookies are never served over HTTP no matter what goes wrong with server deployment, and so is a smart move regardless.
I think there's a Shakespeare quote somewhere like "make assurance doubly sure" (could it be Macbeth?) - a mate of mine used to say "if a thing can't go wrong, it won't."
 
@holdenweb I knew that you were involved, but I didn't know this much. thanks for your work
 
A pleasure. Probably my most significant community achievement.
 
I'm also in the psf, but I still didn't get some of the rights needed to do what I planned to do, so I'm not contributing anything except my name being on some list =D
 
@Arne I think I found out when he posted a video to a Django presentation and I saw it on the title slide. It was a "wait, what?" moment :)
In other words, a very understated achievement :)
 
@Arne ?
 
11:21 AM
@Arne you can't just delete python 2, you know
 
@AndrasDeak no harm in trying though? :p
 
@JonClements I'm still getting access denied on anything jobs related
 
Oh... I'd thought David had sorted that... I can sort that out now if it's still something you'll like to give a go?
 
@AndrasDeak haha, like I'd ever do that *sweats*
@JonClements yeah, sure! I'm, still subscribed and see Davesh being active, I bet he'd like to take a break every now and then too
 
okay two ticks... let me log into python.org and check your access level stuff
@Arne okay... added you to the job board admin group... should work now I think?
 
11:27 AM
okay, searching for something that was restricted before..
looks good, I see a "reject" button on job postings, I bet normal users don't have that. thanks!
 
@Arne Devesh, if you mean the former regular gone lurker here
 
Ugh, I'm dropping my no-voting. stackoverflow.com/questions/58353559/… no mcve
 
@AndrasDeak ugh .. that's not even the first time I misspelled his name ._.
 
@Arne you could have pinged me sooner... I wasn't aware you hadn't been added properly... sorry :(
but big thanks for giving it a go!
 
12:10 PM
no problem, I'd like to give back. just didn't want to be a hassle ^^
 
no hassle at all @Arne :)
 
@roganjosh closed
 
Thanks
Meanwhile, I've realised that feedback can go a little awry. At least there are still people willing to listen to feedback, but I wonder whether I trashed their question by them taking my suggestion so literally
 
@roganjosh Nice of you to say so, thanks.
@Arne What rights that you need didn't you get?
 
@holdenweb john got them for me already, it was regarding the job postings queue
 
12:24 PM
Ah, right. Thought briefly it related to diversity :-).
 
I also didn't realise I had an "h" in my name... I do, but it's not at that position :)
 
Presumably in a middle name? I'm struggling to work out where a "h" would fit
 
._.
names are not my strength
 
@Arne it's alright, Aron
 
someone rang?
 
12:36 PM
Heh
 
Andreas to save the day
 
*hovers over "kick-mute this user"*
 
I... unreservedly apologise
 
s/this user/joshua/
 
I'm only ever called Joshua when I'm in trouble. I suppose I've opened a can of worms on myself here :/
 
12:38 PM
@roganjosh err well, Jon isn't my full first name - shouldn't be hard to work the rest out :)
 
Ah ok, yes, I think I'm able to piece the rest together :)
 
@JonClements D:
 
@Andras are you back for a bit then?
 
from mobile; in a bit
 
@roganjosh did get a b'day card from a mate years ago where he spelt my name as "Jhon" which was amusing :)
 
12:47 PM
@JonClements Lucky I threw that one out while I was considering where the "h" could fit :P
 
you get use to "Jon" being "John" if you're giving your name out over the phone or something... but that one was a chuckle...
 
Phone names are notoriously bad. How someone gets from "Pilkington" to "Pinkleton" I'll never know, but it happens a lot
 
The variations of "Clements" I've seen have also been interesting... admittedly, they're still the same sound, but I've had "Clemence" and "Clemance" - I've had my first name spelt in at least 3/4 different ways
(also had a "Klamants" - that one baffled me)
 
I'm having a brain-fart here it seems. "Clemence" is a word, I thought, but it's not
 
clemency
 
12:56 PM
"clemency" is
 
recbg
 
@AndrasDeak "mild and merciful" I believe
 
it would seem so
 
Clemency is being merciful, yes. My grip on how to describe language is not good enough to understand why "clemence" isn't a word
 
1:17 PM
@JonClements Not to be confused with Clemens
I've seen a few SE members named Jhon. I assume it's an alternative romanisation of an Asian name, probably Chinese.
 
@roganjosh plus English is arbitrary :P
 
It gets the job done, most of the time :P
60% of the time you can convey your thoughts 100% correctly every time
 
2:20 PM
"clemence" is a word in French @roganjosh
 
2:53 PM
Is there a way to skip one part of the output but without to be time consuming? I need something faster than this
items = ("".join(element) for element in itertools.islice(itertools.product(*somelists),2600000000 , 2900000000))
 
@Pijes No. You need to use a smarter algorithm that avoids generating those unwanted products in the first place. Or at least, which can avoid generating most of them. How to do that best depends on what's in somelists
IIRC, you asked a similar question a little while ago. The same advice applies here.
 
3:20 PM
@PM2Ring So I need to change programming language for that. What do you think? Can this can be solved with C++
Not sure that I ask that here.
Before
 
@Pijes No, you don't need to change language, although C++ would be a little faster. You need to use a less brute-force approach so you don't generate all of those 2.6 billion unwanted products.
Maybe it wasn't you, but we had a similar problem in the last week or so. Maybe it was from Ajay Mishra...
 
@PM2Ring OK. I will try to change something. Just wanted to ask here because you have experience with Python
Have a nice day
 
No, I was right the first time. It was you! Did you see Kevin's later solution. Look at the transcript around here:
Sep 30 at 17:28, by Kevin
Here is another benchmark of the sliced product problem, this time using a mixedBaseCounter that PM proposed. It's faster than my arithmetic based approach, although by a smaller margin than I predicted
@Pijes ^
 
@PM2Ring No I didn't see that till now. Kevin help me a lot in the past so I am not sure for this.
Thank you. I will try this to see speed
 
@Pijes Excellent.
 
4:12 PM
Anyone remembers how do we call the new coding style in python 3 where we can declare the types of the inputs and outputs of a function ?
I mean when we type this def my_function(input1: str) -> str: instead of just this def my_function(input1):
 
Type hints or type annotations
 
Thanks @AndrasDeak!
 
No problem
 
Hi! I'm new in python... can I ask something here?
 
4:27 PM
Yes please, you are welcome
 
@HugoB hello. As long as it complies with our rules, sure :)
Since the site seems down now: if it's about python and not about a new question on SO main, go ahead
@JonClements sopython is down :(
 
Thanks a lot! So I'm trying to do an exercise about dictionary and files. I have a file of sales (a csv file) and I wanna create a sort of query using it: I wanna, for a country = 'USA', to create a new dict where inside there's the id with the his value and (id as a key and the value as a value) and also country: USA. so let me send the code
sales = open("sales.csv", "r", encoding= "utf-8")
r_sales = csv.DictReader(sales, delimiter=';')

d={}
count=0
for row in r_sales:
for k, v in row.items():
if str(k) == 'country' and str(v) == 'USA':
count = count+1
d['id'] = #dunno
print(d)
print(count)
so, I read the file using DictReader, I use a for to read all the rows and I have done an if to select the country = USA
but I don't know how fill in a conrect way the dict
 
@HugoB edit message, highlight and ctrl-k for code format in chat
 
@HugoB As far as I understand you need to check if the key exists in the dictionary, if not put 1 if yes then += 1.
 
4:40 PM
nope, the key exist, but I don't know how to say: knowing that Country= USA, create a dict like {id = 345, country = usa} etc
 
Maybe this helps
d = {'id': '345', 'country': 'usa'}
 
in the file there are a lot of other columns, so I wanna select only the id and the number of people from USA. I dunno if It is clear
 
@HugoB maybe you can put same sample rows (2-3) of it so we can vision its format
 
@thanos.a not much, because I have to do a loop to select only the right id
@thanos.a OrderedDict([('customer_id', '10281'), ('lname', 'Cartney'), ('fname', 'Samuel'), ('city', 'Vancouver'), ('state_province', 'BC'), ('postal_code', '63699'), ('country', 'Canada'), ('gender', 'F'), ('occupation', 'Management')])
this is the print of a row
 
So you have many rows like this and you need to count how many of these rows have country = 'USA' ?
 
4:53 PM
the count is only a control, I need to select only the IDs of people from USA and put all in a dictionary in this format: {id: #number, country: USA}
 
Give me a second
r1 = OrderedDict([('customer_id', '10281'), ('lname', 'Cartney'), ('fname', 'Samuel'), ('city', 'Vancouver'), ('state_province', 'BC'), ('postal_code', '63699'), ('country', 'Canada'), ('gender', 'F'), ('occupation', 'Management')])

r2 = OrderedDict([('customer_id', '22222'), ('lname', 'Cartney'), ('fname', 'Samuel'), ('city', 'Vancouver'), ('state_province', 'BC'), ('postal_code', '63699'), ('country', 'USA'), ('gender', 'F'), ('occupation', 'Management')])

r3 = OrderedDict([('customer_id', '3333'), ('lname', 'Cartney'), ('fname', 'Samuel'), ('city', 'Vancouver'), ('state_province', 'BC'
 
Ok, seems legit. Let me see if It works
 
5:20 PM
@ReblochonMasque Does it have the same meaning? Are there multiple variances like clemence/clemency
 
mmm so It give me some problem about string. So I tryed using number_id = row.get('customer_id') before the if but I don't thing it is right
 
The row is a dictionary so you need to get it like number_id = row['customer_id']
 
@HugoB I've read through this discussion a couple of times and I've not been able to pin down exactly what you want. Please give an MCVE
 
:47558679 I have a csv file with a ; separator. The file is made by a header and some data about sales. This is what do you see inside AFTER a DictReader: ('customer_id', '10281'), ('lname', 'Cartney'), ('fname', 'Samuel'), ('city', 'Vancouver'), ('state_province', 'BC'), ('postal_code', '63699'), ('country', 'Canada'), ('gender', 'F'), ('occupation', 'Management')
I want to select as in SQL only the IDs (customer_id) of people from USA. And create a formata like:
{id: #number, country: USA} using a dictionary
 
5:37 PM
That would need to be a list of dictionaries, not a single dictionary
Also, what is the use of the "country" key when you're specifically only creating a dict of one country?
 
6:36 PM
Can I link the question here I have just posted about dataframes on here? It is quite challenging I think.
 
You shouldn't link questions less than 48 hours old, as per the room rules, but I think your comment is enough to drive some traffic :)
 
6:55 PM
@roganjosh checked your website! Great work. Are you interested in crypto trading at all? :) I have co-founded a company to trade cryptos with a friend, we created a market making algo, and a bunch of other strats and are looking for interested people to work together with us.
 
I think when it comes to trading, my official position is "dumb money". EToro did not go well for me :P
Though I didn't actually apply any algorithms, I just sat watching graphs and pooping myself about my £10 stake :P
 
Haha lol :) Let's get connected on LinkedIn in any case. I will send you a message on your web-site with my profile :)
 
My LinkedIn is very out of date, but if you send me a message, I will email you back :)
 
Sent you my details! I will keep cracking on the problem. Let's talk sometime :)
 
I guess it re-frames my view on your problem but I guess SO doesn't have the scope to include those kind of thoughts. Checking now
 
7:07 PM
Probably not.
 
I've replied, let me know if you didn't get it
It appears I also have a message from someone telling me that I could use web forms to send messages... sent to me by using my own web form. What kind of business is that?
 
7:24 PM
lol what. The crypto one?
 
Some marketing garbage, I just don't understand the business model. I get a discount if I use some indecipherable product if I need 50K messages. I feel I'm a little off that target
 
Which frame work is better
Flask or Django
?
 
There's just too much behind that kind of question to give a proper answer. Both are more than capable of solving virtually any web problem you have
 
I think if you need more of a production application then DJango, for something smaller - Flask. Flask should also be easier to write in.
 
@Amolb yes
 
7:33 PM
Flask will scale just fine
 
Ok,
I need it for production
Will go for Django
Thank you @isquared-KeepitReal
 
I'm not sure what just happened here but ok
 
7:54 PM
cbg
anyone there?
 
No
 
<a href='queue/%3Chotspot%2D66beec2t%3E/'>&lt;hotspot-66beec2t&gt;</a><br />
<a href='queue/%3Chotspot%2D44wczxuv%3E/'>&lt;hotspot-44wczxuv&gt;</a><br />
for link in soup.findAll('a'):
    match = re.search("&lt;hotspot-((?:(?!&gt)[^:]){8,}?)&gt;", link)
    print(match)
what's wrong with it ?
expecting output to be

66beec2t
44wczxuv
 
I might as well not be here, it's regex and I just avoid that stuff sorry
 
my issue not with regex
 
Then you need to be clearer because you haven't said anything other than "what's wrong with it?"
 
8:01 PM
it's about the code itself . i think it's not the correct way to search inside anchor
@roganjosh Alright
my question here. how to search inside anchor .
 
You are using re.search which will only do regex for you.
if you want HTML parsing instead use an HTML parser
Or is your issue with the for loop itself?
Perhaps link has an attribute like .text or .string that contains what's inside the tag
 
user10984358
could'nt resist, sorry to barge in, a google search revealed this? soup.find_all("a", string="Elsie")
 
look at the docs of beautifulsoup tag objects
 
user10984358
replace elsie with you regex perhaps ?
 
8:09 PM
okay
 
for link in soup.findAll('a'):
    text = link.text
    match = re.search("&lt;hotspot-((?:(?!&gt)[^:]){8,}?)&gt;", text)
    if match is not None:
        print(match.group(1))
still trying to let it work :S
 
format that please
thanks
 
instead of trying random things, look at the docs, if the docs says you need link.text then look at that directly, and see if you can use the regex for it
 
user10984358
8:29 PM
since I had nothing to do I tried something I believe that works
 
user10984358
for i in soup.find_all("a"):
	match=re.search(r'hotspot-((?:(?!>)[^:]){8,}?)',i.text)
	if match:
		print(match.group(0))
 
user10984358
one line that returns a list like so '<hotspot-66beec2t>', '<hotspot-44wczxuv>'

`soup.find_all(text=re.compile(r"hotspot-((?:(?!>)[^:]){8,}?)"));`
 
@TheNamesAlc thanks a lot
 
9:23 PM
hi, im trying to use a ttf font in cv2 but getting the following error:
`ft = cv2.freetype.createFreeType2()
AttributeError: 'module' object has no attribute 'freetype'`
tried adding pip install opencv-contrib-python but didnt seem to help
 
9:40 PM
ahmed
ahmed-1
ahmed-2
michael

want to remove duplicate and get the max of it.

so the output should be

ahmed-2
michael

shall i convert this to dict or there's better solution ?
 
10:59 PM
@roganjosh Also, debugging help as well as no MCVE
 

« first day (3283 days earlier)      last day (1651 days later) »