« first day (3121 days earlier)      last day (1818 days later) » 

6:00 PM
I worry that you are under the impression that 2 and 2.0 and 2.00000000 are all distinct floating point values. They aren't. 2.0 and 2.000000000 are the same value. And 2 isn't a float at all.
 
ItM
Oh I'm well aware
 
btw... what's better if hasattr(c, 'is_integer') or if isinstance(c, float)?
 
The answer to "why does 4/2 return 2.0 and not 2?" is "because they wanted division to consistently return a float in all situations". The answer to "why does 4/2 return 2.0 and not 2.0000000?" is "it returns both of them, kind of"
 
It returns 2.0 instead of 2.00000000 because 2.0 is as precise as it needs to be.
 
I'd vote for hasattr as it will handle any class that has a is_integer method.
 
6:04 PM
@biggi_ I worry that I have not conveyed my point well. 2.00000000 has exactly as much precision as 2.0 because they are exactly the same value.
 
Oh I'm agreeing
Not trying to fight :)
 
and I'm going to get lunch... rbrb
 
If you're saying "print(4/2) displays only one zero after the decimal point and not ten because you only need one to precisely represent the number", I agree. In fact I think ItM is primarily annoyed because you don't even need one zero. Zero zeroes would suffice.
 
Right, but no zeroes wouldn't be a float, which is the typical output of a divide statement. So to make it a float, they print 2.0
 
So it should be 2.
 
6:07 PM
It makes sense to me, but I'm also a sparkey that gets thrown into super weird programming situations
i.e. right now trying to parse a generator object with output x:y, x1:y1, x2:y2 into a somewhat usable format for data manipulation :)
 
Certainly it's not unreasonable for Python's number-to-string formatter to make sure you can deduce the type of the number by looking at its string representation.
 
Is this person using python 2 or 3?
seems like they're using 3
 
ItM
Thanks for the discussion all. So my original issue is how do I print the value as a string where if it ends in .0 I just print it without? That's where this all started... But I understand the compromises needed here
 
If you do print(4//2) it will just pring 2.
 
Must be 3, because 4/2 in 2.7 isn't a float
 
ItM
6:09 PM
it's 3
 
Just do 4//2 instead of 4/2 (4//2 is classic/floor division and 4/2 is true division)
 
ItM
But I want 4/10 to be printed as 0.4
but 4/2 to be 2
aaahhhh
:)
 
use an is_integer check
 
^
 
>>> f'{2.1:g}'
'2.1'
>>> f'{2.0:g}'
'2'
 
6:11 PM
thats a clean way to do it
 
bjg
I posted a python question yesterday which got marked as a duplicate but the duplicate doesn't answer my question...I edited my post to clarify why the duplicate doesn't work but it remains in duplicate status...is there anything I can do to get it addressed?
 
are you sure the dupe doesnt give you a "good enough" answer to mold to your use case either?
 
Yeah, {:g} seems appropriate here. The docs say "insignificant trailing zeros are removed from the significand, and the decimal point is also removed if there are no remaining digits following it." which seems to be exactly what we want
 
ItM
OMG that's it!
 
@bjg Perhaps. What's the question?
 
ItM
6:12 PM
Funny cause they know the zeros are "insignificant"
 
bjg
@ParitoshSingh It is related but there is a key point that I'm not able to figure out from the duplicate or related post
 
his question is this
 
I thought there was a formatting option like that but I had to spend 20 minutes yelling about terminology before I could look up a reference
 
and he didn't link it, so there :P
 
bjg
@ItM This is my question but it's getting redirected to the duplicate I think. Are you able to see my original post? stackoverflow.com/questions/55955280/…
 
6:13 PM
Yeah, we can see it.
 
@bjg you can ping Wen if you think the dupe doesn't apply. The @ won't auto-complete but (i think) they get pinged
 
bjg
ok great
 
Looks like someone voted to reopen already :-)
 
bjg
so did he get pinged when I edited the post to clarify what I'm still confused on or do i need to do something else to ping him?
 
i wonder who that someone is, Kevin.
 
bjg
6:15 PM
@Kevin oh ok, was that vote because of my edit?
 
ItM
Thanks all! @vaultah you win this Friday! @Kevin thanks for the terminology talks, I learned smth :)
 
bjg
oh
 
