Thermopyle posted:According to the forums search, I've posted in the current incarnation of this thread 242 times! I meant I'm a newcomer! e: Other recommendations: Pendulum, the last datetime replacement you'll ever need: https://pendulum.eustace.io/docs/#introduction Take all that bloody boilerplate out of class creation with the excellent attrs library: https://www.attrs.org/en/stable/ NinpoEspiritoSanto fucked around with this message at 22:35 on Jan 1, 2019 |
|
# ? Jan 1, 2019 22:31 |
|
|
# ? May 15, 2024 01:19 |
|
Bundy posted:I meant I'm a newcomer! Oops!
|
# ? Jan 1, 2019 22:33 |
An excellent free book I didn't see in the OP, good for newcomers to programming and Python specifically and teaches lots of idiomatic approaches that are useful even for the seasoned: Think Python: http://greenteapress.com/wp/think-python-2e/
|
|
# ? Jan 1, 2019 22:36 |
|
Bundy posted:An excellent free book I didn't see in the OP, good for newcomers to programming and Python specifically and teaches lots of idiomatic approaches that are useful even for the seasoned: It's already there (search "Think Python"), but it links to the Python 2 version.
|
# ? Jan 1, 2019 23:34 |
|
Bundy posted:The Clean Architecture in Python (also a nice watch for anyone interested in FP approaches in Python): Thanks for this one!
|
# ? Jan 2, 2019 00:26 |
Thermopyle posted:It's already there (search "Think Python"), but it links to the Python 2 version. Doh missed it ah well my link is py3 at least! Hughmoris posted:Thanks for this one! No worries, that video inspired me to learn FP in python, it's really improved my work and I've some really nice hybrid apps that make use of classes and functions etc where appropriate.
|
|
# ? Jan 2, 2019 01:07 |
|
Bundy posted:
This looks really cool, cheers!
|
# ? Jan 3, 2019 18:00 |
|
Thermopyle posted:It's already there (search "Think Python"), but it links to the Python 2 version. the Python search experience
|
# ? Jan 3, 2019 18:45 |
|
I'm struggling horribly to get OpenCV running. On Windows 10, Python 3.7.0 and using PyCharm 2018.3.2 if it matters. This is the output of pip list code:
Either way, I get the following... code:
code:
Sad Panda fucked around with this message at 22:50 on Jan 3, 2019 |
# ? Jan 3, 2019 22:40 |
What does the following give you in your REPL?code:
|
|
# ? Jan 4, 2019 02:13 |
|
For someone coming from a SQL world, is there a quick guide to Python or Pandas somewhere for stuff like group by, order by, removing/adding/calculating columns? Maybe I'm asking for something extremely basic but it would be good to have a cheat sheet to quickly reference stuff I already do in SQL that I'd like to do in Python.
|
# ? Jan 4, 2019 09:35 |
Mark Larson posted:For someone coming from a SQL world, is there a quick guide to Python or Pandas somewhere for stuff like group by, order by, removing/adding/calculating columns? Maybe I'm asking for something extremely basic but it would be good to have a cheat sheet to quickly reference stuff I already do in SQL that I'd like to do in Python. https://pandas.pydata.org/pandas-docs/stable/comparison_with_sql.html
|
|
# ? Jan 4, 2019 10:02 |
|
Bundy posted:What does the following give you in your REPL? code:
I downloaded every 64 bit redistributable for Visual C++ and now have 2005, 2008, 2010, 2012, 2013, 2017 on the system. I then reinstalled opencv using pip and the same... code:
Sad Panda fucked around with this message at 10:48 on Jan 4, 2019 |
# ? Jan 4, 2019 10:33 |
|
Installing opencv is kind of a clusterfuck and I wouldn't really expect pip-ing it to work. From vague memories of the last time I did that, pip-ing it only installs the python wrapper, not opencv itself. cv2.pyd is the dll with the python wrapper. It implicitly links to all the actual opencv dlls. Probably one or more of those is missing or not locateable. Take dependency walker and open cv2.pyd with it. It will show you everything cv2.pyd tries to load, everything its immediate dependencies tries to load, etc... Every implicit load has to be satisfied or cv2.pyd will fail to load. Delay-loaded ones don't have to be satisfied (delay-load = the program tries to LoadLibrary() in some code path, which (A) may never actually be executed and (B) it can handle LoadLibrary() returning an error)
|
# ? Jan 5, 2019 06:35 |
|
If you use conda (instead of pip) then everything should just work, since anaconda will pull not only the python module but also the non-python dependencies built for your target platform. But this isn't the kind of thing where you can just install conda and then install opencv; if you're not already using anaconda then you basically are starting over from square 1, but that's okay because anaconda rules
|
# ? Jan 5, 2019 07:06 |
|
I successfully installed opencv with pip pretty recently for Python 3 on both Windows and Raspbian; you can't get the non-free extensions through pip (the package that claims to have those modules called something like opencv-contrib still exists the in repository but since a few versions ago in the opencv 3 branch it no longer contains the extra things it's supposed to). I absolutely understand it being a weird thing that that may or may not work but I don't think it's undoable, at least in the configurations I was using. IDK what VC runtimes I already had installed for whatever reason, maybe that was the difference.
|
# ? Jan 5, 2019 07:19 |
|
I have a newbie question. I guess it's more algorithmic than Python-specific but I do use Python. I'm uploading files to a REST API. I can't do anything with the files while they are being processed so I need to wait for them to be before I can move to the next action I need to do with them. I could just put a "sleep" I guess but I think it's ugly and dirty and won't cover edge cases. For now what I do is this: * Parse some directory with all the files * Upload them one by one to the API. Each API calls sends a response with some JSON object that I store in an array. * Now I want to iterate through that array and check for the status of each file. When the status changed from "processing" to "complete", do something and keep iterating until all the files' status is "complete." At first I wanted to remove the current entry from the array, but I don't think I can modify an array while I'm moving through it (especially from within a loop?). So I was thinking of creating another array and fill it with the completed JSON objects as they get completed. But that means I'd have to potentially loop through the array an unknown amount of times. I feel that this way of doing it (I'm not even sure I explain it right) is correct. What would be the best way to solve this little issue?
|
# ? Jan 7, 2019 13:27 |
|
Furism posted:I have a newbie question. I guess it's more algorithmic than Python-specific but I do use Python. Use a while loop and iterate through the array until it's empty by removing completed objects, you might still want to use a sleep or some kind of limiter so you aren't hammering the API though. Edit: I realized this doesn't answer some of the issues you're having. I'd use a manual index into the array, and then just check the boundary at the start of the while loop to see if you're past the end, reset to beginning of array and continue iterating through, once the array is empty you're done. I guess technically you'll skip some entries in your array when you remove an entry, so you could not increment your iterator whenever you remove an item if it's important to you that you check each item once in order. M. Night Skymall fucked around with this message at 13:46 on Jan 7, 2019 |
# ? Jan 7, 2019 13:39 |
|
What's a stable library for building a REST client? There seems to be dozens of contenders, most of them on v0.1, a lot with little or no documentation, several of which roll-their-own request / parsing libraries, which is insane. When I last looked at this a few years ago, there were a few generic frameworks you could build upon that provided argument encoding / decoding and auth and the usual common features.
|
# ? Jan 7, 2019 15:10 |
|
nonathlon posted:What's a stable library for building a REST client?
|
# ? Jan 7, 2019 16:11 |
|
Wait REST server or REST client? Isn't a client basically just an HTTP client (such as requests) or am I missing something?
|
# ? Jan 7, 2019 16:32 |
|
IAmKale posted:The de facto choice these days is still Django Rest Framework for Django. Aside from that you could use leaner alternatives like Flask or Falcon but in the end you just might end up writing a lot of functionality that comes out of the box with DRF. Is Django very much Industry Standard in people's experience? I've been learning Flask as my first real framework project but I don't know if I should bother doing things that way. I'm honestly not knowledgeable enough to say whether the flexibility in database type matters for my project yet. What would be more useful to learn if I want to apply for industry jobs in a few years?
|
# ? Jan 7, 2019 16:48 |
|
I've used Django exclusively up until 3 months ago when i finally had a project i thought flask wouks be perfect for. 2 weeks later i binned it and redid it in django This is just one mans opinion of course
|
# ? Jan 7, 2019 16:53 |
|
Business posted:Is Django very much Industry Standard in people's experience? I've been learning Flask as my first real framework project but I don't know if I should bother doing things that way. I'm honestly not knowledgeable enough to say whether the flexibility in database type matters for my project yet. What would be more useful to learn if I want to apply for industry jobs in a few years? The thing with most web frameworks is that they're very similar, and this holds for Flask and Django. There's two areas where they differ: 1. Where their documentation and community focuses. Flask documentation and community concentrates on smaller apps, whereas the Django documentation and community focuses on larger apps. 2. How "batteries included" they are. Flask basically handles routing urls to functions. Django includes a lot of other stuff like it's auto-generated admin site. Because web frameworks are all very similar it's completely possible to write a Django project that looks almost identical to a Flask project...a single file with some decorators on some functions. It's just that the documentation and the community is not focused on this use case so it's not until you become familiar with Django that you realize this is the case. All that being said, Django is likely a more job-worthy thing to learn, but I haven't done an analysis of job listings to confirm that. Of note, is that once you know Django, Flask is easy, but the other way around is not exactly the case. I like Flask because I know enough to know when a project will be too big for it so I don't choose it inappropriately. And by "too big" I mean, "have to use all those flask-* (which have a 50/50 chance of being not-poo poo) packages to add on functionality that comes out of the box with Django". (of course, that's not to say that some of the batteries-included stuff in Django isn't poo poo as well)
|
# ? Jan 7, 2019 17:07 |
|
Rastor posted:Wait REST server or REST client? Isn't a client basically just an HTTP client (such as requests) or am I missing something? Like I said, client. Sure, I could just use requests, but some syntactic sugar over the top would be a long way. And handling asynchronous requests.
|
# ? Jan 7, 2019 17:39 |
|
I'm trying to make an image viewer / sorter with tkinter and I'm having trouble with animated gifs. Is there a way to make it play nice with any random gif and if not what is the best alternative? I looked at Qt but it requires xcode (6 gb download) which seems a bit overkill for my application. My current implementation is based on this, which works for some but a lot of files turn out janky (apparently when they're large or optimized).
|
# ? Jan 7, 2019 17:54 |
|
nonathlon posted:Like I said, client. Sure, I could just use requests, but some syntactic sugar over the top would be a long way. And handling asynchronous requests. For asyncio I understand aiohttp is the hotness but I don't have personal experience with it. You might take a look at aiohttp-requests
|
# ? Jan 7, 2019 18:09 |
|
Some things included in Django, but not Flask: -Database/migrations -Authentication -Admin page -Email support -Serialization Most websites will use these, making Django a good default.
|
# ? Jan 7, 2019 18:16 |
Packt currently running a buy 4 get 1 free, buy 6 get 2 free, buy 10 get 5 free on ebooks/videos (which are all still 5bux a pop)nonathlon posted:Like I said, client. Sure, I could just use requests, but some syntactic sugar over the top would be a long way. And handling asynchronous requests. aiohttp for async. Not sure what "syntactic sugar" you're after, a REST client is literally a http client. e: Connexion + Flask is a really nice way to put together a REST API using Flask. https://realpython.com/flask-connexion-rest-api/ NinpoEspiritoSanto fucked around with this message at 19:17 on Jan 7, 2019 |
|
# ? Jan 7, 2019 19:12 |
|
Foxfire_ posted:Installing opencv is kind of a clusterfuck and I wouldn't really expect pip-ing it to work. From vague memories of the last time I did that, pip-ing it only installs the python wrapper, not opencv itself. Thank you! I tried Dependency Walker but it seems a bit out of date and gave a giant list. Googling got a suggestion of https://github.com/lucasg/Dependencies. That flagged up MFPlat.dll, MF.dll and MFReadWrite.dll. I suspect that they vanished when I was trying to make a minimal Windows installation. Found the right installer on the MS website and cv2 now imports.
|
# ? Jan 7, 2019 23:47 |
|
I have a simple list of items:Python code:
I can do: Python code:
code:
code:
|
# ? Jan 8, 2019 15:59 |
|
unpacked robinhood posted:I have a simple list of items: Kinda ugly but simple solution: Python code:
Python code:
TheFluff fucked around with this message at 16:25 on Jan 8, 2019 |
# ? Jan 8, 2019 16:23 |
I solved it like this:code:
code:
|
|
# ? Jan 8, 2019 16:27 |
|
Oh yes thanks TheFluff posted:
Gotta admit it's both concise and not unreadable, gonna keep that in the comments just in case
|
# ? Jan 8, 2019 16:50 |
|
I like the following because the code lines up with the intent: we've got a comparison function that considers zero greater than anything else, and we're gonna sort using that comparison.Python code:
|
# ? Jan 9, 2019 09:36 |
|
Out of wonder, in requirements and/or pipenv files, does ">=x.y.z" specify semver compatible or literally "any version later than this"? I see on the User Guide some examples like ">=1.0,<=2.0" so I'm guessing it's absolute version, not semver.
|
# ? Jan 9, 2019 22:53 |
|
Can someone give me a hand with this for loop? I'm trying to build a json object from a large query using only tag that I've specified. The loop seems to work correctly but the return is only giving me the last object that I found when I know there are at least three objects that have the tag I'm looking for. I'm thinking the update on stacks is overwriting the dict. Anyone know whats up with it?code:
|
# ? Jan 9, 2019 23:39 |
|
dict1.update(dict2) basically adds all the key/value pairs from dict2 into dict1. So it'll overwrite any keys that already exist Every stack you're adding has a "Stackname" key and a "Tags" one, so those values will just get overwritten each time. Sure you don't want a list of stack dicts? Or maybe a dictionary where each key is the name of a stack, and that maps to the actual stack dict, or something like that baka kaba fucked around with this message at 23:50 on Jan 9, 2019 |
# ? Jan 9, 2019 23:47 |
|
What's the best and most efficient way to deploy my Flask / MySQL API to a server nowadays? I basically just have a local MySQL server and Flask connecting to it with pymysql Keep in mind I am very much a front-end developer, so I'd like to be spoken to as if I'm a child. FWIW, I am definitely deploying with Linode if that makes a difference teen phone cutie fucked around with this message at 04:02 on Jan 10, 2019 |
# ? Jan 10, 2019 03:47 |
|
|
# ? May 15, 2024 01:19 |
|
Grump posted:What's the best and most efficient way to deploy my Flask / MySQL API to a server nowadays? I basically just have a local MySQL server and Flask connecting to it with pymysql I'd go with Docker. A quick google shows a bunch of tutorial-lookin' results for "docker flask mysql".
|
# ? Jan 10, 2019 15:29 |