« first day (3784 days earlier)      last day (1147 days later) » 

4:02 AM
@smci cv'ed
 
Looks like a dupe of this too: Convert a spark DataFrame to pandas DF based on the title and accepted answer
 
@anky yeah might be a better match - but considering he's got a list of lists, or whatever, they should just create the df directly
the pandas df i mean. don't know why he wants to create a spark df first
 
I think that was just an example, my hunch op has a spark df and wants to convert to pandas. But I will leave it to them :D
 
@anky yeah, too many XY Problem possibilities, esp with new posters
 
Yep :)
 
4:08 AM
btw, is there something like "the stackoverflow effect" or a name for when you write down an MRE to post a question on SO but in the process you find the problem in your code and solve it?
 
rubber ducking?
 
i beg your pardon?!
:P
that sounds wrong and NSFW, PG18
 
I guess that is the word you were looking for, I may be wrong
 
oh, is it? nice
sounds too Python-specific though
 
I have seen a couple users use that word here, so maybe you are right, I dont hang around in any other programmer circles
rubber ducking from wikipedia tells its usually explained to a duck or a person, in this case the duck would be one writing MRE
 
4:15 AM
i c
ok, yeah - Rubber duck debugging is pretty close to what i meant - en.wikipedia.org/wiki/Rubber_duck_debugging
 
4:55 AM
Hello everyone. Is there a general chat? I can't see it if there is.
I have a question but I'm not sure if it's the right kind for here and it's certainly not Python-related.
 
@A.B. hi, maybe check here for something related, esp if it's not about Python: chat.stackoverflow.com
 
Oh, thanks for the answer. I have been looking, but haven't been able to see anything relevant.
Basically, I was wondering if somebody could please give me a hand with reinstalling my OS. Tried various things and it won't have it. Says there's no file system or something.
 
yeah, that's not something we'd be able to help you with. no filesystem = format your drives (hope you backed up your data already)
 
It's a new hard drive. I've created a partition on it, but that didn't make any difference.
I don't think I usually have this much trouble. I've reinstalled Zorin quite a lot on this laptop, they don't seem to get along, something's always going wrong and meaning I have to reinstall.
 
suggest you google for it or search for a youtube guide vid. there should be plenty
 
5:06 AM
I tried Unix and Linux Stack Exchange chat but there's nobody there at the moment.
Why does everyone always think Youtube videos are a good answer?
Oh, well, I'm an alien, that's all there is to it.
 
@A.B. they are step by step guides catering to the non-technical. if you're used to linux/unix, i'd recommend getting onto IRC (freenode) and finding the right chat room there.
 
Can't use freenode, am using Linux off a live USB stick and can't install HexChat, and freenode doesn't work with Mibbit.
Its own webchat page doesn't work either.
Hang on.
Might only have not installed because I was using it with the old broken hard disk, let's try now.
Off-topic, your chat is much better than the other Stack Exchanges'. Pity they can't copy that. :-P
OK, have HexChat. Whether there'll be anyone around is another matter.
 
5:25 AM
@aneroid Yeah who knows, it's basic RTM stuff and thanks for closing it guys.
 
5:55 AM
stackoverflow.com/questions/66344782/… - an Assignment Dump from a workshop or something?
not a new user and seems to have a history of asking bad questions; and not accepting or upvoting answers to their questions
 
6:45 AM
could someone pls approve the edit on this post, it's unreadable as is: stackoverflow.com/questions/66345416/… (not my edit, but i've approved it)
 
7:08 AM
Don't make beauty edits to closed questions
The first edit will put the question in the reopen queue. If all you do is make it a little more readable, you're doing the OP a disservice
 
unless this is implemented
 
7:48 AM
I am pretty familiar with how to add text to a database but today I have tried to add an image to the database. However, I am getting very much confused on how to solve this problem
```sqlalchemy.exc.StatementError: (builtins.TypeError) memoryview: a bytes-like object is required, not 'FileStorage'
[SQL: INSERT INTO upload (img) VALUES (?)]
[parameters: [{'img': <FileStorage: '1.jpg' ('image/jpeg')>}]]```
 