lol nah, kevin opened it for ya.
 
bjg
you reopened it
thanks!
appreciate it
hopefully it will help someone else also...some of this pandas stuff is confusing (albeit powerful)
 
@bjg no, editing will not ping them
 
bjg
6:17 PM
@roganjosh ok, good to know
 
Generally if an OP can articulate in complete sentences why they think their question is suitably unique, that's enough evidence for me to vote
... Even if it turns out later that they're wrong and it isn't unique. I'm not infallible at fact-checking claims involving third party libs. Oh well!
 
dw, checks out that the dupe target didn't give a count.
 
bjg
@Kevin yeah I thought the duplicate would get me in the right direction but couldn't figure out how to get the solution I requested
 
@bjg Unfortunately, close voters don't get pinged by edits. However, the 1st edit after a question goes on hold does send the question to the reopen review queue. But the reviewers may not understand why your question deserves to be reopened.
 
bjg
appreciate all of your help!
@PM2Ring I see. I added a couple sentences at the end to clarify why my post is different than the others I could find. Hopefully the pandas experts will agree.
 
6:21 PM
The reviewers may not understand Pandas. Or Python... but hopefully reviewers who don't have the required knowledge will skip that question, rather than making a decision on it.
Also, it takes 5 reviewers to reopen a question, unless they have a relevant tag badge.
 
bjg
@PM2Ring the user that marked as duplicate appeared to be a pandas expert
ok
 
@bjg Yes, they are. But I guess he didn't read the fine details of your question. And hopefully now that your question is more explicit it will get an answer. Or at least a dupe that actually helps you. ;)
 
bjg
@PM2Ring fingers crossed
 
If you get really familiar with a tag, you reach a point where you don't even need to finish reading the question before you're 90% sure it's a dupe
This works great except for the 10% of the time that you're wrong
 
bjg
@Kevin yeah the duplicate was related but couldn't use the info to figure out that last detail that I need
 
6:25 PM
@PM2Ring in this case, Wen does understand pandas
 
@bjg I don't know Pandas, but your question looks fine to me. BTW, dupe questions aren't closed because they're intrinsically bad. It's just that we don't want dupe answers scattered all over the place.
 
Im on a phone and only half-attentive so not sure whether the dupe tag was appropriate after the edit, but it will have been closed on good faith and not needlessly
 
bjg
@PM2Ring yeah, makes sense
@roganjosh yeah I know it was in good faith
 
@roganjosh Oh, I'm sure it was in good faith. He just missed an important fine detail. And it might have been harder to notice in the original version of the question, I didn't check.
 
bjg
@PM2Ring my updates to the post start with "I have seen a number of solutions.."
 
6:31 PM
"I tried some other solutions and they didn't work" is alright, but "I tried the solutions at [url] and they produced the output [whatever] instead of the output I expected, [also whatever]" is better
 
bjg
@Kevin -makes sense, I could edit again to show exactly what some of the related posts gave. do you recommend putting the links to the other posts in my post or just showing the code I've tried?
 
@bjg Ok. The original stated what you're trying to do, but the additional stuff makes it much clearer.
 
bjg
@PM2Ring ok, good
 
links help show that you've done your research, and can also indicate why certain dupes dont exactly fit.
always useful to have links where appropriate
 
Providing links is usually good since it makes dupe-voters think twice about hammering using a url that you explicitly said doesn't fit your problem
 
