« first day (4230 days earlier)      last day (704 days later) » 

12:01 AM
Hi all. I have a question
 
github.com/python/cpython/blob/main/Python/compile.c#L8727 appears to be responsible for several optimizations like that one. The code is cryptic, but some of the comments are interesting... Ooh, "Try to fold tuples", sounds fancy
 
12:22 AM
Does anyone have experience with ExoPlaSim?
 
12:35 AM
9 commands
 
12:46 AM
@Kevin Awesome
These programmers that implement programming languages are true geniuses. Do these Python/CPython folks sometimes show up here in the chat? Just a curiosity.
 
1:47 AM
How to make the code robust so that there won't be any accidental escape characters that breaks the data?
 
 
2 hours later…
4:08 AM
added a new draft FAQ to sopython.com but I guess there are probably better canonicals to link to sopython.com/canon/152/…
 
 
1 hour later…
5:08 AM
do we have any good duplicate for "why does Python only use one CPU"? Perhaps stackoverflow.com/questions/72253887/…
@Pherdindy I don't think it's possible from your image to understand what you are asking or what data to expect. In broad terms, define what types are acceptable and make the code puke if it sees anything else
@Marco I don't think I have seen any of the core developers here in chat (at least with their real name!) but some of them are frequent guests on some of the podcasts I follow
 