What is a "FileStorage"?
 
Hello, can anyone solve my doubt?
 
Please dont ask about questions from main site until at least 48 hours, as per our room rules
 
okay.. tnx for the reply man
 
@Aran-Fey From this example dpaste.com/44WNDGYKF , FileStorage is the instance returned by the upload_file variable in the index() function
I have read that their are two ways to go about saving files to a database, especially image files. One way is to literaly save the image data into the db. The other way is to save the path to the files stored in a path in a flask application, then save the path to the database
 
7:58 AM
i imagine storing images in a database means you'd have to either store the raw bytes in a blob, or store a url/path to it
 
@ParitoshSingh that's right
 
ah then yep. basically pick an option, and then actually convert this FileStorage option to one of the two choices yourself.
 
wow, the documentation for FileStorage is awful
 
the idea is this: i assume database is not going to directly accept FileStorage objects. so you have to convert based on whatever option you choose. disclaimer: (pure speculation, ive never worked on this)
 
I have given it a shot as seen here dpaste.com/44WNDGYKF. What i am not struggling with is how to implement two things: (1) how to convert the file object from the upload form into byte-like data (2) how to add the path to the database.
 
8:01 AM
Also... one generally doesn't store image data itself in a DB... normally you store the image on disk but with a path to it in the db
 
I have been able to store the images in a folder in a local disk. how to add that path to db is my struggle
@JonClements and maybe it is because of the size of the file? probably?
 
try a .save method on FileStorage? give it a path on your system. see if that works
 
8:56 AM
Cbg
 
9:14 AM
@AaronHall thanks for the answer, Aaron. This will take me a while to chew through and write examples for (wasn't even aware of ABCMeta), but it's very much along the lines of how I wanted to talk about the the topic.
 
 
1 hour later…
10:20 AM
Is there no way to read a value from an asyncio.Queue without removing it from the queue?
 
Nope. Not unless you access the queue internals.
 
Guess I'll have to try and figure out what the heck is going on in the Queue source code then
 
10:45 AM
honestly, writing a library of proper primitives on top of asyncio might be worth it.
 
And there doesn't seem to be a way to schedule execution of an async function either...? call_later needs a regular function, from the looks of it
 
AFAIK creating a task is the proper approach.
ah, you mean with a delay?
 
Yeah. Being able to do loop.call_later(3, my_async_func) would be a lot nicer than calling create_task on a function that starts with await asyncio.sleep(3)
At least my queue implementation seems to work. No clue why the one in the stdlib is so overcomplicated
 
I chose "Historical Reasons" for 20 quatloo.
 
Wli
11:03 AM
Hello all,
I had some idea for a library to do a better "progressbar" linked to a function, I wanted to discuss first if it is useful ; and if yes, what should be the API. I picked reddit python, but I now don't think it's appropriate (yes I was downvoted!). Do you have a better place to discuss that?
I don't know if I may share linksn but still here it is
 
maybe not what you want to hear, but if you feel like something is good, just do it, useful or not, you may learn things
along the way you may end up making something else and that might be useful
 
Wli
I like discussing first before throwing myself into a project.
 
there is the learn python subreddit
 
That really doesn't sound very useful to me. Measuring progress by how many lines of code have been executed is questionable at best. Any function with a loop inside would make the progress bar jump back and forth, for example
 
I'm with python_learner on that one – just start doing it and see what works.
There is no perfect solution, I blame the halting problem, so looking for one will never work out.
 
11:16 AM
I should change my name back just so the point I made suits me more :)
 
Now, practically speaking what you need is a trace hook. I would recommend to just dump all data into a NamedTuple, and take a format string from the user – that gets rid of "linelength", "linenumber" and many other flags you haven't thought about.
 
Wli
Thanks, that's the kind of feedback I was looking for.
What do you mean by halting problem?

I am thinking my user case may not be very universal. I often make functions on the fly to process data in a separate thread, and I need to code myself how the progress bar should evolve or return the error it encountered. And I was thinking "if I could simply have a library function do that for me".
 
