« first day (1877 days earlier)      last day (1489 days later) » 

5:59 AM
chill andras
 
1 message moved from Python
 
 
3 hours later…
8:47 AM
@AndrasDeak Thanks, You may check your link as well, you are breaking the first rule apparently
 
1 message moved from Python
 
8:58 AM
in case if you are talking about the previous question, actually the issue is not from the package itself. it's an issue from the device which is sending the request to the API, which is actually for some reason flagged by the API and will keep dropping the connection. especially if you sent multiple requests to sensitive API such as twitter without performing an action. at the end, you have to wait till the API unblock you.
 
1 message moved from Python
 
 
6 hours later…
user11585758
2:49 PM
guys
 
1 message moved from Python
 
user11585758
3:42 PM
yeah
Error was this:
!wget github.com/opencv/opencv/blob/…

Solve by this
!wget https://raw.githubusercontent.com/.....
 
user11585758
Both returned same xml files but when used with
os.path.abspath(path) . The second give good
 
2 messages moved from Python
 
 
2 hours later…
5:55 PM
I have a for loop that is producing lists like below. Why can't I `get` the value attribute here?
[<option selected="selected" value="">Any</option>, <option value="amex">AMEX</option>, <option value="nasd">NASDAQ</option>, <option value="nyse">NYSE</option>, <option value="modal">Custom (Elite only)</option>]
 
Is that an actual copy-paste from your output? If so, what are those in the list? bs4 tags?
 
bs4 yes
 
weird repr...
 
i had this last night and it was very simple but i lost it cause i had to make a new venv
 
Why would that affect your code?
 
5:57 PM
but i had it where it produce ['', 'amex', 'nasd', 'nyse']
 
@LuckBox how did you try "get the value attribute" that didn't work?
 
i couldn't figure out how to replace the current venv and had to made an entirely new project and during that process something wasn't working and I must've done something to the original file cause when i went to build my dataframe i noticed my list was gone
 
Your venv is just a collection of libraries. It doesn't just throw away your existing approach, but you might have a bug or two if libraries are changed
 
@LuckBox Are your python scripts inside the venv's directory tree?
 
something updated or something and i still dont know all the ins and outs of venvs and i got frustrated in the process of fixing things
 
6:00 PM
@LuckBox then I'm pretty sure this is mis-diagnosed as being related to the venv
 
the venv problem was fixed
for f in filters:
option = f.find_all('option', attrs={'value': True})
for o in option:
o = o.get('value')
print(o)
this is getting the values, but not in the list format I have with just option
 
@LuckBox So. It a) has nothing to do with the venv and b) you should visit the code formatting guide
 
the problem was CREATED during the venv mixup
so please understand that
 
If the question is just "instead of printing values in a loop, how do I collect them in a list?", create an empty list and append to it; or use a list comprehension
 
And please understand that I don't believe that to be the root cause
 
6:05 PM
please understand that i needed to make a new venv in order to install packages that i have been installing already
and please undrestand that i dont have a master understanding of venvs
so when i went to make this new venv, i copied some code over right?
but this code wasn't the code i remembered it being and i deleted the previous files because i couldn't install freaking pandas
okay so now that we have that out of the way
 
There might be a miscommunication here. If Luck Box is claiming "my code currently doesn't work because of my venv", that's not so likely. If the claim is "I had a working solution, then I lost the source while fiddling with venvs, and now I can't remember how I did it the first time", that's in the realm of plausibility
 
So make one? What are we supposed to be answering? Are we just arguing and prefacing everything with "please understand"? What are we supposed to be answering?
 
i had this code
kevin thats what im trying to say
its become very hard for me to be able to properly communicate to where people wont ask questions that dont have anything to do with the solution
people want all this extra code and then when i provide it other people ask why i even provided the code
all the while ignoring what im trying to get after
 
Posing questions that don't prompt tangents is a subtle art :-)
 
it'd be great if the audience could read a little more between the lines too :)
it gets frustrating but its a good challenge
 
6:09 PM
We're all traumatized from past experiences where we assumed things the asker didn't state outright, and then turned out to be wrong
 
okay rogan, i have some code that in one section, builds a list of tags, but when i get the target attribute value, the list format goes away
 
<-- would never have known that you were using a venv from the start. So, I kinda chased that like a cat after yarn. I won't follow up on that; we've moved on :)
@LuckBox ok, please post the code for this part properly formatted. Once you post the code, highlight it all and use ctrl + k
 
i wish i had a cat
 