6:35 PM
aside.. this is making me want to pull my hair out or just do this in pure lists already. pandas is just not intuitive to me sometimes :(
 
bjg
@ParitoshSingh ok, I can add the "dupe" link and what I get for output from a couple of the suggestions
 
Not a foolproof defense since they might just think "... yeahhhh I'm pretty sure you just didn't read carefully enough" and vote to close anyway
 
@bjg Yeah, definitely add the link to the dupe that your question got closed with, and explain why it doesn't help. The link to that question is still in the Linked sidebar.
 
bjg
@PM2Ring thanks was just looking for that link in my history...
 
An unfortunate but amusing mis-spelling: physics.stackexchange.com/questions/477560/…
 
6:45 PM
@bjg Your question does seem like a dup. I can't see which one was previously linked or why that didn't fit, but seems you just need to sort the values, then groupby that.

newdf = pd.DataFrame(np.sort(df_graph[['From', 'To']].to_numpy(), axis=1),
                     index=df_graph.index,
                     columns=['From', 'To']).assign(Count=df_graph.Count)

newdf.groupby(['From', 'To']).Count.sum().reset_index()
 
bjg
@ALollz Awesome, that seems to work! Admittedly I've programmed in other languages much more than in Python so these commands aren't obvious to me. Should we add this as the solution?
 
@ALollz So you should post that as an answer. Or propose a better dupe target.
 
The first dupe target was stackoverflow.com/questions/51182228/… FWIW
 
Yeah, there's a dupe target somewhere, just trying to look for it. A lot of times this gets solved with some apply(sorted, axis=1) or apply(frozenset, axis=1) which terribly slow compared to just re-creating the df.
 
@ALollz you can see the previous dupe, just look at the edit history
 
6:55 PM
Thanks, did not realize that! There are several questions asking to "group regardless or order within columns, then sum another column", which I think would be the right target. They're just painful to find.
 
bjg
@ALollz another solution was also posted by Paritosh which also works
 
recbg
 
@bjg I'm closing it as a dup
 
bjg
@piRSquared just curious what is the dup?
 
thx @Kevin for the target
@bjg it's attached to your post
@bjg I changed my mind
 
bjg
7:04 PM
@piRSquared but this link stackoverflow.com/questions/51182228/… doesn't handle the count properly
 
it's different
 
bjg
ok
cool
I mean I'm good either way now but since I couldn't figure out count maybe it'll help someone else in similar situation?
 
@roganjosh Even easier: look in the Linked sidebar. Dupe targets, and any links in question, answers, or comments go there.
 
But it's a hodgepodge there?
 
bjg
7:13 PM
@ALollz This question does appear to be a duplicate of my question
 
Unless I'm missing something you're going to enlighten me on? :) is there a way to differentiate what is posted and a previous dupe?
 
@roganjosh It can get that way, but currently there's just the 1 link
 
Ah, ok, I can't see that on mobile
 
@bjg Are you happy enough with that one?
@roganjosh I'm also on my phone. You need to go to full site mode, as I mentioned some months ago.
 
bjg
@PM2Ring the question appears to be the same...haven't tried those solutions yet...the solution ALollz posted above (in chat) and the one posted my question work though...
 
7:18 PM
 
Thanks! And yeah my other solution there where I just assign the columns back is probably a bit neater than re-creating the DataFrame with all of those chains and assignments.
 
@bjg Well test those answers & let us know. piRsquared just posted a fresh answer there.
 
@PM2Ring sure, you did, but I'm not sure this distinction was noteworthy since it still wouldn't distinguish the link as a dupe vs any other question tagged in the post
Or, if it does, I've missed the meta-data on it
 
@roganjosh That's true, it doesn't differentiate dupe targets from other links.
 
bjg
@PM2Ring just checked piRrsquared's solution and it also works for me
 
