« first day (4113 days earlier)      last day (820 days later) » 

2:59 AM
hello guys, I have to make two api calls, the second call has to be made "x" seconds after the first call or it will fail, what is the bets design here? should I sleep before I call the second api or should I sleep in the function that calls the api?
so this
def first_api():pass

def second_api():requests.post()

def main():
    first_api()
    sleep(x)
    second_api()
or this
def first_api(): pass

def second_api():sleep(x);requests.post()

def main():
    first_api()
    second_api()
first_api and second_api is run on parallel, and second_api will only be called if first_api is a 200
 
 
1 hour later…
4:04 AM
@PaulMcG You reminded me of 6 degrees of Kevin Bacon. oracleofbacon.org/movielinks.php That site goes back to 1999. IIRC, it used to have a few more features, but back in the old days it scraped data from IMDB, now it uses Wikipedia.
@Jake Does it have to wait at least x seconds? Note that sleep(x) isn't guaranteed to wait exactly x seconds, it can wait longer if the system's busy, but it shouldn't wait less than x seconds (unless it gets an interrupt).
But to answer your question, there shouldn't be much difference in the behaviour of your two versions. IMHO, your 1st version is preferable because it makes the sleep more explicit, rather than hiding it inside the api call.
 
4:56 AM
@Jake Why in parallel? They can/should never actually run concurrently.
 
5:48 AM
@PM2Ring once I make the first api call, the server has to wait for x seconds before it can entertain the second call, if I do it without waiting the second api would cause the server to error out (404) as the first call is not yet fully processed
@PaulMcG I meant, 'n' parallel calls to first_api followed by (after completion) the same 'n' parallel calls to second_api, not that first and second are in parallel
ok I will go for first version then as PM 2Ring suggests, thanks guys
 
6:39 AM
@PM2Ring I think they fixed the interrupt thing in 3.4 or such. All functions susceptible to interrupt now just resume on interrupt until they are done.
 
 
1 hour later…
7:51 AM
Can someone explain to me why I have to call __init__ here? Is it just super being weird?
class my_super(super):
    def __new__(cls, type_, instance_or_cls):
        print(cls, type_, instance_or_cls)
        # If this is a super(cls1, cls2) situation, return a normal super object
        if not isinstance(instance_or_cls, type_):
            cls = super

        # I don't know why, but we have to call __init__ manually
        self = super.__new__(cls, type_, instance_or_cls)
        super.__init__(self, type_, instance_or_cls)
        return self

s = my_super(int, bool)
print(s)
 
8:08 AM
Oh wow, calling super() apparently calls super.__new__() with 0 arguments and then only inserts the 2 implicit arguments into the call to super.__init__. So I'll have to scrap my __new__ method
 
Wondering how that works when super is called with explicit arguments.
 
__new__ probably has 2 optional parameters that it just silently ignores, so it can be called with either 2 or 0 arguments
>>> super.__new__(super, int, bool)
<super: <class 'NULL'>, NULL>
>>> super.__new__(super, int)
<super: <class 'NULL'>, NULL>
>>> super.__new__(super)
<super: <class 'NULL'>, NULL>
 
8:33 AM
Wow, I just spent an hour losing my mind over a recursionerror just because I was accessing super.__self_class__ instead of super.__thisclass__
 
you should design a pattern to fix that :P
 
 
2 hours later…
10:38 AM
@DevilIshere you guessed wrong. But you need not guess: read our rules here
 
11:00 AM
db: Session = get_db()
print(type(db))
post = db.query(models.Post).all()

AttributeError: 'generator' object has no attribute 'query'

using fast api with sqlalchemy to query postgres
 
What's get_db?
Are you aware that : Session is a type hint, not a cast of the object's type?
 
using this tutorial , did everything exaclty
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
been stuck for a week now , exhausted every stackoverflow for this
I seriously need to move forward
 
It's really hard to text-search a screenshot of a video, but at a glance I see none of your code in there.
 
@MisterMiyagi im new to python what is type hint
 
@LumbusterTick This looks like a context manager. Check whether there's a line like @contextmanager in front of the function in the tutorial.
@LumbusterTick No.
 
11:06 AM
ok wait
no there is not
 
Well, then I recommend to use a different tutorial.
 
from 5:07:54 I have rewinded so many times
@mi
 
Preferrably one that uses text...
 
@MisterMiyagi I humbky request that If it can be fixed
plz do help
im 5 hours in
 
You probably need this one: docs.python.org/3/library/…
 
11:08 AM
there were other mistakes also but I fixed them prioir to the 5th hour
 
But I'm surely not going to watch 5 hours of tutorial now...
 
