« first day (3195 days earlier)      last day (1977 days later) » 
00:00 - 17:0017:00 - 00:00

00:33
cbg
pir that looks cool
 
1 hour later…
01:48
Thx 🙂
02:45
cabbage
 
2 hours later…
04:29
What is going on here: Two exactly same questions.
https://stackoverflow.com/questions/57040029/variable-not-change-in-other-frame
https://stackoverflow.com/questions/57049781/how-to-update-a-variable-value-inside-a-frame-in-tkinter-that-will-be-used-in-an
04:50
cbg
05:08
Should robots.txt be kept in mind while using requests?
05:44
Hello everyone! First time actually checking out chat.
05:57
cabbage @DMellon
pls check this out.
 
1 hour later…
07:19
@ReblochonMasque yeah, fishy. Flagging for a mod.
@aadibajpai well yes you should obey robots.txt if it is present and you are fetching pages programmatically
08:00
Makes sense
I'm looking at docs.python.org/3/library/unittest.html, I've only used unittests so far for tests. Is it worth checking out pytest or something or is it okay to stick with unittests?
Most of the functionalities provided by pytest is same as unittest, but pytest is a third party library
you can use either of them, upto you, but pytest does have extension to mock some known libraries, e.g for rabbitmq they have pypi.org/project/pytest-rabbitmq
Thanks @AndrasDeak
re-cabbage
In this case I'll go with unittest I think since nothing special is needed
I like unittest lib
me2, saved me quite a few times
08:11
fwiw, pytest is more widely adopted than unittest, despite being a third party library
are there use cases where pytest is easier to use or does something better?
it's up to opinion, really. if you are used to java's unit test framework, then unittest will feel very natural and powerful to you.
I'm not, actually
If you have written python for a while and haven't really bothered with unit tests as of yet, pytest is probably going to be easier.
May 29 '18 at 6:05, by wim
there's literally nothing I can think of that unittest does better than pytest
08:13
pytest is generally easier due to its direct use of assert instead of specialised assertX methods. unittest is more straightforward if you do meta-programming, since it doesn't add meta-layer the assert rewriting,
for what it's worth wim practically tests stuff for a living
I've written testsuites for exactly two repos and I used unittest both times. I guess I'll check out pytest now
@Arne not being in the stdlib is a plus, IMO. testing multiple python versions is much easier with the same test library version
plus I think there was something about pytest evolving much faster than stdlib
or was that some other mainstream third-party lib?
@AndrasDeak pytest and requests are both quoted in that context
08:18
OK, thanks
well I wouldn't really check it out per se, my GSoC student has to write tests for the project so I was thinking I'll point him in the right direction
@MisterMiyagi 100% agree, I only brought it up to show how good it needs to be in order to win out in that kind of comparison
this conversation makes me think of arrays in python.
This is why I like unittest - nobody ever jumps in to say that unittest is more pythonic, easier to use, and more betterer!
apparently there's an array library. Bet that's not what you think of when you hear arrays, it's always numpy first
08:22
not always, there's also bytearray
Is the default value of the function parameter looks like this f(a=None) and then if we define in something when we pass to it, it 'll get the value instead of the default value?
and when I hear "array" in the wild my first suspicion is a list...
@Thatshowweroll yes
but you can try this yourself
@AndrasDeak ha, and that too i suppose :P
@AndrasDeak thank you
yea, same like when I hear matrix
08:23
Yea lol, actually it is easy to try
indeed
that's how you should roll
^_^
indeed, thanks
i'll admit i don't really know bytearrays much at all. Haven't really needed to interact with bytes much so far in my work.
er. interact directly* i suppose i should add. It's all abstracted away, even though it's everywhere.
08:24
bytearrays are basically mutable bytes
Actually, I have a better question for ask, came to my mind. All jobs I see about python is generally big data kind, why? Rest of the python jobs are filled too fast or something else ? Python is easy to learn maybe so people filled others jobs fast or big data has huge crowd?
Big data need huge crowd?
Is there a significant speed advantage by doing from x import y instead of import x? PyCharm has an automatic option to do that I think but not sure if there's a significant improvement 🤔
@aadibajpai no speed difference at all
I think that's just pycharm's opinion on better style
@aadibajpai technically, you can get speed advantages depending on the size of each modules global namespace
x.y is a lookup over two namespaces, y is a lookup in one namespace
How does it involve two namespaces?
08:32
if you want to import lots of y from few x, then just importing x is faster
Does import x not add the whole x into the namespace?
@aadibajpai it has to lookup x in the module global namespace, then y in the x namespace
@Thatshowweroll It's growing at the the moment, so depending where you look that's most of the entries that you'll see. but for example the official PSF job board lists ~100 jobs at the moment of which 23 are big data and 18 are machine learning. So definitely a big chunk, but not really "everything"
Ah I see
@Arne Are there not a lot of general python jobs? Like backend or so?
Are automation jobs a thing?
and I think these kind of analyst positions also have higher turnover rates than backend work, so you'll see more entries on it even when the python job distribution is not weighted towards it
@aadibajpai there should be a bunch. I work in one =D
and my last ... 3 positions could be called "python backend job"
08:36
we use Python a lot for devops and R&D, but also other languages for support. so our jobs wouldn't be advertised primarily as Python, but by the task to do
I really like automating things haha, I'd probably like to work in something like that once I get older
^^^ that's a good point, data science jobs will specifically target python, and other jobs that you can do as a python dev not necessarily
@Arne I personally think ai is just have a big hype but don't really have real stuff because you just have to type all the possibilities for some cases and it won't matter for a long time, would you agree?
But I really dont have any experience on ai though
while AI is an ambitious if not arrogant name, it's typically more than having 250 if statements for various scenarios ;)
08:39
I think it has opened up some very interesting avenues wrt nearly everything but it's pretty overhyped I think
@AndrasDeak I think real AI starts at 1000 ifs
@AndrasDeak Yea, this is what i mean
Everyone just wants to go for the keywords lol, IoT, ML, AI, Big Data
You just have tons of if's
08:40
@Thatshowweroll I'm saying you don't
you have to admit though, AI has a certain ring to it
a certain buzz
@AndrasDeak I am lost really
Do you think you can write a sufficient amount of if clauses to defeat a champion at go?
@AndrasDeak no, i dont
@AndrasDeak I get my points ^_^
08:43
well AI beats go champions these days so clearly there's more to it than if clauses :D
i know the answer. nested ifs!
Thank you!
I am glad I found this chat, It was boring to work alone
definitely a little overhyped though. I just hope that we're nearing the Plateau now, and are not going into another winter
@ParitoshSingh I think that's called deep learning..
the more levels of nesting, the deeper the learning
that's deep. :)
(i am so sorry, i couldn't resist!) :P
08:47
@Arne I love the sloop of enlightenment part
@ParitoshSingh We should give you pun master badge
cbg
It took me two minutes to find that the reason why my bash for loop didn't work was a trailing colon...
09:03
Ah yeah
Just put do on a new line :)
I do :'|
I just like to put a semicolon too, out of habit
more often than not I write my for loops inline
modern AI is extremely useful to extrapolate from large data volumes for which there is no sufficiently precise underlying model
the point being that you don't have to type all possibilities, so you don't have to know all possibilities
the problem with most AI jobs is that people have little idea what "extrapolation", "large data volumes" and "no sufficiently precise model" implies
The employers or the applicants?
both, in my experience
mostly the former, but there are lots of applicants who frankly have no idea how machine learning works
09:16
I guess that's just the analogue of all the programming applicants who can't program
for "classical" programming, at least it is possible to define non-trivial correctness and quality of results
I don't exactly know what the sufficiently precise model would mean but the other two I know lol
for AI you just stir the pile
@aadibajpai gratz, you are qualified to do ML :)
09:19
yep!
Aside, excel handling of date times is...something else.
with or without the lotus bug? :D
09:55
heh, with and without. Just finished dealing with a rather sneaky bug that snuck in somehow
Hey all,