7:30 PM
ummm... just making a quick change to some code I did (it needed it be done in a few hours - so it's hardly great... but works well...)... I just wish I knew what the heck I was even trying to do with the property in this django jobby:
class Images(models.Model):
    workbook = models.FileField(upload_to='uploads/%Y/%m/%d/')

    @property
    def ARCHIVE_DIR(self):
        return os.path.join(settings.BASE_DIR, 'archive', str(self.pk))
I'm guessing it was some idea at some point and I just dropped it, else, in the code it'd have come settings.ARCHIVE_DIR or something... but weird...
 
happened again today.
I tried to upvote my own answer.
 
@bjg Great. In that case, I'm re-hammering.
 
bjg
I have to run but if you guys think my question stackoverflow.com/questions/55955280/… should be marked as a duplicate of stackoverflow.com/questions/54737348/… , that's fine with me. I'm not sure whether the exact solutions to my post are in the "duplicate" though and we haven't captured ALollz solution posted above (in chat)
In my last sentence I just mean the code that has been posted as a solution here: stackoverflow.com/questions/55955280/… and by ALollz might not live on if it's marked as a duplicate...let me know if I should do something to remedy that (come Monday...since I have to shift gears now)
 
@bjg Allolz has an answer on the new dupe target
 
oh... and hadn't updated ST3 for so long... the new git features are really quite sweet
 
7:36 PM
@bjg No worries. Take care.
 
sublime-merge is a bit of getting use to... but reasonably okay
 
@AnttiHaapala What's worse is when you go to downvote your own answer. :D
 
bjg
@PM2Ring yeah ALollz post in dupe seems similar but a little different than above...I'm happy to revisit on Monday...I leave it to you all on making the call on whether to mark mine as a duplicate...I'm fine either way
 
nope...
 
@JonClements happened to you often?
 
7:41 PM
oh wow... managed to completely overwrite my previous message with a reply... good job me...
I wonder what this one is really trying to do...
 
A few weeks ago I was looking up something on SO & started reading a useful looking answer that seemed familiar, but it had a few things that weren't quite accurate. I was about to comment when I noticed it was one of my own answers. :facepalm: So I edited it. :)
 
@JonClements It's a bit odd. "I don't want to open more ports than I need to, so I'll just broadcast stuff across the entire LAN"...
 
that's certainly one way of doing it
 
@PM2Ring yeah... it's weird... I get the feeling they're not tell what they're really trying to do and why... but... made my ears perk up a little bit anyway
 
8:03 PM
It's clear the OP on that question doesn't understand either ports or security
 
A perfect recipe for chaos.
 
Indeed.
 
they'll be able to write their own absolute perfect encryption algorithm soon though :p
I remember WAP use to be so easy to break...
just switch your computer's network interface into scan mode, record traffic, then eventually, you'd get the access key
WEP2 is a lot harder, but it's still possible
 
I'm not happy with this situation (prepare to read about said situation)... OP puts obvious pandas dup but tags it as sql and pandas. It's likely a sql dup as well but together, they make a "new" question? stackoverflow.com/q/55976265/2336654
 
Yup... and they keep advancing the tool I used to play with in the grey hat days: aircrack-ng.org
 
8:17 PM
Unbelievable, I couldn't find a dup for something as simple as df.groupby(['col1', 'col2']).mean()
 
my guess is those get hammered down with the canonical df.groupby(['col1', 'col2']).sum()?
 
can you find that one? I'll use it here
 
Thx. hammered. I think if you use disparate tags that should increase dup exposure, not limit it
 
@cs95 umm... stackoverflow.com/questions/19384532/… - I think that didn't need protection... would you mind removing it?
(can't see anything on the timeline that'd require that at all)
 
8:30 PM
@JonClements Sure, I can, but... does it matter? To be honest, I've protected a whole lot of questions this way and if you tell me that's a bad thing then, well, I'll have to go back and start undoing them all.
 
protection is a weird thing... don't go worrying about doing the past ones, just this one please. I'd rather you undo it than I :p
 
I was under the impression that protecting a question is a good thing to do
Ah, well... easily enough to do, done :)
 
it use to be in someway... now it's pretty much useless, 'cos the system will do it anyway
and the system won't even allow you to protect a question at 15k unless the Q meets some criteria blah blah blah
 
yeah, I get that it's complicated...
 
at which point, the system has protected the Q and, the only thing you need to worry about is being able to "unprotect".
 
8:34 PM
Okay. Let me know if you come across any other questions I've protected that shouldn't've been
 
okay, I'm not going to go searching... just as we all come across stuff
 
Request for public shaming: A newb posted a question that I upvoted. It was a decent enough question even if it was a dup. It got a subsequent down vote which brought OP's rep to 4. I thought it was unfair so I edited the post in some trivial way, removed my up vote and subsequently reapplied my up vote. What that accomplished was to have the rep hit the floor of 1 even with the down vote then get the full benefit from my up vote and they are now at 6.
Did I overstep?
 
@cs95 thank you mate :)
 
no, thank you!
 
@piRSquared yes
It's not for you to decide how much someone else's vote matters
 
8:48 PM
For the most part I agree with you which is why I asked. However, if it weren't for my editing the question for the purpose of enabling myself to remove my own vote, then for 15 minutes after I initially voted, I do get to decide... a little bit.
 
Editing is trivial
Plus you yourself edited it, that kind of makes it worse
 
And I'm arguing a point I have no passion for. Yes, you are correct
 
I... didn't even know this was possible
 
^ uh-oh
 