I bel this is an sqlalchemy orm error
@MisterMiyagi you dont have to I have timestamped
 
No. This is a "bad tutorial using a bad medium" error.
 
just go ten minutes back lol no no im joking thanks
ill have to give it few more tries but htanks
do u suggest any ??
 
 
2 hours later…
12:43 PM
Half-baked idea: source-controlled todo list.
 
Sounds like a fully baked idea.
 
1:01 PM
n1
 
You can put a thing on your list, and check it in, and then do the thing and take it off your list, and check it in, and later you can look at the file history to see when you did the thing
 
2:00 PM
what about using task boards for that instead. stuff like jira and so on. (or preferrably something better than jira. something makes me think that's not a very high bar)
 
On the topic of software tools starting with J, the other day I discovered that "Jinja" is, in fact, not a made up word but rather a kind of Shinto shrine
 
2:16 PM
@ParitoshSingh what's with the hate against jira? Youtube is bombarding me with jiras firing sketch ad, and other anti jira ads. I feel like they are wasting their resources. I love jira and it works very well for me/us
 
2:29 PM
Jira is slow
 
I find jira is an unintuitive UI, terrible jank, sluggish, their search bar is the worst thing in all my existence, and i detest what it pretends to be good at, but is so convoluted it fails to do.
....to rephrase, if it works well for you, im happy for you.
 
it is kinda slow, but not terribly slow. Also the search for me works very well. Tbf we have around 30-50 issues so it might be a scale problem
 
It is terribly slow.
 
for me, the search works if and only if i type the prefix of our project before trying to type a number. if, heaven forbid, someone tries to search issues by typing a number, the search bar may lead you to believe your ticket never existed.
And if i dont know a number and try to find something...sigh.
For the sluggishness, it's possible theres more than just jira leading up to it, since i have to access via a VM, but our project is fairly large, and it's just miserable trying to move anything on jira.
 
Also I find it amazing how the Jira app refuses to show you the task description once you lost internet connection. Your internet disconnected after you loaded your task? Too bad, enjoy this "no connection" screen
Hatred is completely justified and it is not hated enough
 
2:33 PM
There is an app, in a phone app?
I always use it in the browser
 
yes
there's an app with surprisingly good ratings
 
ah that would explain. Apps suck :D
 
browser here.
 
hmm, how large is large? I assume larger than 2 people working on the project large :D
 
we've roughly got about 30ish people, and velocity of about 180 tickets per sprint
and we're on sprint 17...
I've given jira enough chances to impress me. I like the concept of it, i really do.
But i dislike the execution, a lot.
Having said that though, we use it, other teams use it. it has some things right. Anyways, I shall step off the soapbox now, thanks for getting me on there :P
 
2:40 PM
@Kevin This is actually a fully-fleshed-out implementation in git?
For the tooling repo I maintain, everything but the most urgent/minor issue (oh poop, I just pushed a typo when addressing #123) gets an issue raised, then gets assigned against a milestone, then gets closed with a commit at some point. Or have I misunderstood your suggestion?
 
I guess it depends on whether your isssues themselves are in source control
 
Well then you just raise an issue that you need to start using git issues to track tasks, then establish a milestone. Job done :P
Although for the platform we work on, there are just so many hundreds of issues that I guess JIRA is the only way for people to handle them. Also, it doesn't translate well to multiple repos and letting you know what needs doing where at any one time
And that's why I only pretend to be in a software engineering-y role. I don't want hundreds of issues a day to plough through
 
3:00 PM
@AndrasDeak pyyaml does have a 'safe_load' method which should resolve that problem
 
@ParitoshSingh *cries in redmine+2gitlabs+github+custom-ticket-system*
 
Cbg everyone, I'm trying to import a markdown document into Documize using this API endpoint but the documentation is not clear. What does 'send binary file with form-data key of "attachment" mean ? I've been trying to format the request using this but it doens't work.
 
3:17 PM
@IvoMerchiers noted, thanks
 
@DelriusEuphoria cbg. New name.
 
New name, so new me
When I make an executable with pyinstaller it makes a folder for all the libraries installed within the python environment, so will using a virtual env make sure that only those libraries within virtual env will be bundled? If that is the case then I will have to find a way on how to make that virtual env identifiable for pyinstaller
or will pyinstaller use the environment on which it is installed..? Interesting
 
Pretty sure it figures out which modules you actually need (i.e. import) and only includes those
 
For sure I don't use PyQt or anything but here I have a dll for all those
 
3:33 PM
I don't know how pyinstaller interacts with venvs, but if you run it as python -m PyInstaller then it doesn't really have much of a choice
 
Hmmmm yea, maybe I need to run it from within another env
Something as said here
 
Hmmmm, I wonder if there's a way to make the -m switch case-insensitive... I always get PyInstaller and IPython wrong
 
@Aran-Fey But that make sense, because IIRC tkcalender used babel and it wasn't specifically imported inside the users py and it wasn't bundled and the executable wouldn't run. So we had to explicitly import it or add a --hidden-import flag for babel.
 
4:04 PM
medium.com/geekculture/… I wonder if this is the same guy which was obnoxiously asking questions here a few months ago. Probably not, since the article is well written. What an interesting story
 
It is the same guy, he posted a link to the article a few days ago. It was on the starboard, but I can't find it now
 
I hope that was sarcasm though
 
Jan 13 at 19:08, by Kwsswart
Decided to write my first post on medium about the transition from chef to full-stack developer ^^ https://kieron-spearing.medium.com/how-i-went-from-professional-chef-to-a-self-taught-full-stack-developer-in-one-year-my-story-168b4e339189 would love some critic
 
4:35 PM
@Hakaishin let's not, please
 
 
2 hours later…
6:42 PM
can someone direct me to R language chatroom if any available?
 
There's chat.stackoverflow.com/rooms/106/r but it seems to be frozen due to inactivity
 
yeah just saw that. Any other ?
 
Not that I know of.
Completely unrelatedly and directed towards nobody in particular, I would like to point out that "I can't find anywhere else to ask" is not a valid justification for asking R questions here in the Python room
 
May 23 '16 at 19:32, by Kevin
> A policeman sees a drunk man searching for something under a streetlight and asks what the drunk has lost. He says he lost his keys and they both look under the streetlight together. After a few minutes the policeman asks if he is sure he lost them here, and the drunk replies, no, and that he lost them in the park. The policeman asks why he is searching here, and the drunk replies, "this is where the light is."
 
@Kevin I didn't asked any question. I just asked for help..
 
6:53 PM
Ah, chat.stackoverflow.com/rooms/25312/r-public looks a little more active. Maybe I'll brush the cobwebs off my R interpreter, which I last used in college
 
@Huzaifa and he explicitly said he wasn't talking to or about you
 
Hehe :-) I don't want to make anybody mad.
 
7:20 PM
I have to discuss this with my manager tomorrow about my new role. Currently I've been able to hold the "oh, it's in R? Lol, nope" line but I'm not sure I can continue that
 
7:51 PM
@Huzaifa Fell right into the trap :P
@Kevin 15 days of inactivity freezes a room? No wonder why some chat rooms have bots to message frequently
 
So it seems
 
@DelriusEuphoria 14
 
Even number, perfect :)
 
 
3 hours later…
11:15 PM
Hi people, I want to choose random picture from file and after that to show that picture but instead of pic I get that 1.png don't exist. Or 2.png. First part of code works but another with show doesn't. I tried to add A:\myfile before the random_filename but still get error No such file or directory. Do you have some advice for me? This is code pastebin.com/KddgC3rc
 