I would like to double check my understanding of timestamp. I have been looking through old questions and seen a few regulars here answered questions. Furthermore I have run an MCVE test and the results seem to be as expected.

I want to convert UK time, which is affected by DST throughout part of the year, to UTC. Ideally the code will know when to adjust for DST and when not. Is my understanding correct that the code below will automatically know when to adjust or not for DST, or am I missing something obvious?
argh i did ctrl K and the code still doesnt format properly
it's either all code or none of it for multiline messages
@AndrasDeak ah ok, i always seem to fail when trying to post code clearly
@MisterMiyagi Could you identify a good book or lecture about this topic?
10:50
@Thatshowweroll no. I recommend enrolling in a proper CS course at a university.
11:19
@Andy Have you tested it on interesting corner cases, like non-existent local times, and a second either side of a timezone change?
When the clock goes forward in March, there's a skip from 01:59:59 to 03:00:00, so 02:00:00-02:59:59 don't occur either before the change (when we are on GMT/UTC) or after (when we are on BST). Similarly, when it goes back that time series repeats, first in BST then in GMT/UTC.
If your method worked around there, it will likely work most other times.
11:51
Seems like the explode functionality is finally officially being added to pandas: github.com/pandas-dev/pandas/pull/27267
Leap years offer other interesting cases and non-existent timestamps.
@holdenweb ah awesome thanks for the comments
hadn't considered those asopects
@holdenweb cheers!
12:06
Where timezones are concerned it's TTD FTW!
what does ttd mean
The product I worked on had to cope with world travellers. 28-hours days were difficult to track, but they happened for some users. Took us a long time to get our approach sorted out.
why does my rep go down every time i downvote?
To discourage those who otherwise might downvote illiberally?
down voting an answer gives -1 rep for everyone
12:10
is it newly added?
cbg
@Erfan That is great..!!
The other day I read that f.lux (the program that dims your screen when the sun sets) had a bug where it would consume a lot of memory and then hang... If you were in the arctic circle in the summer, because the next sunset was six months away.
12:25
@holdenweb that sounds mind boggling
@kevin XD
It wasn't easy, and we kept discovering obscure bugs for about six months!
I'd love to view the actual bug report, but googling "FB6342354" doesn't turn up much... Just variations on that tweet and one link to developer.apple.com/bug-reporting, which doesn't appear to have any way of viewing old bugs unless you've got some kind of proprietary app installed
I suspect "Feedback Assistant" is not even available on my OS. Why would a Windows user ever want to look at a MacOS bug? /rolleyes
(Oops, it's not f.lux, it's Night Shift. Apologies to f.lux and reverse-apologies to Night Shift)
(And perhaps apologies to Night Shift, because people in the comments are saying they can't replicate the behavior and in particular one arctic scientist recommends leaving Night Shift on 24/7 while in the arctic)
[desire for actual bug report intensifies]
(On the other hand, when the first guy said he couldn't get it to work, that might mean "I couldn't figure out how to spoof my geolocation into the arctic circle, so I don't know one way or the other whether the bug occurs")
(and when the second guy recommended Night Shift, maybe he meant "use whichever screen-dimming software is available and functional" and completely forgot that the original context of the conversation is that Night Shift didn't work, because he was so frothed up about his hatred of 24/7 sunlight)
(I don't see any comments that unambiguously state "I am actually in the Arctic Circle right now and I am using Night Shift and it's working fine")
13:36
How do you randomly pick between two arguments? For example, I want to do something like winFight(*random.shuffle([protag, antag]))
I'm getting the error message winFight() argument after * must be an iterable, not NoneType
Although there might be a simpler way to do this
generate first, call with a single arg
I'm sure you can find one of those simpler ways if you spend a couple minutes googling
on second thought, maybe not... because your code looks like you're trying to randomly swap the two arguments, rather than pick a random one
Ah, yeah. The good old "mutating function returns None"
@JohnnyApplesauce random.shuffle shuffles the list in-place (returning None), so it's pointless passing it a list literal. What do you really want to do? What type are protag and antag ?
random.choice is probably what you're looking for, although there are other options that may be just as suitable.
hey folks,
How can I know what is the color code for matplotlib's default colors, such as red, blue, magenta?
did a quick google but it was surprisingly difficult to find an answer
13:48
Hi all!
I'm trying to use a "*args" that has 4-7 element but I only want to call all of them except the 2 first
I tried *args[2:]
@zabop Sorry, I don't know matplotlib, but I'd assume that without further info, they'd be the basic, full saturation & full value versions of those colours. Eg red=ff0000, magenta=ff00ff
doesn't work and can't find an answer...
@mbahin It's not clear what your problem is without more context. We need a min-reprex
@zabop "default colors" how? Those are no longer the default line colours in new versions. Anyway, if this is what you need: stackoverflow.com/questions/42086276/…
@PM2Ring please no :D
well I have 2 equations (1 with 4 parameters, 1 with 7 parameters) that I'm applying to a float array, I want to apply these two equations to the same array. I did equation(range(40), *params) which works.
13:59
@mbahin that's not an MCVE
give us ~4 lines of code and tell us how it doesn't work and how it should
ok sorry, I'll try to produce it
thanks
@mbahin quick, format the code
sorry I'm new :D
it is the first item on the starboard
edit and ctrl-k
14:06
side note: np.array(range(5)) is np.arange(5)
where is the sandbox ?
you'll find a link to it if you look
Besides the wonky indentation, that code looks fine. I think a miscommunication has occurred -- a good MCVE should demonstrate the problem you're encountering, but there doesn't appear to be a problem here.
they didn't get there yet I think
since they're new I think it's beneficial if they learn how to read short illustrated guides now
after that we can go into the actual problem
Fine with me. numpy confuses and frightens me so any solutions I offer based on conjecture would be pretty rudimentary anyway
14:14
it's probably not a numpy problem
The swirling mists within my Crystal Ball of Requirements Gathering agree that it's probably not numpy-specific.
@Aran-Fey Yeah, the first arg is the winner and the second is the loser, I'm trying to coin-toss whether the player wins or the enemy
@holdenweb Thanks for removing that. :) I think .choice is the most readable, although using .randrange(2) would be ok if you really need an index, or just the raw random bit. Personally, I'm a fan of .getrandbits, but I probably wouldn't use it for a single bit.
The winfight function is a mutator that affect the stats of both, so both need to be passed in.
@PM2Ring
ok... sorry I found the answer while creating the MCVE...
I'll be better next time! :)
14:26
I think it's already been said, but random.shuffle shuffles the list in-place and returns None. So you need to shuffle on a separate line.
sorry for the time wasting!
@JohnnyApplesauce Oh, ok. So you do want the 2 item tuple or list.
@mbahin Excellent. That often happens when creating a MCVE.
@mbahin no worries, we exactly ask for an MCVE because it minimises time wasted for us, and most of the time leads the asker to find the error on their own.
minimizes time wasted for everyone involved, usually
I'm selfish :)
14:34
Hi selfish, I'm dad :D
Hmm, how fast is random.sample(seq, len(seq)) compared to random.shuffle? Same complexity or no?
@Kevin Not sure. If there's a difference, my money's on shuffle at being more efficient.
The docs say: To choose a sample from a range of integers, use a range() object as an argument. This is especially fast and space efficient for sampling from a large population: sample(range(10000000), k=60)
here is the source. Do my eyes deceive me, or are lines 380-381 a potentially infinite loop?
So sample isn't doing a (partial) Fisher-Yates shuffle under the hood.
@Kevin I haven't looked at the link yet, but I'm getting a feeling of déjà vu... :)
It switches between a list-based and set-based algorithm depending on the length of the sequence and the size of k. The list-based solution looks fairly fisher-yates-y to me. It's the set-based solution that I'm surprised at.
From last month's discussion about the coupon collector problem, we know that the set-based solution takes O(n log n) time when you call sample(seq, len(seq))
14:51
Just to be clear, are you still optimizing the "shuffle two input arguments" problem or is this unrelated? :D
I've extended it to "shuffle N arguments" because 2 was too easy
I'm now timing random.sample(x, len(x)) calls for various sizes of x. It looks fairly linear for len(x) < 10**7. Not sure whether this means I'm wrong about the O(n log n) run time, or maybe n log n just looks like a line if you're zoomed in far enough.
@Kevin Yes, it's potentially an infinite loop. And yes, it's subject to the coupon collector problem that it can take several loops to collect the last few coupons.
I guess from a practical standpoint it doesn't really matter if your algorithm is inefficient for huge inputs, if your algorithm crashes with a MemoryError for huge inputs anyway :-P
... Oh, the MemoryError I just got was raised on line 370, inside the list-based solution. I assumed it used the set-based solution when k == len(population), but it seems like it's not.
I think I underestimated how large setsize can be when k is big.
Note that there's at least one other potential infinite loop in random, eg in _randbelow_with_getrandbits, but in practice that one is benign, since the (mean) expected number of loops in the worst case is 2 = 1 + 1/2 + 1/4 + ...
Conclusion: sample uses an O(n log n) approach when n is small, and an O(n) approach when n is big. So x = sample(big_list, len(big_list)) has the same complexity as x = big_list.copy(); shuffle(x).
15:06
@Kevin So my initial guess was correct: don't use .sample to shuffle a list.
If you want to permute a really huge collection it may be more efficient to use a function that does that without shuffling the list of indices.
I suspect that .sample is almost exactly as efficient (in clock time) as copy-and-shuffle when the list is large. Even so, I would use shuffle to shuffle the list, since that's more self-documenting.
m8_
m8_
Hey all, is there a way to change the name of an existing pandas dataframe in a loop? I have a list of dataframes and want to iterate over them to append "_v1". pastebin.com/NB6WAfBE
@JohnnyApplesauce winFight(*(((protag, antag), (antag, protag))[random.random()>0.5])) seems to work nicely, but I wouldn't like to generalise it to N arguments.
@Kevin True, but if you don't mind if the original list gets mutated then you might as well save time & RAM and avoid the list copying step.
Yeah, definitely use shuffle there since it's O(1) additional memory usage.
15:19
@m8_ "name of a dataframe"?
can you show how you'd use that "changed name" later?
@holdenweb You could do that in a one liner using random.choice. But it'd still be ugly. :)
or perhaps I should ask, what is the "current name" of the dataframes?
exactly my question. (though I cant access the pastebin) I generally use a dict of dataframes if at all I need a name to access them later
it's a list of dataframes
I have a bad feeling that this is a "dynamic variable names" question, and doesn't have anything in particular to do with pandas
15:20
Yeah, random choice between two tuples would indeed be cleaner and just as ugly. People like my code professionally. It's mostly as boring as anything.
@Kevin me too
@Kevin me too. :)
@holdenweb if you're being serious, why not a conditional expression?
I suspect the core question is "given a list seq=[a,b,c], how do I create variables named a_v1, b_v1, c_v1 so I can do print(b_v1) later?"
Also, [random.random()>0.5] is probably slower that [random.randrange(2)], since the latter avoids creating a floating-point random number.
m8_
m8_
15:22
I am performing multiple transformations on the dataframes, reading in many files and comparing them for regression testing. As I perform these transformations, I want to change the name of the dataframes within the for loop and compare them for fidelity
@m8_ your question is ambiguous in it's current state. DataFrames don't usually have a "name". You may be referring to the 'Name' column? In that case, do you want to change all the "names" in the column? Or the "name" of the column named "Name".
@m8_ completely not an answer to my questions
m8_
m8_
df1 = pd.read_csv(file)
If you want to "name" the dataframes for later reference, use a dictionary
m8_
m8_
When I say name, I mean df1
15:23
go on
m8_
m8_
the reference
@m8_ yup, we knew it
x = y = df1 <- what is the name of your df now?
my_dfs = {'df1': pd.read_csv(file)}
@AndrasDeak I wasn't being entirely serious. The serious point, if you want one, is that obfuscating your code in pursuit of an illusory efficiency is a poor tradeoff.
The typical solution, of course, is to store the values in a dict rather than polluting the globals namespace:
>>> original_vals = {"a": 1, "b": 2, "c": 3}
>>> cool_new_vals = {key + "_v1": value*10 for key, value in original_vals.items()}
>>> print(cool_new_vals["a_v1"])
10
15:24
@m8_ what you're looking for is, as Kevin has already noted, dynamic variable names. Don't do that. Do ^ that instead.
@holdenweb I see
m8_
m8_
Ok, Im confused. Kevins implementation does what I want. If that's not dynamic variable names, then why is what I asked dynamic variables names?
@m8_ You don't need to store the names. You can invent your own names and use them as keys to a dict. Then run your for loop with variables with which you look up the dataframes. stackoverflow.com/questions/30635145/… might give you some ideas. Or not!
@m8_ because what you asked is to have a variable named df_v1 which you later use as df_v1.name etc
m8_
m8_
Um...ok. Not what I was trying to ask but I guess I don't understand the verbage I used
Thanks all
no problem, stay clear of eval
15:27
^^^^ what he said!
yeah
@JohnnyApplesauce For the record, here's my solution (and Aran-Fey's):
players = [protag, antag]
random.shuffle(players)
winFight(*players)
I think this is really an XY problem and the code should be reconsidered two steps back
Silly solution:
winFight(*[protag, antag][::random.randrange(-1,2,2)])
same question than the one deleted 2 min ago
15:40
not something we can do anything about
either flag for a mod, or if it needs closing wait 10 minutes and cv-pls it unless it's a dupe
Relatedly, I've never fully understood why object().x = 1 crashes with AttributeError, but class Foo(object): pass followed by Foo().x = 1 works
Insert angry muttering about Liskov's Substitution Principle here
Shalom, שלום, cabbage!
Quick question, I'm using Django and I'm coding up a basic form that when the user hits the submit button, an AJAX call is performed and the information from the form is written to a json file.
Yesterday, I attempted to pass the information in to the python controller action (not sure of the proper terminology?) however no data was passed in.
It was very strange.
Any ideas what I could be doing wrong?
Sorry that it's not formatted.
Quick - edit and hit Ctrl-K
15:50
Ah I don't know how to do that.
^^ You have 2 minutes to fix
you might have to highlight before ctrl-k (but after going into edit mode)
I tried but no success.
not shift K, ctrl K
@Kevin I don't know either, but it doesn't break LSP. A child must have all attributes (including methods) of its parents, but it may have extra attributes. So a child has to be acceptable in any context where a parent is permitted, but not necessarily vice versa.
15:52
@PM2Ring Yeah, thinking about it some more, I agree with you. I'm still irritated by the discrepancy, but I can't pin it on LSP.
Ahhh darn, tried again. bummer it's okay sorry thanks for the help
Where is the Python part?
and practice in the sandbox
@AndrasDeak okay, thank you.
@Kevin Pretty sure that none of the builtin classes allow addition of attributes like this, but subclasses of them will.
@Kevin Here's a question about it, with answers by Martelli & Antti Haapala. stackoverflow.com/q/1529002/4014959
cabbage @PM2Ring
Let's see if I understand. you need a __dict__ to do arbitrary attribute setting. Builtin types don't have __dict__ because they don't need it in order to fulfill their purpose and including it anyway would be inefficient (and in the case of object(), would require the resolution of a tricky circular reference problem).
A class the user defines gets a __dict__ automatically because otherwise you would have to define all your attributes ahead of time, and separating definition from assignment is not in line with Python's design principles.
@PaulMcG Correct. Originally, that was an artifact of those types being defined in C, and the fact that they don't have a __dict__. I suppose they could've changed that when new-style classes were introduced, but I'm glad they didn't. I agree with Martelli that a __dict__ that's rarely useful would be annoying overhead.
16:05
Oops, when I said "define" I mean "declare"
What should be the fate of such questions. OP has already done all the work but didnot assign the result of the code to the dataframe back. Can't find a dupe either
static allocation of space for attributes is usually done by defining __slots__. I notice that object has no __slots__ attribute, so I guess it's using C-level magic to allocate space instead. I give this a 3/10 on the irritation scale: I won't complain about it on its own, but I might attach it as an "and another thing..." rider to an existing related complaint.
@anky_91, Proposal: change your comment into an answer, and use this post as a dupe target for similar problems in the future.
@anky_91 close as "typo or cannot be reproduced"
@anky_91 either a dupe or unlikely to help future readers (i.e. "typo")
most of pandas' API supports an inplace kwarg implying that they don't mutate by default, so it's probably a dupe
Yeah, assign unfortunately will create a column. I am more inclined to close as typo(searchon for possible dupes now) Thanks guys
16:14
Unpopular opinion: simple mistakes are not typos and the typo close reason should not be used to close questions about simple mistakes. I reject the reasoning of "simple mistakes are typos because if the OP had typed their code differently, the code would have worked" because it proves too much: literally any problem can be solved by typing the correct code instead of the wrong code.
@Kevin I'm not saying it's not using C-level magic, but it's certainly not required.__slots__ only needs to exist at class creation time; once the class exists you can safely delete the __slots__ attribute
user10984358
quick question, say if I want a program to just click a link then click a specific box thats always present at set position, save the image go back and repeat the process for all links in the page, is BeautifulSoup the one I should be looking at or are there any other approaches?
@Kevin that's a good point that I hadn't considered. I don't take "typo" with that negative connotation, though. I have been thinking of "typo" as a small mistake in the code that is corrected by a comment rather than a full-blown answer.
found this thankfully
my search terms are pathetic :P
For me, the causation chain is the opposite: "I can fit the answer in the space of a comment" doesn't imply that the problem is a typo. But the problem being a typo implies that you can fit the answer in the space of a comment.
@TheNamesAlc BeautifulSoup doesn't really have a concept of "clicking". Selenium does, though. Try Selenium.
user10984358
16:19
well I don't really want to click per se, all I want is the image downloaded to my hard disk, I knew selenium could do that I just dont want the whole window in front of me, end result image saved is all I care
user10984358
pretty much something that can navigate to a div and save the sourced image in the img tag
@Kevin agreed with that
If the image is present in the initial html at page load, then you can use BeautifulSoup to extract its url and download it with whatever module you used to download the page itself. If the image only appears after some page event, in particular one triggered with javascript, then BeautifulSoup can't make that javascript run because BeautifulSoup is not a javascript executing library.
user10984358
if I click a link it opens as a new page and appears at a position that never changes, so what I want is this new image saved and go back to previous page, and click the next link in the list and repeat the process
If there's no js involved and the link is a simple <a href="whatever.png"> then you can use BS to extract the href and download the file at that url.
user10984358
16:24
thats what I wanted to hear, thanks!
Locating the link on the page might be a bit tricky if you only know its screen coordinates and not its position in the DOM. Best case scenario, you know exactly what its id is and can unambiguously identify it every time. More likely you'll know its class and will be able to get every element with that class name and make an educated guess about which one you want.
16:40
@AndrasDeak thx!
anytime
rbrb..
00:00 - 17:0017:00 - 00:00

« first day (3195 days earlier)      last day (1977 days later) »