Either way, on paper you've done nothing wrong because the net score is still zero, regardless of how it impacts OP's rep (a piddly +/-2 isn't really worth getting worked up over)
 
8:52 PM
totally agree. this is philosophical... not practical
 
9:08 PM
just a general note: worst case scenario - if there's suspicion of fraudulent votes the mods can request the CM team to invalidate them as they're the only ones that can see "individual votes" - mods don't get to your votes at all.
 
I guess I'm asking if vote order manipulation counts as vote fraud.
 
I guess then I'd have to ask what you consider "manipulation"?
 
I described it ^^...
 
"Request for public shaming". That says more about your own standards than those enforced by SO
 
umm... if "you" found the Q/A useful, then upvote if you want?
or just edit, or just downvote, or just skip along to the next Q or whatever
 
9:15 PM
I did up vote it. but someone down voted afterwards. I then edited the question so I could remove my vote and re vote.
Yes, I like the whatever route
 
Did you provide useful info?
 
@piRSquared no
 
@roganjosh no
 
You had already thought the question deserved the upvote before your edit, you couldn't have thought it was even more deservliest afterward. The fact that you improved the post while unlocking your upvote to reapply it again to counter the rep loss from a downvote that came later is a red herring.
 
Then close it. If you provided useful info, and you really are something of a pandas authority, then it's fine
 
9:22 PM
I closed it already. We're just debating the inconsequential nuance of how I gave 2 more rep to OP. I think we've exhausted any usefulness of the conversation as well.
 
now ask if bringing this up was worth it or not
 
not
 
so meta
 
@AndrasDeak honestly, I think you woke up on the wrong side of the bed today :)
 
well it would've been right up the same alley :P
 
I don't need to be in a bad mood to hand out acerbic moral feedback
 
I, for one, appreciate that
 
@cs95 I better not tell you about using temporary random downvotes to partly offset the rep cap, then. ;)
 
that's a buffer of 40 you can delay for one day (-;
Unless you cap again the next day
but then I'd experimented with deleting my answers only to undelete the next day... didn't work
 
@piRSquared Oh, ok. But downvoting other people's answers should work. Not that I want to encourage this sort of thing!
 
9:37 PM
yeah, must be difficult hitting up against that cap every day :p
 
@PM2Ring does the rep recalc not fix this?
 
@cs95 To be honest, I'm not sure. I've downvoted stuff that deserved downvoting on days when I've hit the rep cap, but I didn't subsequently reverse those downvotes.
 
end of day rbrb. nite all
 
It is completely wrong and misleading, and as soon as someone tries to use they'll be back asking why it doesn't work.
 
@EthanFurman sorry, we don't do that here
I understand where you're coming from but organized up/down voting won't fly
 
9:48 PM
Ah, sorry then.
 
it's routinely debated what to do with upvoted wrong or obsolete answers, and unfortunately there's no solution
hopefully your comment will help reduce the upvotes on the answer going forward, and most users don't read that down the page anyway
 
sorry - gotta run.. rbrb for now
 
rbrb
 
cbg
conflicted on someone's suggested edit of my answer: https://stackoverflow.com/a/45892102/5087436

should probably be a new answer altogether, no? OTOH, it's just a small modification of my answer to speed it up
 
That's pretty much up to you as the answerer
if you're okay with it feel free to approve, if you'd rather not feel free to reject with a corresponding reason
you can also "improve edit" to approve it and rewrite it to your liking
 
9:55 PM
I feel like rejecting just because I don't really understand it at all, and I don't know the repercussions of it so I'm not really sure if it should be in my answer.
 
then reject it :)
seems like obscure enough information
As the OP you could even approve/reject suggested edits retroactively, I think. Fairly new feature.
 
