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

12:25 AM
cbg
 
cabbage u9
 
@alkasm Hey alkasm, (shall i call you Alexander :D)
 
Either is fine, I don't make it a point to hide my identity
well at least not on SO :p
 
@alkasm lol :-)
 
 
1 hour later…
1:41 AM
close this, with extreme prejudice. Best comment "Saying "I have doubts about" and then pasting your homework assignment is not a question."
 
 
1 hour later…
2:44 AM
I learned here today that in order to make a list comprehension more readable, It can be split into multiple lines and then inline commented i.e.
```
numbers.extend( #Append the list of numbers to the result array
[int(item) #Convert each number to an integer
for item in line.split() #Split each line of whitespace
])
```
vs numbers.extend([int(item) for item in line.split()])
Is formed a more readable approach, or does it make it more worse?
 
 
2 hours later…
5:11 AM
I have a Python dictionary in which the values are lists. I wish to keep these individual lists sorted, how do I do that
The values are lists of objects of some class say 'service'
 
5:26 AM
@DeveshKumarSingh I don't believe that list comp is that unreadable and I don't agree to adding comments that way; would make it more unreadable to me.
 
5:44 AM
This is just an example I provided @Austin , list comprehension might be easier to understand for a pro pythonista like some of you guys, but not for beginners!
Besides this advice came from some of the more learned folks here on the group yesterday, so I also wanted to get their opinions on it
@kauray please ask a question on SO for that!
So that others who might face a similar issue can look at your answer in the future, and get help from it :)
 
 
2 hours later…
7:35 AM
@DeveshKumarSingh I generally don't think inline comments (on the same line as code) are good, just maybe as a demonstration, but not in an actual codebase.
But it's not super uncommon for me to make a multiline list comprehension in general
 
@alkasm "but the segfault happens at the very end after everything runs." sounds like a reference count bug. Something gets deallocated too soon during teardown.
Perhaps outside the debugger nothing tries to use the deallocated object
Can't you do a post-mortem after the segfault?
does an MCVE with just the subclassing and maybe instantiation reproduce the bug?
And is the subclass really a dummy one?
 
@AndrasDeak Yes and yes. I opened this as an issue on VSCode Python extension GH: github.com/Microsoft/vscode-python/issues/5551
I am pretty doubtful it is actually VSCode's bug, but I'm more curious why I only see it here. I don't know what you mean by a "post-mortem after the segfault" --- like I mean I know what those words mean but idk how to perform such an action.
I don't know what VSCode actually does to run the "debug" for a python file.
 
7:55 AM
I meant runming the code in a debugger, like pdb or pudb or the equivalent in vscode
@alkasm I'll try to repro from laptop.
 
Yeah i dont know if it's "actually" running in a debugger or not, I mean it shows you the code it runs and it doesnt seem to set one, i dont really understand what VSCode is doing
@AndrasDeak tyvm
 
8:14 AM
Can anyone tell me how can I make this code better? Do we have any way to pop the max element from set? s.pop() giving the minimum element.
n = int(input())
s = set()
for i in range(1,n+1):
    s.add(i)
while(len(s)!=1):
    x = max(s)
    s.remove(x)
    y = max(s)
    s.remove(y)
    #print(x,y)
    s.add((x+y+x*y)%1000000007)
for i in s:
    print(i%1000000007)
 
8:26 AM
Simple, don't use a set, since they are unordered.
Try an OrderedDict. There are methods to use that allow you to swap the order of keys and such.
@taritgoswami Basically it works by maintaining a dict (for the set-like quality) AND a linked list of keys to keep the order of the keys maintained however you like
@AndrasDeak any luck with repro?
 
user7437554
if dx or dy < 1:
 
user7437554
i need if the condition is true, multiply dx or dy by 10
 
user7437554
any idea how to do it?
 
user7437554
8:41 AM
done
 
user7437554
@alkasm is it possible to write a for cycle 2 variables?
 