6:05 AM
stackoverflow.com/questions/72254510 any dupe targets for the problem of "I tried to use if/else in a loop but I only want one output, depending on whether (any|all) elements meet the condition"?
@Pherdindy hard to say what to change in the code, if we don't see it
@Marco idk about the chat, but Raymond Hettinger often answers questions on the main site (including self-asked ones).
(I've seen Tim Peters around on sorting-related questions, too)
 
6:54 AM
@Marco Ethan Furman, the person developing Enum, has been in a number of times
 
 
6 hours later…
1:14 PM
Hello there, I'm having an hard time finding a way (possibily within the standard library) to have my program sleep in a hibernation / suspension resistant way. Specifically the sched module overshoot the time set if the pc (linux) is put into suspension. Any hint would be appreciated.
 
The only solution I have seen is to do a loop+sleep, where the loop checks for the completion data and the sleep uses exponential backoff to get more precise closer to the deadline.
 
Yea I've seen that too but I would prefer to use this solution only as last resort; thank you
 
Exponential sounds bad in this case. If you ever sleep for a long time, you can overshoot by a lot. Just sleep for 1 second or something
 
It's a tradeoff between trashing and overshooting. 1s can still be pretty bad depending on what else is going on.
 
If you poll every n seconds you can overshoot by n seconds, right?
This sounds like something that needs consideration of the use case
How much overshooting is OK?
 
1:29 PM
It would be nice if the OS could notify interested processes that it has just woken up from a suspension. Then the processes could recalculate their time-related logic, and minimize potential overshoot.
 
I mean, i could craft myself an acceptable solution but it seems to me it's a common enough problem to hope for a ready to use solution. I'm more asking to be pointed to some resources than hints on how to implement it myself
 
Apparently, windows has shutdown events that could be used to craft a "check the remaining time the next time you run" routine.
 
(un)fortunately i'm working on linux
 
@Michele Afraid there doesn't seem to be one that's well established (aka reliable).
 
Mhkay, i also tried a couple of times searching it on the web but with no avail. @MisterMiyagi thank you for your time
 
1:35 PM
stackoverflow.com/questions/6136111/… looks relevant. TLDR: there's no bulletproof way that works in every distribution with no external dependencies
 
user18313765
1:48 PM
BOUNTY: Two days ago I posted this question but got no answers. Now I have set a BOUNTY with a value of +50. I hope there is someone nice to help me. Thanks
 
user18313765
2
Q: Click all buttons and skip one when I get error exception,then continue clicking all of them. After exception is executed, not all buttons are clicked

Jas_99I present to you some executable, functionable and GUI code, created for study purposes only. I have a problem with automatic clicks after except, precisely, after the exception ElementClickInterceptedException, I would like to continue the automatic clicks code in a While Loop, but always RESPEC...

 
I'll take a look.
 
Is the tkinter code really necessary?
 
user18313765
@Aran-Fey Do you say a me?
 
If by "Do you say a me?" you mean "Are you asking me?", then yes, he's asking you
 
user18313765
1:55 PM
I thought you were talking to some users in the lines above the chat. Sorry
 
user18313765
tkinter is not needed (maybe I will remove it), but I preferred to insert it currently
 
user18313765
the important thing is that I can solve the problem. later I can also remove tkinter and use some input in the console
 
I don't mind tkinter, as long as the code is complete and verifiable. Unfortunately, facebook is blocked on my network, so I can't do much troubleshooting.
My general advice is, don't put any code in your except block that might cause another exception. For example, if click() can raise ElementClickInterceptedException, then don't call click() inside your except ElementClickInterceptedException block.
 
user18313765
Can you show this part of the code on a site to change the code online? I'm not asking you to solve the question that you can't even test it due to Facebook being blocked, but I'm just asking you to show me this piece of code you suggested. Thanks
 
I will explain further. Just a minute...
 
2:08 PM
@Jas_99 just FYI in case it's unclear: you don't have to put a bounty on a question to ask about it here, it just has to be eligible for a bounty (48 hours old)
 
Btw does anybody know if this chat is monitored by SE? By Bots or sentiment analysis tools in general?
 
user18313765
@Kevin Thanks, you are kind
 
The odd user might be running bots for fun but I doubt there's anything organised, and fairly certain nothing official
 
user18313765
@Hakaishin I knew it. I knew I can post unanswered questions after 48 hours. About the sizes I did not know. So if a bounty is not answered within 48 hours, then can I submit the question here?
 
user18313765
2:13 PM
@AndrasDeak--СлаваУкраїні What do you mean sorry?
 
@Jas_99 my last message was directed at Hakaishin
@Jas_99 my point is that bounties and asking here are independent things. Only the age of the question matters. Just please don't repost that embedding link several times until the bounty is over.
 
user18313765
I would like to point out that my question is for personal and informational study purposes only. I am new to Python and am now learning Selenium. I don't want to use spam and don't really want to use the script in real cases. Respect for Facebook rules. As I said, my question is just a curiosity for personal study purposes
 
user18313765
@AndrasDeak--СлаваУкраїні OK understood. I apologize
 
That's fine with me.
(Still writing my explanation)
 
cdb
Hi everyone, I have a question. When I run my code using PyCharm everything works, but if I use the terminal I have a ModuleNotFoundError. My structure is:
(all packages are inside Project folder)
- Project
- Applications
a.py
__init__.py

- Classes
b.py
__init__.py

- Tests
c.py
__init__.py

And on a.py I have from Classes.b import method_name

When running on the terminal I tried python3 -m Project.Applications.a
 
2:28 PM
What are you trying to import from where, and how are you doing it?
 
cdb
from Classes.b import method_name
 
If Classes is a submodule of Project, then it must be from Project.Classes.b import method_name
 
@Jas_99 Here is a prototype that demonstrates what I mean. The function f is the only approach that calls a risky function inside its except block. It's also the only one that crashes Python with an uncaught exception.
 
cdb
Classes is a package. With the import I have I don't get any error if running a.py on PyCharm but only if I use the terminal, which it's kind of confusing. Doubled checked the interpreter and I'm using the same as PyCharm
 
Functions g, h, and k are alternative approaches that won't crash. Each one has its pros and cons. I would probably use something like k if I was doing something involving the Internet. Or any network connection, really.
I have a feeling that you already tried something like k, but couldn't get it to work and erased most of it. That would explain why you have two iterating variables and a break in your code.
 
2:42 PM
@cdb Have you marked any directories as sources roots in PyCharm? Those would modify where programs run through PyCharm look for other code.
 
 
1 hour later…
3:47 PM
@tripleee Ok, awesome... could you please cite some of these podcasts that you follow?
@KarlKnechtel Very good!! Nice to know...
@roganjosh Right, very cool!!
 
4:24 PM
Is there an equivalent of inspect.getgeneratorstate for async generators? I'm trying to find out whether one is closed.
 
4:37 PM
Can't find anything of the sort
 
You're doing some scary things to generators lately. I don't think there's something in the stdlib for that, but the code of getgeneratorstate can be pretty easily adjusted for async generators (replace gi_ with ag_)
 
@Aran-Fey "You're doing some scary things to generators lately." Wish I wouldn't have to. Ran into an issue where nested async generators may get cleaned up out-of-order by the event loop at shutdown, and the entire generators-all-the-way-down of async is asking for the big guns.
@Aran-Fey Nice hint about the ag_ attributes. I'll look into those.
 
@MisterMiyagi Oooh, I never thought of that. That's definitely something that'll never get fixed!
Hmm, on second thought, maybe it's not that difficult of a problem
 
The annoying bit is that it's an incredibly rare race condition, so it's pretty hard to say whether synthetic tests actually cover reality.
 
user18313765
5:02 PM
@Kevin Thanks. Now I take a look at the code and if I have any questions I write to you. Thanks again
 
Hello
I am getting some gtk warnings and errors related to theme icons, when QFileDialog is opened (pyqt5 app).
This error is on runtime (after pyinstaller compile).
Is there something i have to do like hidden import /usr/share/icons/hicolor folder in spec file or something else?
(Papinhio player:107871): Gtk-WARNING **: 19:43:59.895: Could not find the icon 'document-open-recent-symbolic-ltr'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	icon-theme.freedesktop.org/releases

(Papinhio player:107871): Gtk-WARNING **: 19:43:59.895: Could not load a pixbuf from /org/gtk/libgtk/icons/16x16/status/image-missing.png.
This may indicate that pixbuf loaders or the mime database could not be found.
**
Gtk:ERROR:../../../../gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to
 
5:23 PM
I have packaged gtk into an exe once, but that was on Windows. And 5 years ago. I had to include all of these directories:
site-packages\gnome\etc\fonts
site-packages\gnome\lib\gdk-pixbuf-2.0
site-packages\gnome\lib\girepository-1.0
site-packages\gnome\share\glib-2.0
site-packages\gnome\lib\gtk-3.0
You probably don't need all of those, but adding the fonts directory is probably a good start
 
I think this problem is related to gnome-tweaks installation.
I will try to remove it and then rebuild the project.
 
stackoverflow.com/questions/72263204 Is there a canonical for "I gave a module in my project the same name as a standard library module and it caused import problems"?
 
looks like @MisterMiyagi already turned that up. I feel like it would be a good idea to make some variants for the other kinds of problems that can come up.
 
@Aran-Fey it's not gnome tweaks problem.
Anyway i can't find site-packages\gnome folder...
 
5:43 PM
@KarlKnechtel I think the proposed dupe might work (it would for me) but there's a chance people need the "your own script" and the "some junk you left lying around" cases addressed separately.
 
I decided it's worthwhile opening the can of sys.path worms anyway. the OP might need some edits to make it a good reference question in that case, since generally people should just rename the file, but it's useful to understand
the problem is that the canonical would be better as a reference if it addressed multiple possible variants of the cause ("there is something in the project that is picked up by sys.path"), but that makes the question impossible to ask in SO format (anyone who asked a general "I have something in my project that causes a conflict; why is there a conflict?" question is obviously wrestling with a "typo")
we could, I suppose, fake a question along the lines of: "I recently resolved an ImportError problem in my project; after extensive research I accidentally stumbled on <original question> and suspected that I had a similar problem. Aside from directly trying to import standard library foo from my own foo.py, what else could be in my project that causes problems like that? Why does this happen - why aren't standard library (or third-party package) contents found in preference to my own?"
(but really what should happen is that I write The Authoritative Guide To ImportError, and then we link it in comments the way that we link things like Ned Batchelder's talks on Unicode and on names in Python, and references about debugging / Unicode encodings / floating-point arithmetic)
someone else found stackoverflow.com/questions/10501473, which is interesting supplementary material
 
6:04 PM
You might just want to wait a bit and then edit the recent question into shape.
Our answers aren't tied to any specific mistakes they made, so there is room for change.
 
@Aran-Fey i found this option: QFileDialog::DontUseCustomDirectoryIcons but didn't help.
 
@MisterMiyagi How does this manifest, out of interest?
 
Here's one I answered ages ago: stackoverflow.com/q/32180949/4014959 but it's another case of the script itself colliding with a standard module, not a random junk collision.
 
6:38 PM
This thread (and it's predecessor, which I can't seem to find) may provide some supplementary material, at least on the thoughts of core devs about import shadowing.
 
6:58 PM
@Aran-Fey I made a minimal QFileDialog app and there is no gtk error.
Strange, so the error is somewhere else...
 
7:16 PM
@roganjosh My case is having an asynccontextmanager (which wraps an async generator) to manage subprocesses, and parsing its output in a bare async generator. Usually, when the outer generator is unwound it implicitly kills the context which cleans up the subprocess gracefully.
But when the race condition strikes, the event loop already force-kills the inner async generator and its subprocess. By the time the outer generator unwinds, first the context panics because "someone" already killed its private generator, then the outer generator panics because the context panics, then the event loop panics because the outer generator panics. The traceback isn't exactly helpful to find out who shot first.
 
Do you know what situation gets the private generator to be killed by the event loop?
 
That's what I was guessing in terms of the traceback. Does it bubble up from C or does Python try to give something "helpful" in what went wrong? Seems like a corner case that might go totally unhandled by python itself
 
It's actually just a regular Python level error. Throwing a GeneratorExit into a living generator ping-pongs the exception, but a dead generator just eats the exception.
@AndrasDeak--СлаваУкраїні Since the async generators need an event loop to clean up, the loops usually store them in a (weak) set. Killing the generators gracefully is actually per design, but the arbitrary order can be messy.
 
So it's normal, just stochastic
 
8:21 PM
Was in a need of a short overview of machine learning stuff for an interview, Google helpfully suggested "Top 50 Machine Learning Interview Questions". Perfect.
Might as well glance through the "Top 78 IoT Interview Questions and Answers" while I'm at it
 
Google is generally very knowledgeable
 
Anything I might be able to help you with, @vaultah?
 
that barnacle mating optimisation sounds intriguing
 
Oh, man. I give my algorithms boring names but actually, I need to look into nature for inspiration
In one of the heuristics, we've settled on the term "dart" as where an iteration will focus on changing one small part of the solution. I'm reminded of those fish that spit jets of water to knock flies off a leaf. Maybe they have some other quirky private lives I could model
In any case, I don't focus on full ML stuff myself, more Operations Research stuff, but I still interview for our dept
 
@roganjosh nah, it's fine. It turns out that a position I applied for may involve a bit more machine learning than anticipated. I'll try to find out exactly how ML-heavy this position is during the interview, but I'll need to "refresh" my non-existent ML knowledge, so as not to look completely stupid
This is hilarious. Minimum qualifications for the job don't mention ML at all, the job description talks about some "collaboration with a multi-disciplinary team of ML researchers". Then they contact you and you find out you'll "create advanced machine learning techniques .... Model, architect, and develop advanced machine learning hardware (co-designed with machine learning software)"
 
8:43 PM
better get used to scope creep early on
 
This is actually less than 10% of that "job overview" :D It gets more and more insane
 
Well that seems pretty brutal to go straight into the hardware design. Shame we've already exhausted GPUs apparently; you'll be bleeding edge
 
But I won't :D I'm so not getting hired there
At least the interview will be fun, I hope
 
I've no idea what the company's plan is in this situation
Seems like a lot of wasted effort for everyone involved
unless there's some weird politics where they have to interview but don't want to hire
 
I suspect that vaultah will get a decent insight from it
 
8:51 PM
@AndrasDeak--СлаваУкраїні I've heard stories about recruiters interviewing candidates they never intend to hire just to fill some quotas
Yeah
 
I think that vaultah will be hired
 
I think that vaultah doesn't want to be hired there
 
I don't think it's about whether vaultah is good or not, but rather that the domain has shifted from the initial expectation of the role
 
Will vaultah not accept be hired if he is hired?
 
@vaultah ace the interview out of spite
@roganjosh also incompetence or bad faith motives
 
8:54 PM
Perhaps that too
If I was going to that interview, I would be raising on the hardware side why we have drifted past GPUs so quickly. NVIDIA makes some extraordinary claims here about their speed. I've spent a lot of time thinking about how to leverage GPUs for this (being HP-Hard/NP-Complete problems) and never got a great answer
CUDA is on my list for this for sure, though. Still, the market is way behind in application unless you can get in a lot of custom constraints that don't always map to a matrix operation very cleanly. It's at least one avenue to put the interviewers on the defensive
 
If I disclose that the company in question is Qualcomm, it'll probably make some things a bit more clear
 
9:10 PM
It'd be interesting to see where their ML comes into play :)
 
 
2 hours later…
11:09 PM
stackoverflow.com/questions/30539882 man, I wish I had found this question back in the era when it was an actual problem for me
 
Weird
Well, I have sorted a pandas dataframe by a column, how I also sort the row index respecting that sorting?
 
It wasn't :(
 
A MCVE will help?
 
11:21 PM
if the goal is to get help then yes
Without an MCVE my recommendation is "don't do what you are doing, instead do what the examples in the linked docs are doing"
 
Ok, no problem. In a few minutes I will send a MCVE.
Well, I think I am not doing some weird thing
 
11:51 PM
pip install gdown
gdown 1H9lPtj8yyBsawOItnjX3enYqxG-B7Tw5
import pandas as pd
import numpy as np

weird_df = pd.read_pickle('weird_df.pkl')
weird_df.sort_values(by=["FILE"], ascending=True)

print(weird_df)
 
what is gdown?
 
Supports downloading from Google Drive folders
 
(also, for security-culture reasons, it's kind of impolite to give your MRE data in pickle form. they can contain executable code)
better is a CSV that pandas can read
 
Wow, I did not know that, but I swear this is a secure file
Should I give a csv file?
 
that is preferred, yes
(one possible ref: stackoverflow.com/questions/10302247/… it's also talked about all over the documentation)
 
11:56 PM
Ok, I will do it
 

« first day (4230 days earlier)      last day (704 days later) »