@alkasm It looks ok to me (although I don't know matplotlib or OpenCV). I don't like people editing my mine code (unless my code is buggy), but that's just a postscript to your code, so I'd say accept & improve, mentioning the author's name.
 
is it that reasonable to mess with the gc around a pickle.load call?
we don't usually touch the gc at all, so putting that into an unrelated SO answer seems a bit "dangerous" to me
 
Yeah I'm imagining that loading 60k images or whatever (as is common in ML land) and disabling the GC seems like...uh..i dont really wanna be responsible for side effects of that
 
of course the gc should only handle reference cycles which probably (???) doesn't happen during a pickle load
 
10:03 PM
@alkasm They're just temporarily turning off garbage collection, which can have a speed benefit for code that does lots of small temporary allocations. OTOH, it also means your code will temporarily use more RAM.
 
gotcha
Well, I've already rejected it, and let the author know they can create a new answer with it, but I don't think your suggestion was a bad one either (since they weren't specifically editing my code)
 
for what it's worth someone else also voted to reject it beforehand
 
Note that timeit turns off gc while it does its timings, to prevent the garbage collection from adding random noise to the timing measurements.
 
hi , i got quick question
 
huh, interesting!
shoot your q
 
10:06 PM
i'm using Flask-SQLalchemy ...
from flask_sqlalchemy import SQLAlchemy , create_engine, scoped_session, sessionmaker

i get an error on those : create_engine, scoped_session, sessionmaker
how to import them ?
 
@alkasm there's also things like instagram-engineering.com/…
@za001a if that import doesn't work, where did you find it?
 
@AndrasDeak SQLAlchemy page
 
What error do you get?
 
@AndrasDeak I'm not sure. It could be, depending on what's being unpickled. Pickling & unpickling aren't exactly clean processes, but I don't remember the gory details.
 
create_engine, scoped_session, sessionmaker
'create_engine' is not recognized as an internal or external command,
operable program or batch file.
 
10:08 PM
@za001a heh
why not run python code with python?
you're running it with bash
@alkasm good call
 
huh?
iam running it with python
 
lol!
 
@za001a prove it
 
python file.py
 
@za001a really?
 
10:09 PM
yrd
 
did you...link...python to bash?
 
your computer is haunted
 
i am confused
 
......
 
does that import line look exactly like you showed it?
 
10:10 PM
it doesnt say anything on Flask-SQLALChemy either
i mean it say how to use engine but not how to import it
 
@za001a it's not python giving you that error
 
@AndrasDeak i'm pretty sure it
 
okay then
 
what else could it be ?
 
@za001a Is that line the 1st line in your script?
 
10:11 PM
@za001a beats me
 
not exactly but top 5 lines in the script yes
 
what happens if you run
python -c "from flask_sqlalchemy import create_engine; create_engine()"
 
@za001a It sounds like a terminal error message, not one from the Python interpreter.
Are you running on Windows?
 
it has to be, the "batch file" part should've tipped me off
 
@PM2Ring @AndrasDeak the system works fine if i left it like this
from flask_sqlalchemy import SQLAlchemy
iam on windows 10
i hae no idea what batch file u are talking about
 
10:14 PM
rhubarb
 
but if u are talking about windows enviroment iam pretty sure its installed as it from flask_sqlalchemy import SQLAlchemy works
 
@za001a That error message is what a Windows command prompt says if you try to run a file that it thinks isn't a .exe or a batch file.
 
@PM2Ring maybe but i get that error as well when the imported command is wrong or not in the environment command
let me show u
 
if this error really is due to a haunted install, the answer is that create_engine and the rest are methods of a SQLAlchemy object flask-sqlalchemy.palletsprojects.com/en/2.x/api/…
In other words they don't have to be imported. You instantiate an SQLAlchemy object and use db.create_engine(...) etc, or maybe override that method. The docs aren't entirely clear and I've never used this.
We're back to "where did you find those imports?" to which you vaguely waved at the documentation
 
@AndrasDeak i think u are right , maybe i dont have to import it and yes the docs aren't clear , thank you !
 
10:20 PM
you should probably start with some tutorial instead
 
i'm
 
but it's really really really weird if failed imports give that error for you!
you should have that checked, probably involving a priest and some holy water
>>> import potato
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'potato'
>>> from numpy import array, potato
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'potato' from 'numpy' (/home/user/.local/lib/python3.7/site-packages/numpy/__init__.py)
 
it's not that weird , if u wrote ,from flask_sqlalchemy import bullsh*t , he will give the same eroor
 
this is how failed imports should look like in python ^
@za001a I'm telling you that it's very weird, you're just used to the weird
 
ohh
 
10:22 PM
@za001a what is the exact error message?
 
Traceback (most recent call last):
File "app.py", line 14, in <module>
from flask_sqlalchemy import SQLAlchemy , potato
ImportError: cannot import name 'potato'
 
ha.
 
i switched it to potato
 
switch it back to create_engine and paste the error again, please
 
ok
 
10:23 PM
(or whatever gave you that weird error earlier)
 
Traceback (most recent call last):
File "app.py", line 14, in <module>
from flask_sqlalchemy import SQLAlchemy , create_engine
ImportError: cannot import name 'create_engine'
 
ugh
 
same thing
 
16 mins ago, by za001a
create_engine, scoped_session, sessionmaker
'create_engine' is not recognized as an internal or external command,
operable program or batch file.
 
oh
 
10:25 PM
I hope you didn't just accidentally copy-paste and execute that partial line into the cmd shell before asking here...
 
maybe it was a typo from my side , sorry about that
 
@AndrasDeak thanks. I missed that part in the chat history. That definitely isn't a python error.
 
1 min ago, by Andras Deak
ugh
 
i might have pasted create_engine instead of python file.py
 
Occam's razor strikes again
 
10:26 PM
yup
 
Slaps @za001a with a wet fish
 
that make sense lol , i have just tested it
 
lol i deserve it
wth that's alot of fishs !
it's ok every great success is built on lot's of dum mistakes ;)
 
serves me right for accepting that you're telling the truth
 
10:38 PM
hey thank you for your help i appraciated you helping me with dumb problem @AndrasDeak @PM2Ring @Code-Apprentice
 
Well your main problem wasn't dumb. I suggest finding a tutorial rather than learning from the docs.
 
11:02 PM
@AndrasDeak yeah that is a great idea , i will do that , maybe a youtube tutorial
 
question: I'm getting a segfault only when running my code in VSCode and also only when subclassing a specific OpenCV object but the segfault happens at the very end after everything runs. What in the ***
class VideoCapture(cv2.VideoCapture):
    pass
 
11:16 PM
@alkasm Just a guess, but that may be a pointer bug, eg trying to free a block of memory pointed to by a pointer that contains a bogus address. Or maybe freeing a block that's already free. I think a modern memory manager should be smart enough to avoid that, but my C knowledge is a bit rusty. In any case, it sounds like a bug, but it may be difficult to determine if the bug is in VSCode or in OpenCV.
 
I mean it's a segfault so I'm leaning towards OpenCV (not particularly rare for weird segfaults with OpenCV) but i have no idea why it only shows up when using VSCode's debug call..
 
Although my previous post refers to C, those remarks apply to any compiled code. OTOH, C++ should have better memory protection than plain C.
 
I would like to have a file (with a bunch of constants to import throughout the program) and don't know what the most Pythonic name should be for the file. I have thought about globals and some people suggested config. Neither of these suit me too well. Any suggestions? What are the PEP8 guidelines?
 
FWIW VSCode calls this when launching my prog: cd /Users/me/prog/protocv ; env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 /Users/me/venvs/cv/bin/python /Users/me/.vscode/extensions/ms-python.python-2019.4.12954/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 61026 /Users/me/prog/protocv/testvid.py
@theGtknerd constants.py
 
Ah. You didn't mention a debug call before. The debugging machinery may expose a bug in OpenCV that was otherwise hidden.
 
11:20 PM
@alkasm Of course. Duh...
 
@theGtknerd Definitely not globals, since that's the name of an important builtin.
 
Now these constants will be updated ONE time at initial startup. Am I breaking any 'Pythonic'ness?
 
updated by what?
immutability of constants has nothing to do with Python in particular, fwiw.
 
Updated by the program. The constants are different depending if the program is installed or if it is running from a uninstalled version
 
In my mind, constants are things that are constant during the running of your program. So you might load some constants from a config file for instance, in which case yes its still a constant, even though they technically were defined at runtime.
IOW I think you're fine to do that.
 
11:26 PM
Thanks
 
but thats up to you, and I don't really think "pythonic" should come into consideration there, just general SW practices. You could for instance have installed-config and uninstalled-config files, and just have your constants.py have an if statement on which one to load up.
there could be better ways potentially, but no one is gonna yell at you too much for that :)
 
The installed/uninstalled was only an example, the db connection is also included and that setting come from still a different place... But still, the principle is what I was unsure of, and you gave me some good food for thought
 
yea, the comments apply roughly similarly either way
 

« first day (3121 days earlier)      last day (1818 days later) »