Throw os.path in the garbage bin and use pathlib, problem solved
4
 
@Aran-Fey Oops, I have been using it for a while, what's the disadvantage?
 
Things like ^ that, where you get only a file name returned and need to manually merge it with the path to the folder. pathlib gives you a proper path instead of just the file name
 
don't forget the cutest of APIs with root / dirname / filename
 
Plus, using classes should be a no-brainer in an OOP language. Why treat paths as strings when you can treat them as paths instead?
 
11:22 PM
If it's good enough for heapq it's good enough for me :P
 
OK, I will try with pathlib.
 
It's a bit shocking bad people are at OOP. I never imagined so many people would fail at the very first step, which is using OOP. Took us 'til the 21st century to figure out that creating a class for file paths would be a good idea. Sockets still haven't caught on that there are actually like 3 different kinds of sockets. But at least someone recently had a stroke of genius by teaching sockets the concept of a message
Wow, I need stop accidentally words
 
@Aran-Fey Aran I'm just trying to feed my family. I have health problems and I can't do other jobs. I know I'm not smart but to be honest I'm just trying to survive with my family. I just fell into that life and I can't get out. You have helped me many times and I sincerely appreciate that. I know every time you think I’m very stupid and that’s what I think as I cry and write this. Sorry once again.
 
Oh, it wasn't a rant about you. It's a rant about the state of the programming world as a whole
 
11:41 PM
I know. I'm sorry. I'm a little more emotional.
 
@Pijes hang in there, you can do it
 
@AndrasDeak Thank you man. I always need a lot of time, but in the end I find a solution.
 

« first day (4113 days earlier)      last day (820 days later) »