user7437554
like this:
 
user7437554
for a,b:
 
user7437554
etc
 
8:42 AM
yes
 
user7437554
should I put a,b in a list?
 
Be more specific with what you want to achieve
 
user7437554
I'm trying to get something like this:
 
user7437554
nice_list=[dx,dy]
    for length in nice_list:
        if length< 1:
            new_length=length*100
        elif length<20:
            new_length=length*10
        elif 150>length>20:
            new_length=length
        else:
            print('f{print(is too big)}')
 
user7437554
sorry, that one
 
user7437554
8:48 AM
The problem is, I don't know how to get the new list...
 
user7437554
I'm not sure how to do it
 
user7437554
this is a new trial
 
user7437554
 nice_list=[dx,dy]
    new_nice_list=[]
    for length in nice_list:
        if length< 1:
            new_length=length*100
            new_length.append(new_length)
        elif length<20:
            new_length=length*10
            new_length.append(new_length)
        elif 150>length>20:
            new_length=length
            new_length.append(new_length)
        else:
            print('f{print(is too big)}')
 
user7437554
9:18 AM
Sorry for the long text, I've pasted it here pastebin.com/kpv3X78t
 
9:49 AM
Huh, just got bit by the mozilla add-on signing issue.
 
Does anybody know how can I solve the error ImportError: No module named target_pkg (from pyke.target_pkg import target_pkg) when installing scitools-iris using pip?
I have asked a question on SO here, but no replies.
 
@RogUE Not sure, but probably from pyke import target_pkg?
 
10:07 AM
@Austin Actually, I am not executing that statement, it's done by pip while installing scitools-iris.
Also, executing from pyke.target_pkg import target_pkg from python shell causes the same error, though import pyke works fine.
 
10:30 AM
@IljaEverilä oddly enough, I'm not. Perhaps because of dev edition
@alkasm yeah I tried it multiple times but the result is a closely guarded secret which is why I haven't told you yet :PP
(when I said "I'll try from laptop" I meant "I'm not on laptop right now but whenever I am I'll try it and get back to you"...)
I don't see anything from python or pudb
Actually, when I rerun the script from the same debugger session (pudb or even pdb) I get a segfault. Meaning it has nothing to do with VS Code, which I don't find that surprising.
but calling importlib.reload from an interactive shell doesn't trigger it
 
 
2 hours later…
12:57 PM
import cv2

class VideoCapture(cv2.VideoCapture):
    pass

cap = VideoCapture()
del cap
@alkasm if you import ^ that then importlib.reload() it again you'll get a segfault in the vanilla REPL
oops, wrong test
OK, at least openCV is not haunted
Anyway, I can't get it to break on a first run, only on a reload. So there's probably some stateful shenanigans going on which could explain why it only dies at the end when you debug it with VS code.
 
 
1 hour later…
2:09 PM
> We believe that no data has been lost, unless the owner/maintainer of the repository did not have a local copy and the GitLab copy was the only one.
Wait, what? :D
 
 
2 hours later…
3:43 PM
@AndrasDeak nice find! ty. Also, IDK if del cap is what you want, but cap.release()
 
That's what is in your example, I know. I wanted to reduce it as much as possible. Presumably before being garbage collected the object will call its release().
 
3:58 PM
@AndrasDeak uh...I think you overestimate how nicely the python bindings work.
 
probably :P
 
The Python bindings are auto generated, so I don't think the library really "knows" what should happen.
 
But if instantiating and then trashing is not a no-op then there are huge problems
 
I'd expect the destructor to be turned into a __del__ or something
 
3:59 PM
probably safe to del, i didnt realize the destructor automatically would release
 
Yeah, I read that hint at docs.opencv.org/3.4/d8/dfe/…
 
ah ic
 
There's also a spooky mention of deallocation :P
 
sPoOkY meMoRY tHinGs
so why would a reload produce the same thing?
 
