« first day (4427 days earlier)      last day (528 days later) » 

7:58 AM
check your email @roganjosh
 
8:09 AM
@Kevin there lies the problem :D Modules act like namespaces in a nice way and please don't pitch the namespace idea to anybody in the python team :P
 
8:24 AM
@Kevin Just pinging this because it is really important. Use whatever paradigm is appropriate for the task, don't feel pressured to use a paradigm just because it seems professional/radical/en-vogue/standard.
 
8:35 AM
@MisterMiyagi I think you meant to ping me since I was the one who asked, but thanks :D
 
 
1 hour later…
9:53 AM
print("Users:", all_users['Users'])
TypeError: 'Response' object is not subscriptable
Anyone knows the solution?
 
Don't try to subscript an object that cannot be subscripted.
 
return jsonify({'Users':list_all_user, 'status': 200})

This is what all_users get in response
 
Alternatively, find out where the thing is that can be subscripted.
 
@MisterMiyagi Sorry I'm not getting you properly.
 
You cannot subscript a Response. Find out what attribute of a Response you can subscript, or what function or method gives you the data that you can subscript.
 
9:59 AM
just wondering, but I want to ask a question on SO related to detecting close_handle (or whenever a file is closed on a specific directory) on Windows. I know how to do it using the inotify API on Linux, and while I did find this ActiveState recipe that works on Windows it only handles (pun intended) added/removed files instead.
Would this question be fine on SO or do you think it'll be a bad question?
(I also know how to do it using polling, but that's not what I want)
 
dpaste.org/FnuTN @MisterMiyagi here's my code snippet if you can look into this that would be of great help.
 
There's no all_users['Users'] in that code
@NordineLotfi It sounds like an acceptable question, but are you sure nobody has asked that already?
 
@Aran-Fey That's what I've written when I started so I guess problem is in the beginning.
maybe I'm not able to understand that properly.
What I've written in test file is right or wrong?
 
I have no idea. But the code that is definitely wrong - all_users['Users'] - is missing.
 
f = open('backened/tests/response.json')
        data = json.load(f)
        print("data", data)
        all_users = get_all_users()
        print("Type:", type(all_users))
        print("Users:", all_users['Users'])
        print("status:", all_users['status'])

        self.assertEqual(200, all_users['status'])
here I've used all_users['Users']
 
10:12 AM
@NordineLotfi Thank you but I was only kidding - I wouldn't have anything to plug it into :P
 
What SQL module are you using? What does conn.execute(sql).fetchall() return?
 
I haven't actually logged in to my website for ages and never did hook it up to a mail server. Someone kindly asked me in March "do you love Rogan Josh?". I should check my messages more often, it's important stuff!
 
:@Aran-Fey I'm using SqlAlchemy core for DB(Postgres) interaction
@Aran-Fey conn.execute(sql).fetchall() .... this will return all user data
 
Also, frustratingly, I had two folders - app and app_new. Guess which one was actually the most up-to-date one. Old roganjosh did not come through to help current roganjosh with that one
 
{
"Users": [

{
"dob": "Tue, 07 Jun 2022 00:00:00 GMT",
"email_address": "testuser13@example.com",
"uid": "3474b02b81904a9993977a24e1bc23f8",
"user_name": "testuser13"
}
],
"status": 200
}



@Aran-Fey in this format
 
10:16 AM
@roganjosh I mean, you can't deny it's a wonder I found it so cheap ;) (it's from an official seller too from what I saw after re-checking). The motherboard for it is priced the same (under 600~). I admit the only problem would be the ram, since it has to be the same frequency/etc (AMD shenanigans) but that's about it.
 
If that was true, then all_users['Users'] wouldn't crash with TypeError: 'Response' object is not subscriptable. It all_users is a Response object, whatever that is
 
@Aran-Fey I saw one SO question that mentioned something similar, but it was only for "watching files/directory", not specifically watching for close event/handle (AFAIK)
 
I don't think we can make progress here without a proper Minimal, Reproducible Example
 
I also found out how to watch for closed handle but for processes, doesn't work on files I think :/
 
https://stackoverflow.com/questions/74600534/python-unittest-how-to-use-method-logic-for-unittest-in-python

here I've requested for register. @Aran-Fey you can have a look
 
10:21 AM
ResponseObject will store its data as attributes. That's the point of SQLAlchemy core, so it depends on what you called the field in the class backing that model is
 
That's also not an MRE, and I can't fill in the blanks because I don't know anything about flask
 
I actually don't know what you've set up here @NaveenPandia but it's not really looking like a cohesive use of sqlalchemy for the model you want to set up
Since you want a registration form, you could use flask_wtf for this. Since I was already looking at my website code trying to work out where the hell I was storing my messages, you could have it like this and attach the validators there
Each message being backed by a class which is what you'll get in a ResponseObject. It will be a collection of instances of that class if you query it through SQLA
 
10:53 AM
@roganjosh I just want to test my register method , i've completed my logic part and tested this using client but in method there is an adnatge of testing your function flow and in this I'm using SQlAlchemy_core so I don't need model to be present in my app
 
I'm using a library to extract images from a PDF file, and it seems to do something weird with the GIL because my GUI freezes while this module is doing its job (despite running in a different thread). (I know for sure that this PDF module is causing the problem.) Any ideas how I can quickly work around this problem? Is running it in another process my only option?
 
what's the module/way you're using to extract the images from your PDF?
there a couples dozen on pip
 
PyMuPDF. It's by far the most convenient one, and also the only one I've found that supports this particular compression algorithm that my PDFs use
 
also what's the GUI? tkinter? I know that depending on how you handle the displayed images on it, it can freeze the whole thing
 
PySide6
 
11:01 AM
ah yes, I like that one too. MuPDF is also pretty good as a pdf viewer
 
Wait a minute, now that I think about it, these PDFs might actually use a different compression. I'll try using a different module
Oh wow, that worked and it's soooo much faster too
 
11:20 AM
what was the problem? what you guessed earlier or?
 
PyMuPDF was the problem, but I don't know what exactly they screwed up
 
I guess they misimplemented something or maybe don't support everything the C library do
I already know Xlib module doesn't support everything, so that wouldn't surprise me
 
 
2 hours later…
1:39 PM
@NordineLotfi Nope, I obviously went through the official example already haha, I finally decided to use the 'style' argument instead of picking the color myself unfortunately
 
1:50 PM
hmm, I did notice some inconsistencies with openpyxl myself. Sometimes everything works when using Linechart, but then no lines get drawn on the graph :/
there also no errors. But using the example I linked last time does work (as it is at least)
if you're curious, I used this blog as a basis: shibutan-bloomers.com/python_libraly_openpyxl-9_en/5629 it's decently detailed. Some of it is in Japanese but there is a lot more English (most of the time)
 
@Aran-Fey It might be useful to run problematic PDFs through Ghostscript, to make cleaner versions. I haven't played with it for a few years, but I just learned that they've done a lot of work on their PDF interpreter recently, and GS can output PDF in a few different modes, and do OCR, via Tesseract. See ~ halfway down this page: ghostscript.readthedocs.io/en/latest/Devices.html#devices-htm
 
2:32 PM
Oh, interesting. It's too late now, but that may have been a more convenient solution than all these weird low-level pdf modules I've experimented with
 
But where would have been the excruciating learning opportunity in that?
 
All I've learned is that python has no good pdf modules
Well, I suppose I learned a little bit about the PDF format
 
I don't think there are any good pdf modules, on account of writing/maintaining them being a thankless and boring task. ;/
 
Also the pdf specification is a far more wild and complicated document than you can possibly imagine.
 
The road to hell is paved with extensions to the PDF specification.
 
2:47 PM
+ you have to pay for it I think.
theoretically you can add video to a pdf...
 
yeah, you can even execute payload/program by embedding them in a PDF
of course, it depends on which pdf viewer is reading it, but if it support JS, or whatever you're using for embedding it, then it'll execute it (unless it has "protections" for that, but I wouldn't be surprised if this isn't fixed yet for some existing viewers)
If I recall right, AdobeJS is a real thing. opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/… (couldn't find the webpage, so this is a pdf for some reasons)
 
Of course blocking other threads is not-a-bug, what was I thinking reporting that? Sigh
 
you mean that for PyMuPDF?
@0x263A nice stuff
 
Yeah
 
3:00 PM
ah, I guess not-a-bug is the new as-designed :/
don't know if you saw this already, but this is related: github.com/pymupdf/PyMuPDF/issues/294#issuecomment-490432602
you could always use multiprocessing.Process with a single external process to open mupdf though
ah, but I don't think you want to depend on Queue for that right? Pickle doesn't work with it in this case, see github.com/pymupdf/PyMuPDF/issues/294#issuecomment-490743168
 
It can't even be pickled? Jeez
 
@NordineLotfi How ironic. A major reason that PDF was created in the first place is that PostScript was deemed to be too powerful, since it's a Turing-complete programming language. So they wanted a restricted dialect that couldn't do devious things, like a 1k doc that prints millions of pages. PS can read & write files, but I guess there are ways to restrict that, depending on the environment.
 
yeah, heard the same thing once :D
I feel like, at this point, it's much harder to find a non-Turing-complete language than to find one that is Turing-complete. Let's just go ahead and say "every programming language is Turing-complete" and be done with it.
 
Well, technically, none of them are, since a true Turing machine has an unlimited tape (RAM). But that's just being pedantic. ;)
 
3:21 PM
I speculate that HTML is not Turing complete. CSS is known to be Turing complete, but only if the user clicks on the screen once per state change.
 
@Kevin wth, I mean I knew that everything and their dog is Turing complete, but even CSS...
 
yeah, you can make some nice animations with CSS, so this isn't surprising
 
true, animations are the key
 
I agree HTML might not be Turing complete, but that's mostly because of most browsers, which don't reload/dynamically change the static HTML part. If you made a browser that supported reloading HTML on file change (you can do this with existing browsers using flags or extensions, but that's beside the point), then it would work, but might be cheating.
 
3:23 PM
HTML5 is probably Turing complete though (since I know you can make games with it)
 
To be clear, when I say HTML, I'm including HTML5. But I'm not including JavaScript. JS is obviously Turing complete by itself.
 
right, I guess HTML5 make use of both JS and HTML to do what it's doing
Does anyone know how to ignore SyntaxError when using both python2 and python3 code in the same file?
 
I would just delete that offending line. I expect exec(get().decode('utf-8')) would work in both Python 2 and 3, for the same reason that print("Hello, world!") does
 
I know I could use the function with the python2 code as a string but I thought it would look nicer and easier to maintain if I have it as a function on the same file, and use inspect to get it's content to a file instead (can also make use of indentation and other editor features since it's really confusing to use this much code as a string)
 
which is to say, Python 3 sees it as a function call, and Python 2 sees it as an exec/print statement with a superfluous parenthesis pair
 
3:30 PM
ah yeah, you're right, this works
so I guess, hypothetically, if I use older than py2 code (for various weird reason) and embed it in a py3 file as I did here, does that mean passing it as a string is the only way to be able to run it (if it contains errors that is)? I guess I could use one of the python flags to ignore SyntaxError, but that feels kind of bad
 
As far as I know, you can't ignore a SyntaxError unless it's coming from inside an eval/exec call.
 
@PM2Ring Finally found the time to give these a proper listen. Bluesy stuff, I really dig it.
 
SyntaxErrors are generally "catastrophic" in the sense that the parser can't deduce where the bad syntax ends and where it can start parsing good syntax again. As a simple example, if you have a "(" with no corresponding ")", the parser might figure out a paren is missing, but it doesn't know where it should have gone
 
I see. I guess writing it to a file is better than nothing if that ever happens...Thanks for your insight
 
@NordineLotfi Just ignore Python 2. People still using it will not adopt any new packages.
 
3:38 PM
I imagine that most Python 2 users are working on embedded systems at the bottom of the Mariana Trench, or on the dark side of the moon. Hard to access Pypi in those circumstances
 
@MisterMiyagi I would love to do that, but some stuff I want to make use of only support older Python version. If you look at the link I posted above, I'm trying to make a LibreOffice/OpenOffice wrapper, but since OpenOffice has an older Python version, it's a bit hard to do so (but still possible)
 
If they can adopt a new package, they can upgrade to Python 3, ipso facto
 
I guess If I knew their internals enough, I could port their stuff to py3, but that's much harder than using subprocess and writing to temp files
 
I'm curious why they haven't ported already
 
I could give a lot of possible reasons, but I wouldn't know the right one. For OpenOffice at least, I know it's because of internal struggle (based on some forums post on their website) inside their dev team and organization.
some people quit, this one did X, etc, etc
it took me three days to know that to make use of the same python API both OpenOffice and LibreOffice support (pyuno/uno) I only had to use a single - on their server flags, instead of --
 
3:43 PM
Hello all! Broad question: what do I have to google - where can I find information to do this as a newbie? Issue: Imagine you have like 100 different CSV files, which contain similar information, but in different forms. So the columns of the CSV have different names, even though the content may be same. For example: CSV 1: column named: Color, CSV2: column named: shade.
Now the task is to merge this 100 CSVs into a huge, normalized and unified csv. So I have a template with column names and have to merge these 100 CSVs into one big, templated CSV. How can I do this? I'm a real noob with python and I have to do this for work. RIP
 
RIP indeed :D
 
Glad you like it. :) There are some great musicians in Japan, but I often find that while they are technically good, they don't quite capture the spirit. So I was very pleased to discover that the Japanese blues community somehow manage to capture the spirit of the blues, albeit with a Japanese flavour.
 
Try googling: "How to do my job" xD
 
Python can read and write CSV files but there's no easy way to smartly convert "Color" to "shade" without human intervention
 
There is csv as kevin says, but mostly people use pandas for all csv related stuff, it's really powerful
 
3:47 PM
If you manually go through all 100 CSVs and comprehensively find all the existing synonyms for "Color", then you can stick them in a big dictionary and use them during normalization/unification
 
I mean if the columns occur in the same order every time, I don't see why it can't be done automatically

Even if not, mapping the names once manually doesn't seem as bad
 
Here are a couple of American blues women. Ally Venable with Danielle Nicole, Going Down.
 
I admittedly went in with pretty low expectations and was blown away by the level of "chops". I think they did a great job capturing the right energy.
 
@PeterT pretty much the only options there are right
 
Sep 27, 2021 at 17:19, by PM 2Ring
Japanese guitar teacher, Maki Shizusawa, playing a little bit of blues, while wearing a kimono: https://youtu.be/33J15nBXVXw Some more blues from Maki, this time in Western clothing: https://youtu.be/33J15nBXVXw
Oops. Both those links are the same.
 
3:53 PM
Oooo this is cool timestamp
 
I think the one in western clothing might be this: youtube.com/…
this link also start with a 3, so I guess it's easy to confuse it with the other one you posted (which start with 33)
 
The one I meant was youtu.be/2Xsz3EvKBDY
 
ah, got you
 
I promise I'm not crazy when I say the following:
Have you ever heard John Mayer play the blues. https://relisten.net/john-mayer/2004/12/29/shake-rattle-and-roll?source=188230
 
I always find it interesting how Japanese artist split their music on multiple channels. I guess this is because of their record labels and whatnot. (only talking about the official ones at least, not reupload channels)
 
3:59 PM
@Kevin Science infrastructure still has a lot of Python 2 automation. No reliable test suite to perform open heart dentistry on the patient...
 
I've been digging around to see if I can find the LibreOffice source code and see how hard it would be to upgrade it to Python 3... No luck yet, although I did find a curious quote: "the latest version of LibreOffice comes with Python 3.3, so the use of Python 3.3 is advised for durability." This document is from 2015. So why is Nordine stuck on 2.7?
 
I paused concurrently on "open heart dentistry". Didn't this was a reference/tv trope
 
How can I force a closure over a variable in lambda? I'm making command buttons in a loop and it only uses the last value of the variable. I recall some trick with default value of argument, but when I do that the command just freezes the script.
 
@Kevin I meant what I said earlier for OpenOffice :) I already know LibreOffice is at 3.X
 