user14697742
type "from future import braces" and save it as a python file
 
user14697742
when we run it, it gives a clever error
 
user14697742
I don't know why it showing future as bold
 
user14697742
11:21 AM
actually it should be surrounded by double underscores
 
@python_user Oops. See it as having made a lasting impression. ;)
@Wli The halting problem basically means you cannot generally say whether and how a function stops ("halts"). So there is no way to say how much progress there is in general, because you cannot know the target.
 
11:45 AM
@aneroid 1. don't post low-quality posts for the sake of posting them. You can post a if applicable, or just vote on it yourself and ignore it. There's plenty of low-quality posts on the front page and we don't have to see them. 2. what Aran said about edits. Teach OP to edit their post instead.
@Wli you can read our rules to see what's OK
 
@MisterMiyagi In practice. In theory there is a maximal number of steps until which the program can run and then it reached the number after which each program with so many states is guaranteed to loop. So it unsolvable in practice but no theoretically
 
"Since an endlessly looping program producing infinite output is easily conceived, such programs are excluded from the game." – Gotta love computer science. "We can solve the halting problem if we require halting." Well, d'oh!
 
And since the real world doesn't include infinite computers the halting problem is solvable. I don't know why everybody keeps saying it isn't. At least in a sensible formulation of the problem it is.
 
@MisterMiyagi sounds like physicists
 
Wli
As I said in the post: this "decorator" should be used wisely by the user and match specific cases. This would make little sense in a yielding function...
But thanks for participating in the discussion, I learned and I will see how I'll start the project
 
11:58 AM
Let's reduce all programs to a harmonic oscillator. Now all programs are trivial,
 
Wli
Well you know the joke of the hen which doesn't lay eggs
 
@Hakaishin The real world has things like I/O. Unless you switch off a computer, a program can process an arbitrarily long stream of commands.
It doesn't have to contain all those commands up-front.
@AndrasDeak I like to think of Taylor series as formalised procrastination. Let someone else solve the rest of the problem if they desperately need it.
 
@MisterMiyagi hmmm that explains :P
 
@Aran-Fey wasn't closed when i posted about approving the edit. but i understand not beautifying ugly closed posts
 
@MisterMiyagi all approximations are good if you don't check convergence
 
12:06 PM
@AndrasDeak Approximately all approximations converge. Give or take 2.
 
"don't post low-quality posts for the sake of posting them." - i don't even understand what the means. questions "seemed" reasonable except for the super bad code formatting (and wasn't closed at the time, iirc).
but sure, i get it - don't beautify ugly posts.
side-note: if a user with "edit without approval needed" privileges approves an edit, it should just get approved. don't know why 3 ppl needed
 
on a more python related note. My source bin/activate doesn't activate my env
it activates my other ros env, which seems very weird
 
ros seems very weird. Impressively meta, but weird.
 
does activate go trough bashrc? Looking at the file it doesn't but I found that when I remove my source ros line it activates correctly
I wonder why that is, because I would like to keep the source ros line in my bashrc
I hated ros1, swore to not use it again. Now I hoped ros2 would be better but there seems to be only little bettering
 
@AndrasDeak oh, you're probably talking about the post before that wrt the "assignment". ok, got it
 
12:16 PM
@aneroid yup. Directed reply.
 
12:38 PM
Hi can anyone help me in implementing server side session using Flask-Session. Can we make Flask-Login extension to use Flask-Session?
 
1:10 PM
@Srikanth please don't ask for help here with fresh questions on the main site as per our rules
 
1:43 PM
It is strange how hard it is for me to implement genetic algorithm for an optimization problem in Python.
 
Aren't there libraries that can do that?
 
Maybe, but I don't know how to use them
 
I'd start looking in scipy.optimize
 
Okay. I try to learn that.
 
morning cabbages, folks!
 
1:58 PM
I was thinking the problem in math.stackexchange.com/questions/4021958/… It looks like it is hard to formalize the problem to the form that optimization algorithms works.
 
