|
Eela6 posted:if you want to know more, there are sections in 'Effective Python', and a speech by Brett Slatkkn, the author of that book, about this. you're talking about this talk i'm guessing? i liked it huhu posted:werkzeug.routing.BuildError: Could not build url for endpoint 'auth.login'. Did you mean 'login' instead? i haven't used flask in a while but i've had that exact error when using url_for - have you imported login into the auth module there? if you have the same structure as that post you linked but you're not importing login into the __init__, you probably want auth.view.login instead
|
# ¿ Mar 9, 2017 13:11 |
|
|
# ¿ Apr 29, 2024 15:06 |
|
condolences
|
# ¿ Mar 31, 2017 23:12 |
|
Tigren posted:3. So I don't capture lines that don't have one of those three allowed strings. echoing the dict suggestion above Python code:
|
# ¿ Apr 8, 2017 06:39 |
|
Boris Galerkin posted:I kinda like the second choice because it seems much easier and way more intuitive to be able to just do the first slide here is the quote i think of whenever metaclasses come to mind: http://www.vrplumber.com/programming/metaclasses.pdf as far as methodtypes goes, keep in mind functions have __name__ attributes too, so you can do stuff like: code:
|
# ¿ Apr 18, 2017 21:39 |
|
SurgicalOntologist posted:Huh. This is the first time in a while I've been surprised by Python. keep in mind what you're actually doing - assigning an object that exists outside the class to a value within the class: Python code:
|
# ¿ Apr 18, 2017 21:45 |
|
breaks posted:That is within the instance not the class. Functions in the class's namespace will work as methods (with maybe some exceptions if you really try to break it). yeah i meant instance since i wrote the post right before it as a way to bind to instances, d'oh. just adding the function to a class' namespace still won't bind it, though
|
# ¿ Apr 18, 2017 22:10 |
|
actually wait a minute, i'm an idiot apparently! edit: been entirely too long since i looked at descriptor protocol stuff and somehow thought the same magic was needed for classes, i have no idea why later edit: well, that was actually worth googling again, since you can just use the function's descriptors directly: Python code:
Dex fucked around with this message at 22:29 on Apr 18, 2017 |
# ¿ Apr 18, 2017 22:16 |
|
Boris Galerkin posted:What I want to do is have foo he defined per object the descriptor bit in my last edit is probably what you want if you need access to the instance(self), unless i've confused myself completely again? Python code:
output posted:foo Dex fucked around with this message at 00:31 on Apr 19, 2017 |
# ¿ Apr 19, 2017 00:28 |
|
shrike82 posted:Which is a roundabout way of saying that Boris was right with his initial solution. well i said he was directly right with my first reply, that last one is just using __get__ instead of methodtype syntax since it's new to me and reads a bit cleaner imo, since it just does that under the hood
|
# ¿ Apr 19, 2017 03:02 |
|
i was going to suggest looking at GLEW but it seems kivy already has it as a dependency:https://kivy.org/docs/installation/installation-windows.html posted:python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew have you installed all those packages already?
|
# ¿ Apr 20, 2017 16:49 |
|
Gene Hackman Fan posted:edit: I know I've heard other people having issues with this and added a line or two to the actual program to force... something, but it hasn't worked for me: seems to be a pretty common problem with windows 10 users: https://github.com/kivy/kivy/issues/3576 - this one is fixed by the multisampling config you posted, so it's not that https://github.com/kivy/kivy/issues/5071 - this one is pyinstaller specific https://buffered.com/support/solve-opengl-error/ - this is just some random app that uses kivy if you have the latest graphics drivers installed already, i'd say open an issue on kivy's github and see if they have anything helpful to add
|
# ¿ Apr 20, 2017 20:57 |
|
looks like the site you're trying to read might have been updated, then. "'NoneType' object is not iterable" there is telling you that "per36_line_2016" is None, which means the line: per36_line_2016 = soup.find("tr", id="per_minute.2016") isn't finding anything whereas you're expecting a list(or some kind of iterable, at least) of things.
|
# ¿ May 10, 2017 16:36 |
|
ButtWolf posted:Yeah this completely killed my project. Looking at other sites to grab from, but making the url list looks awful on ESPN. Thank for your help everyone. how often and where does this thing run? if js is populating the table you want, you could use selenium to open an actual browser window, and pass the .page_source to beautifulsoup: Python code:
|
# ¿ May 10, 2017 18:11 |
|
ButtWolf posted:I think I'm just gonna do it by hand... New method is above my skill level. Thanks. the thing i posted actually pops chrome up in front of you, opens that page, copies the page source to the html var, then closes the window - there's nothing too complicated at work there, even if it looks brand new and insane. just read the selenium install docs, you need to drop the geckodriver executable somewhere on your path so your script knows how to actually talk to chrome
|
# ¿ May 10, 2017 18:18 |
|
Hughmoris posted:For those that work with Excel, what Python library do you use? i don't do anything complicated with excel but openpyxl suits me fine
|
# ¿ May 31, 2017 22:28 |
|
sugar free jazz posted:New to programming and python, and I made my first thing! Used Selenium to automate going into LexisNexis, then download all of the newspaper articles published that day from a few major newspapers that mention a couple different countries! It's janky, it's messy, but it actually does the thing I want it to which freaking owns. My low point was where I couldn't figure out how to deal with a few different frames on a page, and for a bit my workaround was send_keys((Keys.TAB * 57) + Keys.ENTER) to navigate to a button and click it yeeeesh. I feel like a lil kid and I wanna print it out and stick it on my refrigerator congrats. selenium can be finicky depending on the sites you're dealing with, so having hacks like tabbing to the thing and sending ENTER isn't that weird tbh. in some cases it's significantly faster than searching multiple xpaths or whatever, just make sure you're raising some kind of sensible error if the thing breaks at that point!
|
# ¿ Jun 2, 2017 13:29 |
|
it's expecting you to use the compose file - the redis container's address would then be resolved as 'redis', since that's its name, in this bit:quote:redis.exceptions.ConnectionError: Error -5 connecting to redis:6379. No address associated with hostname.
|
# ¿ Jun 3, 2017 19:04 |
|
hooah posted:The Dockerfile includes a command to install redis 2.10.5. I also installed the latest version on my local, and got the same result. actually that command(https://github.com/jleetutorial/dockerapp/blob/master/Dockerfile#L2) is installing the python redis client, not a redis server quote:Sorry, the "compose file"? What's that? this thing: https://github.com/jleetutorial/dockerapp/blob/master/docker-compose.yml docker-compose lets you orchestrate multiple containers spinning up, and it handles linking them automatically. when you link containers in docker, you can resolve them by container name. see here: https://docs.docker.com/compose/install/#install-using-pip basically, instead of running that app locally or building that dockerfile directly, you should be running "docker-compose up" in that repo. this would then start up the flask app and a redis server for it to talk to so, the actual error message you're encountering is that the flask app is searching for redis:6379. 'redis' there is a hostname, specifically in this case the hostname of a separate container running a redis server. the application and dockerfile are both written with the expectation that the hostname 'redis' will resolve to a an address where a redis server is running(https://github.com/jleetutorial/dockerapp/blob/master/app/app.py#L6) - this is why trying to run it locally will get you nowhere unless you add 'redis' to your hosts file, or change the code to point to localhost or something docker-compose is written in python so i suppose it's technically relevant to this thread, but probably not. is there a docker thread anywhere? edit: note i haven't actually pulled down that repo to try it since i'm on my windows laptop so this is all guesswork. i have worked with docker a fair bit though Dex fucked around with this message at 20:41 on Jun 3, 2017 |
# ¿ Jun 3, 2017 20:36 |
|
Dominoes posted:Loch - I've no idea why the Anaconda-specific commands aren't working. were you trying to replace the system python version, because you really don't ever want to do that. building from source with configure, make and make altinstall then using python3.6/pip3.6 works fine for me on centos7. literally did this today as part of an automated setup for a vm i need to do stuff on
|
# ¿ Jun 6, 2017 12:24 |
|
i'm a windows 7 holdout on my work laptop for reasons, does the windows subsystem for linux fix all those annoying things like not being able to run gunicorn because windows doesn't have fcntl and so on?
|
# ¿ Jun 6, 2017 12:40 |
|
LochNessMonster posted:Not sure if I should call them variables, they're more like connections/handlers right? that syntax is just working with tuples. if you return multiple things like that, you can either catch them all in a tuple or assign them directly to variables code:
|
# ¿ Jun 7, 2017 17:47 |
|
funny Star Wars parody posted:Lol if u have to think about the 64th decimal place in your code just lol lmao if you don't understand every abstraction layer right down to how the rock we shoot lightning into to do numbers does stuff
|
# ¿ Jun 11, 2017 04:12 |
|
nobody mentioned web apps
|
# ¿ Jun 11, 2017 16:58 |
|
|
# ¿ Apr 29, 2024 15:06 |
|
KernelSlanders posted:the guy who thinks theres something wrong with needing to know arcane implementation details. i was making a joke about the guy psyducking at a beginner who asked a question about how numbers work. i am positively thrilled about your non-web-dev coding challenges and wish you well
|
# ¿ Jun 11, 2017 21:36 |