@matszwecja Perhaps you're thinking of command = lambda x=x: do_thing(x)
 
4:01 PM
they use the same API though, just on different python version, pyuno/uno
 
I see.
 
@Kevin Yeah, I was thinking about that, but doing that freezes the script to the point that even Ctrl+C does not kill it
 
@matszwecja Well, If you can provide an MCVE, I'll be happy to investigate further
 
also if you want to test/see the python stuff on LibreOffice/OpenOffice, they have a public repo I think, but I don't know where it is, however, you can get access to both by installing either using the additional installation options
I think I'll make a dailymotion video because it's confusing to explain how the installation UI is laid out
 
@0x263A Danielle's from Kansas City, Missouri. That venue, Knuckleheads, is her old stomping ground. There's a bunch of YouTube clips of her playing there with her old buddy, Samantha Fish, when they were both very young. Sam was dating Danielle's brother Nick Schnebelen, who's also an impressive guitarist.
 
4:04 PM
LibreOffice keeps its source code in something called "gerrit" and I can't be bothered to learn to use it
OpenOffice's source appears to be at github.com/apache/openoffice. Not yet clear to me whether "pyuno" can be found within
 
yeah, but if you use the additional installation options I mentioned, you can see their python path under Libre/OpenOffice/program. There a dist folder and two python executable under there IIRC
@Kevin I believe it's maybe separate/on another repo, but I didn't find it yet :/
or maybe on another branch
(Libre/OpenOffice -> program since the slash are confusing I think)
 