yes, that sounds more like a linear programming problem
more operations research than analysis
Specifically, integer coefficients mean typical optimization schemes are useless
 
Okay. I'm not familiar with such algorithms.
 
Me neither. Wikipedia says it is hard.
 
Um, can someone translate this to english for me?
> Deprecated since version 3.8: If any awaitable in aws is a coroutine, it is automatically scheduled as a Task. Passing coroutines objects to wait() directly is deprecated as it leads to confusing behavior.
Does that mean the whole asyncio.wait function is deprecated or what?
 
2:23 PM
passing bare coroutines is deprecated.
since wait always returns tasks, not the underlying coroutine.
Because if you have a nice abstraction, might as well plaster it everywhere over your API.
 
I see, thanks
So the easiest way to execute a bunch of coroutines simultaneously is gather(*(foo() for foo in bar)) then? That's... ugly
 
2:44 PM
I don't think any concurrency frameworks have a simpler way to do this.
At least gather returns even more fun than it takes...
 
 
1 hour later…
3:59 PM
@Tentacel hello. Please don't ask for help here with fresh questions on the main site as per our rules.
 
sorry
 
no worries :)
Your question is tagged properly so it should see enough attention on the main site. If it doesn't in two days you're welcome to ask here too.
 
I shouldn't reward rule violations, but... yes, pickle compresses ints. Depending on the value, they can take either 1, 2, or 4 bytes (or more, if they're huge)
 
Hello!
 
@Aran-Fey you can leave that as a comment on the question. The point is not to fragment information.
@Codemonkey51 hello
 
4:09 PM
I can't comment though :D
 
that's quite a pickle
 
:|
 
@JaakkoSeppälä ok I'm actually nerdsniped now. Hit me up when you're around next so I can ask you about how to properly understand the problem
 
4:33 PM
When writing an async higher-order function, what's the best way to support both regular functions as well as async functions as input? Is there a recommended design for this or does it vary on a case-by-case basis?
I'm thinking of checking if the returned value is awaitable, and then automatically awaiting it
 
@Aran-Fey I use a helper for that. But yeah, it basically peeks at the return value.
 
Ooh, that's quite different from checking the return value. I have plenty of functions that won't work with that iscoroutinefunction check
 
that check is just the fast path. The magic is the wrapper applied to non-coroutines.
 
4:51 PM
But not every function that returns something awaitable has been defined with async def. For example, something like def call(func, *args, **kwargs): return func(*args, **kwargs) can be async or not, depending on what kind of function func is
 
Did you check the Awaitify class right below?
A coroutine is always async, so there is nothing to do. In any other case, the callable is wrapped – on the first call, if the result is awaitable it is subsequently used bare; otherwise it is subsequently used with an async def wrapper.
 
Oh, I see that if isinstance(value, Awaitable): in there. I don't understand the rest of it though :D
that wrapper has a lot of layers ._.
 
I should probably benchmark it before making it public :/
Never thought it would be generally useful, TBH.
 
All that caching makes it really hard to read
 
5:03 PM
Oh, that's a nice lightweight website. I need to remember that one. Shame that test.at went down, it used to be nothing but the text "Whatever you're testing, it's working"
 
Perhaps there's a cached version of that...
Anyways... I blame async
 
^Advice may be invalid due to caching
 
wow... I've only just noticed that if you less some.pdf - it must be piping it through something as it gives a text-only version of it for the document I'm looking at... that's fairly nifty
now I'm wondering if something like sublime text can do that...
 
 
1 hour later…
6:37 PM
@JonClements No, not as an installable package, but you should be able to re-implement that feature of lesspipe.sh as a Python plugin.
 
Boo! less 487 (POSIX regular expressions) on my Mac doesn't have this magic.
 
ahh... was just going through installable packages - but yeah... something to bear in mind... thanks @MattDMo
@holdenweb ?
 
That's what I get for not unsing a GNU-based system.
 
@holdenweb you can install many of the GNU tools using MacPorts or Homebrew.
 