I'll do you one better: why does trivial subclassing matter at all?
 
4:20 PM
@AndrasDeak what? it doesn't. it's an MCVE
@AndrasDeak This is where I'm using it: github.com/alkasm/cvtools/blob/master/cvtools/videoio.py
 
But if you remove the subclass and use cv2.VideoCapture it goes away, doesn't it?
I'm pretty sure I tried that
 
Oh, I thought you were saying "why does this example matter"
 
nah
 
yea that's exactly the point, i have no idea why subclassing would be the thing that makes this happen lol
Hm, what about if you manually create one via new? cv2.VideoCapture.__new__()
 
ew, no
I wouldn't be surprised if a partially initialized object were to break things
 
4:24 PM
I'm more just wondering if that machinery in Python is the thing that breaks it
 
in either of our examples there's nothing magical going on, instantiating an object and then discarding it is the safest thing you can do
unless you mean trying to figure out whether the problem is in __new__ or __init__...
 
yea, maybe Python's machinery of calling the superclass's __new__ or something is weird
 
I don't have much time right now but during lunch I wondered about wrapping __getattr__ in the trivial subclass and looking at what gets called before things break...
 
as I said before, the Python bindings are somewhat brittle.
hm, that's a decent idea
 
Hi guys
 
4:32 PM
feel free to pursue it on my behalf :P
cbg
 
is there a way to save a matplotlib plot using savefigures bbox_inches="tight" option but in the savefigure dialog that shows when using plt.show()?
 
call fig.tight_layout()
 
ah perfect thanks
 
no problem
 
wait it doesn't do anything...
like this?
plt.gcf().tight_layout()
plt.show()
 
4:35 PM
assuming you only have the one figure, yeah
 
wim
 
if you have multiple figures then of course only the active one will be affected
 
I use fig.add_subplot(1, 2, 1), so I have 2 figures
ah I see
I thought it does it for all figures
 
@Hakaishin that creates 2 subplot axes in 1 figure named fig
either you're confused or you're being confusing ;)
@wim uh-oh! Is the bottom line "don't"?
 
Yeah I think I have only one fig and multiple subplots
but still the fig.tight_layout() does nothing, still lots of whitespace around my figs
 
4:38 PM
Sounds like it. And you already have fig as a name so fig.tight_layout() should work.
 
yeah i figured xD
 
@Hakaishin I wouldn't be surprised if it wouldn't reproduce the other call 100%, but it's suspicious if nothing happens
(especially since it always works for me)
 
hmm, I mean dunno how this can go wrong, I have one fig I call fig.tight_layout(), then I show it and save it using eps format
 
wim
@AndrasDeak There was an audible groan from the audience when this slide went up
 
4:41 PM
haha what forum is this?
 
hehe, I wonder if that's a good sign or a bad one
@Hakaishin probably PyCon
 
wim
yeah it was at PyCon
it was not one of the tech talks though. it was actually a standup-comedy kind of routine
 
bah, wish i was able to go to PyCon this year!
 
@wim did it get closed as off-topic?
 
Also, interesting read to go up during PyCon: "Why I'm not collaborating with Kenneth Reitz" --> vorpus.org/blog/why-im-not-collaborating-with-kenneth-reitz
12
 
4:44 PM
Ooooh, Nathaniel Smith!
that I've got to read
 
wim
@AndrasDeak bahaha
 
@AndrasDeak lol that was pretty good
 
wim
PR speak at its finest
 
I had to read it twice to make sure I wasn't missing something...
 
wim
(to clarify context, I was referring to the gitlab quote)
 
4:57 PM
@alkasm very well written
 
Well yea its njs!
I remember trying to listen to Reitz's podcast once...
 
that guys sounds crazy
 
and he was like hitting a vape super hard into the mic every 30 seconds for an entire hour, while his guest was speaking
it was really bizarre
 
@Hakaishin it's the opposite, pathologically manipulative people don't sound crazy at all
 