yeah...
 
wiki.openoffice.org/wiki/Python#Python_and_OpenOffice suggests using the "COM Bridge" if you want to talk to OpenOffice using Python 3. I don't know what that means, but I'm pleased that they are aware that people want a workaround
Beats sticking one's head in the sand
 
I think I saw it mentioned too. I think it's really confusing however, since there no example/details about it (also I think this is for VBscript instead, but I could be wrong, see wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/…)
 
4:12 PM
Ally Venable is from Texas. Here's another talented singer / songwriter from the South, Hannah Wicklund, from South Carolina, who plays both guitar & keyboards. Mama Said
 
Technically I could go the long way, and use VBScript through Python, since I know there an existing module for doing that (or I guess I continue with subprocess and do that) but that feels weird for some reasons
 
If by COM they mean "Component Object Model", then it should be accessible from a wide variety of programming languages. And it's confusing to use in all of them :-P
 
Nice, but also, :/
 
forum.openoffice.org/en/forum/… has some snippets that use COM from Python, with no VBScript required. Granted, the snippets are in the context of "why isn't my code working?", but it's a start
 
looks nice yeah :o Thanks, didn't find this when I looked on the forum
ah, but this isn't crossplatform...that's also why I'm making this wrapper, so I can use this on Linux and Windows
 
4:21 PM
Thanks guys, I think I'll take quitting as possible solution :D
 
@Kevin for OpenOffice: Install, -> Installation Wizard -> OpenOffice Program Modules -> "This feature and all sub features will be installed on local hard drives", Optional Component -> "This feature and all sub features will be installed on local hard drives", Next, Next...
it's somewhat similar for LibreOffice
LibreOffice -> Optional Component -> "This feature and all sub-features will be installed on local hard drives". That's it, don't do that for the User Interface Languages though, since it'll install languages you probably don't want (it auto select English by default anyway)
 
 
1 hour later…
5:57 PM
there are other shenanigans to make this all work...I guess I'll document this in a gist if anyone is curious (probably not, but hey, you never know...)
 

« first day (4427 days earlier)      last day (528 days later) »