Yeah, I know, but normally I just open something.pdf and it comes up in Preview as a PDF. Since I haven't worked with PDFs in a text-only environment this has never been a feature I've sought.
 
6:46 PM
me either, actually. I was vaguely aware that such tools existed, but I don't think I've ever used them.
 
I only actually noticed it as I was planning to do some PDF extraction stuff as it looked like reasonable table stuff so thought there's libraries I can use for that... one sec...
 
7:02 PM
and github.com/jsvine/pdfplumber is just amazing for extracting tabular data (as long as it doesn't need OCR'ing) - it's a pain to export pages as images and then tessaract them
on a side note - I think youtu.be/cVuKwhOAn-A?t=101 will appeal to your sense of humour sense... (it does mine anyway :p)
 
7:46 PM
@MisterMiyagi That's why Room 6 pays you generously for keeping your finger on the pulse
 
8:06 PM
@roganjosh I also know how to make a pretty decent tarte flambée.
 
> which is covered with fromage blanc or crème fraîche, thinly sliced onions and lardons
that's a lot of French for something in Baden-Württemberg
Sounds good, I think I know the dish, or something close.
 
well, let's be honest, it's basically pizza with sour cream instead of tomatoes.
 
Don't undersell yourself. Cooking with MisterMiyagi has legs as a TV show (I bet you could really get a mean steak going with the LHC)
 
@MisterMiyagi it took us a long time to find a decent pizza recipe
 
toppings or dough?
 
8:19 PM
I've just had a little chuckle to myself. All this talk of async brings a whole new meaning to "here's one I made earlier" in your cooking show :P
 
@MisterMiyagi dough
One can be creative with toppings.
 
we've settled for homegrown sourdough these days.
 
way overkill for pizza :P
but I appreciate your devotion
 
sadly, it means we have to make at least one pizza per week... :D
 
@MisterMiyagi poor thing
 
8:23 PM
@roganjosh Backenblochen with MM, every Friday 12PM. Right before the Stackenblochen.
 
Love it. It's about time daytime TV got spruced up and I think this is the answer!
 
After all baking is pretty async. You shove it in the oven and prepare the other course.
 
@roganjosh "here's one I made earlier" - surely it can be "made here's earlier I one? :p
 
Ah, he already made that connection. Oh well :P
 
@JonClements get your callbacks in order, Sir!
 
8:36 PM
will do! the local area appears to be quite efficient of getting "jabs" deploying, so been invited to have mine next Tuesday - how cool is that?
 
Neat. Do you know which kind?
 
nope... presumably the AZ one
hardly going to be picky and choosy about it
 
yeah :)
 
we need to get to a position where I can with legal travel thrash @roganjosh's rear at pool :p
 
You should never be allowed to travel under false pretences.
 
8:45 PM
lol - challenge is on mate
 
But hey, people can have dreams, I guess!
 
unless of course, Bill Gates is controlling my mind at my point or something :p
 
.... already the excuses come out. "The microchip made me make that foul"
 
:P
 
8:57 PM
@rogan was listening to the radio last night, and I'm surely a lovely concerned mum, was talking about how she's not anti-vac, but went on to say, she didn't want it, because she wants to make her own mind up about it and wanted to do her own research or something
 
Eh, I've had to tune out of all this kinda stuff @JonClements. Got too much to focus on at the moment to be bothering what public opinion is - I grow tired of it :/
 
@roganjosh ditto.. but without the luxury of just being able to ignore it, this puppy still has to deal with things being it death or hardship etc...
 
9:15 PM
I don't think it's particularly helpful to listen to the babble, though. I've moved to my grandma's house as of yesterday because my sister usually looks after her (lives much closer, and in her "bubble") but she had a chunk taken out of her jaw yesterday for Wisdom teeth removal, and my grandma doesn't really know who I am anymore. At this point, I don't care about Joe Public's spouting; things have to be practical. It's a blessing that my grandma had her first jab, to give me some confidence
Turns out I'm a dab-hand at pulping some cooked salmon, though, if MM wants any tips :P
 

« first day (3784 days earlier)      last day (1147 days later) »