@AndrasDeak but yeah I think it was a very fair piece, considering the circumstances. It's annoying that Nathaniel had to really consider whether or not to release this, when we're talking about thirty thousand dollars that could have gone to open source maintainers. That's not minor.
 
5:08 PM
it's not about the $30k
the reputation of both men is on the line, and there's a very good chance that Reitz will go on the offense
 
I found a way to solve my problem, it's not pretty but it works well: sanattiwari.wordpress.com/2015/09/20/…
 
from that page you only need pdfcrop, and I regularly do that for publish-grade figures
 
How do I extract the first element from each sublist
[[[0, [1], 20], [1, [1], 50], [2, [1], 70], [3, [1], 200]], [[4, [2], 20]]]

Result would be [[0,1,2,3],[4]]
 
yeah didn't know about it. writing reports is so .....
 
hello
 
5:14 PM
hi
 
@kauray that seems like a desceptively simple-looking question. Is there only two levels of nesting that should be considered?
 
yea two levels of nesting, thats fixed
 
Both Reitz and njs are ugh, to be honest. I'd take everything in there with a bag of salt
 
>>> [[sublst[0] for sublst in lst] for lst in l]
[[0, 1, 2, 3], [4]]
assuming l is your big nested list
@vaultah really? That's a bit curious. There are quite some accusations in that post so I'd be surprised if Reitz was equally right here (or njs equally wrong)
 
@AndrasDeak cool, thaks a lot
*thanks
 
5:22 PM
No problem. You can also edit/delete messages for 2 minutes in chat
@vaultah on a less important note I've seen njs in mailing list discussions and he always seemed very reasonable. But of course ultimately this doesn't say much about one's character.
 
cbg
 
cbg
 
wim
@vaultah what the beef with njs?
 
5:40 PM
@AndrasDeak I maybe trust njs to reliably deliver information that is universally true and can be independently checked (like the sequence of the fundraiser events), but I don't trust anything subjective from him (feelings, opinions, recollections of conversations, characterization of other people, etc)
Basically same as my beef with 1st1 (and svetlov) :D No links this time though
 
we could do with a handy infographic
 
6:01 PM
why is it that eval('2j') (for example) works, but eval('j') produces a NameError?
 
wim
first one is a complex number literal
 
...i guess to get the latter to work you'd have to say eval('1j')?
 
side note: don't use eval, use ast.literal_eval
@heather yup
 
wim
or complex(0, 1)
 
or just the literal 1j
(-1)**0.5 is close but imprecise
 
wim
6:03 PM
the complex literals have some weird issues with signed zeros, so I avoid them
 
@heather depends what you mean by "work"... if you want a complex number 1j then yes... if you actually expect j to not raise a NameError then not so much :p
 
wim
(...see Bogus parsing/eval of complex literals if you want to know about that)
 
@AndrasDeak ast.literal_eval doesn't seem to be able to handle, e.g., math.sqrt()
 
the fault is on whomever wants to use -0-0j :P
@heather of course not, but it will also not allow people to delete your home directory
 
@wim umm... that was kinda mentioned in the Python Zen wasn't it? Simple is better than complex - maybe they were being literal there :p
 
wim
6:05 PM
"not a bug" bug: bugs.python.org/issue25839 and see comment from victor stinner
> You should use complex(a, b) to have a reliable behaviour.
 
@AndrasDeak i am aware of the dangers of eval()...i had a conversation a bit ago that starts here about it
 
obviously ideally i wouldn't use it
 
the only question is what kind of inputs you're accepting and whether anyone remotely malicious has access
If not, knock yourself out with eval. If yes, I would just do something else. Dedicated parser with a set of well-defined functions, most likely.
wow, I badly need a coffee
 
6:09 PM
for now, it's a stop gap so i can test easily. i will probably eventually change it to a dedicated parser.
i'll try to avoid trashing my own system ;)
 