No you don't :P
 
option_list = []
for f in filters:
    option = f.find_all('option', attrs={'value': True})
    for o in option:
        o = o.get('value')
im actually VERY good with cats
but my dad killed my last cat
 
6:11 PM
I worry that my suggestion at chat.stackoverflow.com/transcript/message/49072475#49072475 was overlooked
 
accidently ran her over
 
^^ what Kevin said
 
I believe my code does that?
but the list format itself is what I'm after
 
In the code you've just posted, I don't see any append calls or list comprehensions
 
option_list = []
for f in filters:
    option = f.find_all('option', attrs={'value': True})
    for o in option:
        o = o.get('value')
        option_list.append(o)

print(option_list)
i don't remember creating two lists
i dont remember there being a nested loop
 
6:14 PM
I don't remember there being an external list from your loop
 
3 mins ago, by Luck Box
option_list = []
for f in filters:
    option = f.find_all('option', attrs={'value': True})
    for o in option:
        o = o.get('value')
i couldn't believe i had it working on my very first attempt last night, and it was either 2 or 3 lines total
 
Which doesn't append to the llist in the loop. Fun as this has been, @LuckBox, you're gonna need a MCVE
 
[<option selected="selected" value="">Any</option>, <option value="amex">AMEX</option>, <option value="nasd">NASDAQ</option>, <option value="nyse">NYSE</option>, <option value="modal">Custom (Elite only)</option>]
desired result would be ['',
grr
['', 'amex', 'nasd', 'nyse']
 
If you've got an append call and it's still not working, then I'm out of ideas. But I'm sure an MCVE would inspire me...
 
is that not an mcve?
 
6:18 PM
Nope.
 
well then i give up
 
user11006952
@LuckBox What's the problem you are attempting to solve? / What is not working exactly?
 
user11006952
@LuckBox I'll try to help creating an MCVE.
 
Start reading from chat.stackoverflow.com/transcript/message/49072404#49072404 if you're interested
 
Hi guys, am I allowed to talk about a question I have posted yesterday? I come with some more details
 
user11006952
6:23 PM
@LuckBox Here's an idea for an MCVE: Declare a list with one element. and attempt to get the value attribute of that one-element list. See if that doesn't work / works.
 
page = requests.get('https://www.finviz.com/screener.ashx?v=111&ft=4')
soup = BeautifulSoup(page.text, 'html.parser')

filters = soup.find_all('select', attrs={'data-filter': True})

option_list = []
for f in filters:
    option = f.find_all('option', attrs={'value': True})
    print(option)
    for o in option:
        o = o.get('value')
        option_list.append(o)

print(option_list)
Okay ill try this mvce thing
 
user11006952
@Kevin do you think that'll work as an MCVE?
 
this is the code, the following is an exmample tag to work with
[<option selected="selected" value="">Any</option>, <option value="amex">AMEX</option>, <option value="nasd">NASDAQ</option>, <option value="nyse">NYSE</option>, <option value="modal">Custom (Elite only)</option>]
 
user11006952
Oh Nvm.
 
The desired result is:
['', 'amex', 'nasd', 'nyse']
is that satisfactory?
 
6:26 PM
You forgot the import statements, but close enough. When I run your code, the final print statement produces a long list that starts with ['', 'amex', 'nasd', 'nyse', 'modal', '', 'sp500'
There's a bunch of <option> tags before that, but those are because of your print(option) call
 
its that long list that is not the desired result.
 
So you want the result to be exactly ['', 'amex', 'nasd', 'nyse']? Four elements and that's it?
 
thats the first list, yes, and the second list would be ['
['', 'sp500', ...] and the 3rd list would be ['', ...]
 
user11006952
you would need a set, not a list.
 
i didn't use a set though
 
6:29 PM
Sounds like you want a list of lists
 
you're just appending every value to a single list, when it sounds like you want to collect a list of lists
 
option_list = []
for f in filters:
    option = f.find_all('option', attrs={'value': True})
    seq = []
    for o in option:
        o = o.get('value')
        seq.append(o)
    option_list.append(seq)

print(option_list)
 
it was a list of lists
 
kevin'd
 
Result: [['', 'amex', 'nasd', 'nyse', 'modal'], ['', 'sp500', 'dji'], ['', 'basicmaterials', 'conglomerates', etc etc etc
 
6:30 PM
but i still have a question, why can't i get the attr value for the elements in the list?
ill use your code but this still bugs me
 
I don't understand the question. Isn't the stuff I just printed the attr values of the elements in the list?
 
but you're making a 2nd list
 
Yes, because that's what you told me you wanted
 
well i should clarify again that i will be using your code but now im still perplexed
why cant i just strip the list elements down to their attr values?
i can build my dataframe now but this is going to bother me
 
user11006952
because you were wanting a list of lists?
 
6:33 PM
maybe you can, but that doesn't appear to be what you've shown us or what you're asking for, so how would you expect us to help you with it?
 
option_list = []
for f in filters:
    option = f.find_all('option', attrs={'value': True})
    option_list.append(option)
 
What I'm hearing is "I have a list of beautifulsoup elements and I want to modify that list in-place so it becomes a list of strings instead. I don't want to make a new list."
 
This gives me the list format
I have a list full of lists that have the tags in them
But why can't I strip the tags down to the target attr and keep the same list formatting?
 
for i, old_value in enumerate(original_list):
    original_list[i] = do_something_with(old_value)
 
didn't use enum either
 
6:35 PM
garlic
 
You don't need to use enumerate. Calculate the index some other way if you want to.
 
why can't i just strip the list of tags down to just the target attr?
i was literally doing this last night
 
@LuckBox sorry, at this point it doesn't seem like you have a firm enough grasp on the problem or the code to be able to explain what you want to us in a way that's not going to cause more frustration. I suggest taking some time to code on your own, look at other resources, and maybe ask on the main site.
 
I just said that you can strip the list.
 
@LuckBox life's like that sometimes
 
6:37 PM
I should get back to work anyway
 
Those quatloos won't mine themselves
 
I did ask on the main site and i got a nested comprehension
 
Wow.
@LuckBox you asked the same thing on main 6 hours ago, got an accepted answer too. That's 100% wasting everyone's time here.
 
the person ignored my request to keep a certain format
 
Oh, you mean you just dragged us through a 30+ minute conversation only to never explain that you'd already asked the question or why you weren't satisfied with the answer? Please check our room rules before asking again: sopython.com/chatroom
 
6:40 PM
Almost an hour down the drain
@PaulMcG please delete that
 
59 messages moved from Python
70 messages moved from Python
 
@Mez13 I'm pretty sure you were linked to the rules. Read and figure it out.
 
@AndrasDeak Hi, I believe the rules do not mention closed questions
Actually, with the additional details, I come up with, this is a new question
 
@Mez13 so how does the age of your original question matter?
 
@Mez13 The rules don't specify "closed" but that should be indication enough that you have other work to do and not just ask here
 
6:50 PM
@Mez13 ask here or ask on main and wait 2 days
 
@AndrasDeak People can still answer my question on the main if it's closed?
 
given that we just got done with dealing with a pretty bad question in chat, think hard before you ask here
 
@davidism Haha :)
 
@Mez13 it sounds like you should check out the help center links in the message on your closed question
 
@davidism Done!
 
6:51 PM
heheh this environment is so warm and encouraging =)
 
then why are you asking here?
14 messages moved from Python
 
What happened? I can't see our last messages
 
Yeah, because they weren't going anywhere and I'm not in the mood right now.
Either ask a good question, or don't ask. Simple. If you're not sure about the quality, take some more time and come back later after you are sure about it.
 
Easy :) I'll ask then
 
good questions or questions that can be answered quickly without circular discussion.
 
6:57 PM
My goal is to query twitter via its API, and I am here cause I want to do it in python, using the library tweepy. Everything works fine when I use the API via a HTTP client (I'm using Postman). But with tweepy, it says I can't access it Failed to send request: HTTPSConnectionPool(host='api.twitter.com', port=443)
Are you familiar with this library?
 
Looks like googling "python tweepy HTTPSConnectionPool" brings up tons of answers. Try all that first. You haven't provided enough information to narrow it down any more than that.
 
@IljaEverilä I am able to connect. I just wrote I used a HTTP client and all is fine
 
oh, and what do you know, that's also the exact question you asked that got closed on main, not a new question
10 messages moved from Python
 
7:18 PM
self.rect.centery = self.screen_rect.centery
I have an error:
I have an error regarding this line:

`self.rect.centery = self.screen_rect.centery`
 
@YoelZajac and that's totally impossible to answer with what you've given
 
oops..
I thought it was the sandbox
sorry
 
7 messages moved from Python
 
7:50 PM
hi, could someone might help me with my question? Sorry for interrupting..
Thanks.
 
2 messages moved from Python
 

« first day (1877 days earlier)      last day (1489 days later) »