Hello I am new to browser automation using selenium and i'm having a tough time finding the elements I need. When using the "Inspect Element" feature of chrome, there are not much identifiers that I can use such as ids. And the identifiers seems to be shared between several items and indicates verb-like texts rather than nouns. For example: "next-menu-item-text" and "next-overlay-wrapper".
In the devtools there doesn't seem to be any information for the link of interest from html -> body the next one is already unusable with "div.next-overlay-wrapper.opened" as the class and so on
Any leads on which reference I should take a look at?
@JonClements Just stumbled over one of your answers while playing with my dupe hammer. Do you think it would make sense to include the linked rationale as a quote in the answer itself?
@hugovdberg It's just my background rambling. Lately, I've come to be fed up by libraries that avoid having an opinion and just dump a ton of options at users for them to figure out the mess.
Hi there! What do you use to make a web framework (bottle, flask etc.) communicate with workers queue? I often see Redis, but aren't there even more lightweight solutions?
What do you mean by lightweight here btw? I would consider Redis pretty lightweight, but as a service it has a decent sized footprint (if you're trying to run on limited resources like disk)
How can I activate a virtual env on login on Ubuntu 20.04? I thought a source in the bashrc would be enough but that doesn't work. SO only tells me to make a simple alias, but I want it to happen automatically
Is there an equivalent of Redis but 100% in python? I mean not a redis client (pip install redis), but rather an in-memory server 100% written in Python?
FWIW, if you want to build something like that for fun and pleasure... I'd start by having a dedicated Python process that a) has a worker pool and b) exposes a socket to receive tasks.
That should be a few lines of code. You'll mostly be working on the socket part to roll out your own communication protocol.
@MisterMiyagi And that is fun(interesting and you learn a bunch)/not fun(it's hard and has potential pitfals) at the same time. Plus you are basically reinventing the wheel. But it's the first thing I did in my current company and overall I would say go for it if you don't have any deadlines :D
I don't think reinventing the wheel is actually a bad thing, as long as you are mindful that a toy is not fit for production. It's how you understand how wheels work, and are prepared to fix the important ones when they break.
> redis-py 3.0 only accepts user data as bytes, strings or numbers (ints, longs and floats). Attempting to specify a key or a value as any other type will raise a DataError exception.
Is there an equivalent of atexit when an asyncio loop shuts down? My Fried Google only gives hits for running asyncio tasks when atexit runs, but not anything for cleanup of asyncio runs.
Ugh Microsoft and Outlook in general are so .... I have an issue and now I'm trying to contact support to fix the issue, but getting help in itself turns out to be an issue. And both issues claim that certain buttons are in certain places to do X or get help, but they are not, now I have 3 issues... **** Microsoft
since I hang out in room6 SO shrunk to 70% room6, 20% hnq and 10% SO
I wonder how big other rooms are and how many active users which rooms have. I'm sure one could make a cool looking graphic about these things across SE
@Basj A TCP socket just provides streams, it has no concept of messages. You have to roll out your own protocol on top. Common approaches are to add separators or to prefix "messages" with their length.
Basically you are gonna have to have two things in sockets, fixed sized messages, which tell the receiver how many bytes you are gonna get and then the next message can be variable(the length you just told the client in the previous message how long it's gonna be) length. Then fixed sized again and so on
This bothered me at the beginning, but you really do have to have a fixed sized message as part of the protocol, be it only to tell how long the next variable msg is gonna be
then on the listener you have a loop which either waits fixed sized bytes or the previously received variable amount of bytes. If you receive less or more something is wrong and you abort and go back to the last safe point
@MisterMiyagi Hmmm ok, so I really need to reinvent the wheel :) Is there a ready to use higher-level messaging in built-in Python? Without third party tool?
@ChrisP I don't use Qt, but doesn't it have something suitable in its standard widgets? I guess it's nice to customize the appearance of your GUI; OTOH, it's easier for users to understand your GUI if it sticks to the existing standards. Does your image have to be a PNG? Or can you use a SVG, eg
Hm, come to think of it, it's probably not that difficult to install the cleanup hook either. Since one has to manually register the cleanup functions anyway, that would be a good point to add the hook to the event loop.
@Basj Fair enough, although it's pretty easy. Here's an example in one of my old answers, although it's not as streamlined as it could be because it's designed to work on Python 2 & 3. stackoverflow.com/a/51332745/4014959
How to find rotation of a image compared to template using SIFT? Also how to find rotation of a particular feature in image compared to the same template feature? Draw keypoints is suppose to show rotation but image I am working with is too low res to actually see the rotation and some hard numbers which can be compared will be helpful.
Hello, I have a column with "Names" like PAULCHRIST, all have the same last name CHRIST, but the first names change. I want to split the text in "Names" and put it in two columns "firstname" and "lastname".. I tried df[['first', 'last']] = df['name'].str.split(' ', 5, expand=True) but it doesnt work.. can someone help?
I have a bill they paid in "bill", such as 0.0148USD. Now I want to split the "bill" column in two columns "amount" and "currency". It's always USD. How can I do this?
@Basj I have no experience with Multiprocessing, so I'll let MisterMiyagi handle it. (But what he says about the timing makes sense to me).
@Hakaishin It's borderline, since it relates to earlier discussion from before the question was created. OTOH, to prevent parallel discussion, anything that needs saying should be said on the question page, not here in chat.
@Basj when using multiprocessing, you'll probably have different result depending on your OS, just fyi
also consider trying the threading module too and see if there any speed difference, I believe there might be some :)
also, the way you benchmark this (eg: using time.time) wouldn't be enough if you want to know how fast it send/receive, so consider trying something like that
Hmmmm would it be better to have if foo.x == 'b' and foo.y > 2 and foo.z in z: and later elif foo.x == 'c' nd foo.y > 2 and foo.z in z: or to have a basic if at the beginning like
if foo.x == 'b':
if foo.y > 2 and foo.z in z:
....
....
elif foo.x == 'c':
if foo.y > 2 and foo.z in z:
....
....
Or is there some other better way to write this code
Hi, I have written a python module called mis.py. This module has a function called connect(string). In my main code (main.py), I call mis.connect(string). If I invoke main.py by using python.exe main.py every works fine. However, if I directly cally the main bytecode using python.exe main.pyc then I get an AttributeError: module 'mis' has no attribute 'connect'? Any idea?
@DelriusEuphoria no point in adding an additional level of nesting if there's nothing inside the outer conditional block that isn't inside the inner one as well.
If you're worried about readability you can consider defining those conditions ahead of time: needs_frobnication = foo.x == 'b' and foo.y > 2 and foo.z in z; if needs_frobnication: ...
Python is very deeply rooted in open-source, and "distribute my code in a way that users can't reverse engineer the original python code (or equivalent)" is a very tough cookie
I agree with the decompiler comment, but for now the policy is to leave bytecode and I don't know how to get around the AttributeError. Thanks in advance
I Gotta run to a meeting,.. will read comments afterward. thanks
heck someone can just decompile your ELF binary or whatever
(there are actually several tools that will cheerfully turn .NET or or Java executables into code. Sure you'll be missing comments and maybe useful variable names, but...)
@AndrasDeak--СлаваУкраїні does that still work? Last time I tried I think it had been removed or something