OK, as long as you're aware of the risks it's fine
 
and of course i'll add a large warning to the github repository.
 
that would have to be a very large warning
 
good, good
now push that patch to humans:master that makes them read warnings ;)
 
6:26 PM
hello
could anyone explain to me how scoped_session() and session_maker() works in Flask_SQLALchemy
 
*runs away*
 
lol
noooo! ,come back !
 
fortunately I don't know anything about SQLAlchemy nor flask :P
 
dam it
 
@AndrasDeak lol
i'll take it up with the great developer in the sky
 
wim
6:37 PM
I'm torn..kenneth is infamous for his violations of wheaton's law, but call-out culture and public shaming has its own set of problems
 
I think his "working around the toxic person" notion is a strong reason why he did it anyway, despite the latter
I think eevee had a post along touching similar lines
 
wim
it would be really hurtful to read a post about yourself like that - it's the kind of thing that can push someone into depression or suicide, especially for a person already with mental problems
 
he also seems to have tried talking to him directly, multiple times, to no avail
can't find the post I vaguely remember (regarding "oh yeah Joe is toxic, we just work around him")
I may have read it when the welcome wagon started rolling
Aaah, it was linked from the post I had in mind. NSFW blog and probably post warning: pervocracy.blogspot.com/2012/06/missing-stair.html
 
7:04 PM
Can anyone explain how this line of code works?
>>> sorted([1, 2, 3, 4, 5, 6, 7, 8, 9], key=lambda x: abs(5-x))
 
Do you understand what vanilla sorted does, without the key keyword argument?
 
could you be a bit more specific? What part do you not understand? sorted, key, lambda, abs?
 
@Aran-Fey The lambda part
 
But you know what key does? That's easy, then. lambda is just a syntax that allows you to create anonymous (unnamed) functions. lambda x: abs(5-x) takes x as input and returns abs(5-x)
 
@Aran-Fey No, I haven't seen this type of function before :(, which uses a function as an argument
 
7:12 PM
Functions like that are called "higher order functions". In the case of sorted, it calls the key function on each list element (which gives [4, 3, 2, 1, 0, 1, 2, 3, 4]) and then sorts the list by that. So the result is [5, 4, 6, ...]
 
to check if a numpy matrix is unitary, is it valid to do np.array_equal(np.dot(matrix, matrix.conj().T(), np.identity(dimension))? I've not had problems with it, but I tried it on a hadamard gate and it said it wasn't unitary.
(hadamard gate is 1/sqrt(2)*[[1,1],[1,-1]])
 
yeah, you have floating-point errors
 
shoot
 
always use np.allclose for floats
and you can use np.eye as I for short
that function call after .T is a typo, I expect
 
@AndrasDeak wait, what do you mean? as in np.eye(dimension)?
 
7:22 PM
yup
eye as in I
 
so the line should look like np.array_equal(np.allclose(matrix, matrix.conj().T), np.eye(dimension))
 
(eye is more general, you can also create rectangular arrays with it or shift the diagonal)
@heather nope
step back two steps and read what you wrote just now :P
Or if that wasn't a typo: you need dot, or even better, use @ as an infix operator. np.allclose should replace np.array_equal
np.allclose(matrix @ matrix.conj().T, np.eye(dimension))
 
I see
 
it's because 0.1 + 0.1 + 0.1 != 0.3
 
good thing np.allclose() exists
 
7:26 PM
lucky ;)
you can set relative and absolute tolerances to which you accept errors, in case the defaults don't work for you
 
the default worked for the hadamard gate, so i'll leave it there for now. thank you!
 
no problem
 
7:51 PM
Cbg
 
cbg
 
8:26 PM
cbg
 
@AndrasDeak The analogy in that is just so overblown that it makes the opinion ridiculous. I understand what they're saying by, really, there's a point where you just discredit yourself, surely?
 
I don't think I agree
assuming you mean "the missing stair" as the analogy
 
No, I mean the rape
 
Hmm? As an analogy of what?
(because that blog post features a literal rapist)
 
I've... followed the convo incorrectly
 
8:31 PM
there were two links, the first one on the starboard which is recent and is python-related, and a second one I linked because I was reminded of it by the "missing stair" reference
 
Then i dont get the point. I could see the link with working around someone toxic in the community but I actually thought it was the article you saw the quote about a python developer from
 
In the link on the starboard (written by njs, about Kenneth Reitz) there's a mention of 'the classical "missing stair" problem'. That's the only connection.
 
That would be my comprehension fail but I think the series of posts there does lead to that conclusion
 
I had read about the missing stair problem in the blog post I linked later, the one that's on an NSFW blog in an NSFW context
the blog post I linked is from 2012, the python-related blog post on the starboard is from today
but OK, I understand your confusion now
2 hours ago, by Andras Deak
can't find the post I vaguely remember (regarding "oh yeah Joe is toxic, we just work around him")
hint: Joe is a placeholder name
 
hey , anyone with SQLAlchemy knowlage can help switch between the two databases ?

i've managed to create engine ans session on the second one while the other one is connected to all users by app.config
when i run command like this
_tables = {table:db.Table(table,db.metadata,autoload=True,autoload_with=db.engine)
for table in db.engine.table_names()}
it always pull data from "app.config['SQLALCHEMY_DATABASE_URI']" database and not the db.engine database
            engine = db.create_engine(url, **kwargs)
            Session = db.sessionmaker(bind=engine)
            session = db.scoped_session(engine)
 
8:38 PM
please practice your formatting a bit more
 
i'm working on it , i pressed "alt+k" but it didnt work
 
It worked, but 66% of your lines had surpus whitespace. There you go.
 
I'm currently learning ORM with Flask since my last app couldn't really make use of it, so I'm reluctant to make suggestions here sorry
 
that is ok
 
What tech for the two databases? SQLite?
 
8:41 PM
both are postgres for now
 
Ok, that makes more sense. The fact that your app needs 2 connections made me think it might be sqlite :)
 
nah iam just trying to switch the database as i will be doing that constantly with CRM
 
Asking as a layman: is it not a very bad idea to have both a Session and a session in your namespace?
 
hmm it can be confusing i guess but so is everything in python , i just got used to it
 
oookay :P
after our séance last night I'm willing to cut python some slack between you and it
 
8:48 PM
LOL!
 
The session isn't being registered on the app, though
You could open a connection to SQL anywhere you like in your app, I'm not sure what persists your session
 
@roganjosh yeah that is what i thought , i think i need to add or modify something
 
@roganjosh that is helpful if i know both URL of the databases but i really only just 1 and the other one is whatever the user input
 
So your software is a bridge; one internal database and then a database of the customer's choosing?
 
8:59 PM
yup
 
I'll be a few weeks I think before I understand the Flask Sqlalchemy wrapper properly :( but I'm also trying to understand your requirement in general; I don't see quite how it stops you using the link
Ok, I understand what you're trying to do
 
me too , i almost pulled my head off trying to understand it as well
i'm pretty sure iam close but not sure what is messing.
 
Sam
Looking at the docs for next(): Retrieve the next item from the iterator by calling its __next__() method. If default is given, it is returned if the iterator is exhausted, otherwise StopIteration is raised. What does "if the iterator is exhausted" mean?
I'm assuming no more elements?
 
yup
you can test it with it = iter(range(3)) and calling next(it, 'potato') a few times
 
Sam
thanks
 
9:08 PM
@za001a since you have to know how the connection is persisted then I presume you looked at how flask-sqlalchemy works?
In which case, what is missing in that understanding? The hooks necessary will already be used by that library
Or, the one I linked. Between the pair of them, they should outline the approach needed. You're gonna want to go into the source code for it, probably
Not of Flask itself (though it's a relatively small code base and easy enough to read to get your head around), but how you have a db session attached to the app
 
@roganjosh not quite sure what do u mean but yes the main database was attached using "app.config['SQLALCHEMY_DATABASE_URI']"
but since i can't just modify that or add a variable BIND for the database where user can give that variable it's value later , I assume there is a different way around it which i tohught but just creating another Engine , add it to the session and the create session maker should be enough
but apparently it's not
 
I'm suggesting that you look the flask-sqlalchemy library up on github and see how it works
 
sure , i will google it
 
The default is 1 backend database so it's unsurprising that it falls back to the main connection, whatever you implemented
 
9:24 PM
i'm glad that atleast one database's connection is solid
 
As I said, I'm reluctant to suggest an approach because, for all I know, it could result in spurious connections all over the place. I have my own fun on Monday with files that may or may not be imaginary on Monday. Last thing I wanna do is suggest things if I don't know fully :)
But you can be certain that the answer lies in the code base of flask-sqlalchemy and that is freely available on github
 
thank you so much , i will start with those !
 
10:02 PM
I want to read a txt file and add lines to an array.

```
with open(BASE_DIR + "/songs.txt", encoding='utf-8') as f:
list = f.readlines()
```

This is what I do. But I have unicode chars so i get the error: 'ascii' codec can't encode character '\u2019' in position 63. I have tried encoding and decoding. some text is like a word: ain't thats what messes it up. How can I make a list of strings out of it?
 
What happens if you don't add the encoding parameter?
 
then i will have very weird chars in my string
ahh let me see
'ascii' codec can't decode byte 0xe2 in position 49
 
Sorry, on my phone. All text is liable to change :P
 
haha no worries :)
 
1: don't call a variable list because that will shadow the built-in name list. 2: lists are not arrays, they are lists.
both are tangential to your question, just saying
 
10:10 PM
ahh its just an example
but thanks!
yes
i want a list out of the lines
have you got any idea how?
 
I can tell you what I would do, but I'm hopeless with text encoding. I'd run chardet on the text. But really, I'm hopeless with understanding text encoding.
Seems it doesn't matter how many well-worded articles I read, it just won't stick in my head :/
 
no worries thanks!
its a pain indeed with those encodings
 
No need to thank me, I've pointed you to a guessing library :P
 
well you spend time on my issue :)
i have found the solution
atleast working in my current state
with open(BASE_DIR + "/songs.txt", encoding='ascii', errors="surrogateescape") as f:
that seems to help
 
10:45 PM
guys there was a way for SQLAlchemy to detect all classes tables for the database automatically isn't it ?

i'm getting error "'Engine' object is not callable" , i assume it's because the database's classes isn't defined
 
No, that error doesn't sound like you not defining classes at all
 
yes that is what iam saying , i didnt define classes , that is the External user input database
ofc i won't have classes for it on my system
 
Then you can't have an ORM
 
huh ?
i'm pretty sure there is away around it
 
Because you can't possibly know the structure of their database
 
10:50 PM
there is a way to do that i'm sure , i've seen it before but i don't remeber it's name
it's feature in sqlAlchemy
 
Mmm
How is Sqlalchemy going to detect all the classes of a 3rd party?
 
i know it can for sure
but i dont know how yet
 
<slightly distracted by the 80 yr old doing ninja moves right in front of me>
 
haha
got it
 
I am actually curious on how that works. How did you make it work?
 
11:02 PM
i found it but i didn't figure it out yet
it's called automap
 
11:35 PM
I have an inheritance question. Say have I have classes Base, Derived1(Base), Derived2(Derived1). In Base I have method func(), Derived1 I have func() which calls Base's func() with super().func(), but now in Derived2 I want a method func() which skips Derived1's functionality but does call Base's func(). Is it possible specify at which level in the hierarchy to call?
Oh! It would be Base.func(self, args) from Derived2. :) Thanks haha
 

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