|
Bluuuuuuggggggh. Trying to submit some stuff via webform automatically using Mechanize, except whoever made the site was a loving moron and gave a particular textarea two name and two ID tags. Hence, mechanize only ever saves the second one (which is the wrong one), but browsers pass through the first name (the right one).
|
# ? Nov 18, 2012 08:58 |
|
|
# ? May 9, 2024 11:14 |
|
Pudgygiant posted:Ok, this is the ugly rear end amateur hour script I have after switching to Yahoo finance. So much easier to pull down a csv than it is to scrape. You might not care about this, but that Yahoo API is not public, and using it is against the ToS.
|
# ? Nov 18, 2012 11:01 |
|
Has anyone used smtplib to send email to a Gmail account? I'm doing it the way described here and for some reason Gmail chooses to display the text version while my Outlook based email displays the HTML version. However if I use code like this of course the HTML version is shown because there is no alternative. Unfortunately, I've not been able to figure out what I need to do to make Gmail display the HTML version when using the two-part technique. Has anyone done this before?
|
# ? Nov 18, 2012 18:42 |
|
My Rhythmic Crotch posted:Unfortunately, I've not been able to figure out what I need to do to make Gmail display the HTML version when using the two-part technique. Has anyone done this before? I haven't done it in a while, but I might be able to help. Tried the example code, and it works for me; can you use the 'show original' option in Gmail's dropdown menu and pastebin the email source so I can see exactly what's being sent?
|
# ? Nov 19, 2012 14:13 |
|
Sure, here ya go: http://pastebin.com/VRrvAwgJ Edit, my templates were hosed up there, here is an example where I've used the correct templates to generate the text and html versions. It produces the same behavior. http://pastebin.com/F0Y24ekf My Rhythmic Crotch fucked around with this message at 14:29 on Nov 19, 2012 |
# ? Nov 19, 2012 14:23 |
|
Switch the order of the parts. # According to RFC 2046, the last part of a multipart message, in this case # the HTML message, is best and preferred. (Also, you've got "</html>" where you mean "<body>", but gmail is ignoring that anyway)
|
# ? Nov 19, 2012 14:33 |
|
Yeah, the RFC says use the last alternative to display, and google follows it strictly. A ton of mail clients just use the most-probably-wanted part based on MIME type which is mostly assumed to be HTML unless you've intentionally toggled HTML off, so people that don't actually know the RFC (most people) just assume it works that way by default and a lot of references/tutorials on creating and sending emails have that error.
|
# ? Nov 19, 2012 14:47 |
|
Oh wow, well that was easy. Thank you both kindly
|
# ? Nov 19, 2012 15:12 |
|
Oh my loving god. Python/mysql on a mac. I'm going to smash my god drat head in with a hammer. APPLE INCLUDE THIS GODFORSAKEN loving MODULE IN YOUR PYTHON PLEASE? 4 hours of compilers crashing and poo poo breaking later, I just want to punch people in the head! I'm running some code thats generating about half a million records from astronomical data, and sqlite3 just has its arse hanging out (When I run it through qcachegrind, its getting grotsequely bogged down at sqlite3 commit, so its time for a real database..... *record goes scratching off side of record* Has someone, like, made a downloadable DMG that just installs this loving thing instead of forcing me to cycle through about 50 different long rear end tutorials on installing this poo poo , each of which doesnt work for different reasons to the previous one? "ERROR: CLANG? Balls to that , fucker!" "ERROR: You installed mysql with brew. INITIATING LAUNCH SEQUENCE" "ERROR: You look like your about to succeed? LETS CRASH FOR NO REASON" duck monster fucked around with this message at 15:58 on Nov 19, 2012 |
# ? Nov 19, 2012 15:53 |
|
DMGs are available here: http://www.mysql.com/downloads/mysql/ I have yet to try it, but it's reported working even with Lion
|
# ? Nov 19, 2012 16:27 |
|
My Rhythmic Crotch posted:DMGs are available here: http://www.mysql.com/downloads/mysql/ Yeah, I installed that, but I'm damned if I can get that version working with python at all. I'm modifying setup_posix.py as I'm supposed to to;- mysql_config.path = "/usr/local/mysql/bin/mysql_config" But yeah;- quote:ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib Basically: gently caress this poo poo.
|
# ? Nov 19, 2012 17:07 |
|
Have you considered using MySQL's pure-python connector?
|
# ? Nov 19, 2012 17:11 |
|
Civil Twilight posted:Have you considered using MySQL's pure-python connector? I dont feel particularly inclined to attempt rewriting django. Even with the hack to try and fool django into using it as a drop in, its subtly incompatible enough not to be compatible at all.
|
# ? Nov 19, 2012 17:21 |
|
Oh you're trying to host Django on a Mac? Yeah, I can feel your pain. I'm doing the same thing and I've stuck with sqlite and will continue to do so until I deploy onto Linux hosting.
|
# ? Nov 19, 2012 17:50 |
|
My Rhythmic Crotch posted:Oh you're trying to host Django on a Mac? Yeah, I can feel your pain. I'm doing the same thing and I've stuck with sqlite and will continue to do so until I deploy onto Linux hosting. Normally I use sqlite, but I have a loving massive dataset I'm working with and it just breaks sqlite. e: Ah gently caress, and postgres is even slower Maybe I need to bite the bullet and parallelize this :/ e2: Scratch that. Significantly faster. duck monster fucked around with this message at 19:02 on Nov 19, 2012 |
# ? Nov 19, 2012 18:54 |
|
duck monster posted:Normally I use sqlite, but I have a loving massive dataset I'm working with and it just breaks sqlite. I was about to suggest you try and use postgres instead
|
# ? Nov 19, 2012 19:05 |
|
Does anyone with Flask experience know whether it's possible to add sub-folders to the /static/ folder for organization? I created /static/css/test.css and Flask's dev server returns a 404 when I try to access it. Any file at the top level of /static/ works fine though. From the reading I've done, static assets should be served by nginx or Apache or whatever in production (rightly so), but it would make life a whole lot easier during development if the dev server supported that also.
|
# ? Nov 19, 2012 19:13 |
|
geera posted:Does anyone with Flask experience know whether it's possible to add sub-folders to the /static/ folder for organization? It is. It's a little paranoid about URLs for security reasons, though, so you might want to check the precise paths you're using: http://127.0.0.1:5000/static/blah/test.txt will work, while http://127.0.0.1:5000/static//blah/test.txt will return 404.
|
# ? Nov 19, 2012 19:43 |
|
I'm in the process of learning python, and I'm having trouble with array slice syntax. So foo[1:4] will return indices 1-3, which is really counter-intuitive to me. What's the reasoning for the second number being the first index not included instead of the last index that is? The latter seems more logical to me, but I'm sure there are things I haven't taken into consideration about why that would be a bad idea.
|
# ? Nov 20, 2012 02:20 |
|
stubblyhead posted:I'm in the process of learning python, and I'm having trouble with array slice syntax. So foo[1:4] will return indices 1-3, which is really counter-intuitive to me. What's the reasoning for the second number being the first index not included instead of the last index that is? The latter seems more logical to me, but I'm sure there are things I haven't taken into consideration about why that would be a bad idea. This is one of those things that constantly frustrates the poo poo out of people who regularly switch between Ruby and Python for different projects.
|
# ? Nov 20, 2012 04:42 |
|
stubblyhead posted:I'm in the process of learning python, and I'm having trouble with array slice syntax. So foo[1:4] will return indices 1-3, which is really counter-intuitive to me. What's the reasoning for the second number being the first index not included instead of the last index that is? The latter seems more logical to me, but I'm sure there are things I haven't taken into consideration about why that would be a bad idea. The length of the set returned is the difference between the two numbers, to make math easier, and for other reasons. So that means we either exclude the first number, or the last number. At this point, it's more nitpicky, but the common reasoning is that getting the first three elements should be foo[0:3], not foo[-1:2].
|
# ? Nov 20, 2012 06:00 |
|
Misogynist posted:This is one of those things that constantly frustrates the poo poo out of people who regularly switch between Ruby and Python for different projects. It really, really does. The difference between Python and Ruby list slicing syntax is the single most annoying thing about using both languages for me.
|
# ? Nov 20, 2012 07:08 |
|
It means that foo[0:3] + foo[3:8] = foo[0:8].
|
# ? Nov 20, 2012 07:11 |
|
So I'm using pyglet and I want to draw a bar graph based on some arbitrary data. Is the best approach to this to try and learn a bunch of opengl and draw primitives or would it matter if I hacked it together using sprites? The pyglet docs seem to assume you already know opengl so making simple lines and such are not the easiest thing, not to mention they seem to suffer somehow since even a simple square flickers like mad compared to say, the primitives in pygame. EDIT: Or if someone can point me to a good tutorial on basic opengl stuff that would help too, I'm mostly looking to stay in 2D land so I don't how much it matters. Sylink fucked around with this message at 15:25 on Nov 20, 2012 |
# ? Nov 20, 2012 15:23 |
|
Civil Twilight posted:It really, really does. The difference between Python and Ruby list slicing syntax is the single most annoying thing about using both languages for me. Oh weird, Ruby is inclusive. I guess it's at least a nice mnemonic that they use a[i..j] syntax instead of a[i:j], so it's kind of like Bash both in syntax and semantics.
|
# ? Nov 20, 2012 15:29 |
|
Sylink posted:So I'm using pyglet and I want to draw a bar graph based on some arbitrary data. Is there a good reason why you're trying to use a sledgehammer to pound in a screw? Why not use matplotlib?
|
# ? Nov 20, 2012 17:14 |
|
Lysidas posted:Is there a good reason why you're trying to use a sledgehammer to pound in a screw? Why not use matplotlib? Or if you are attached to the idea of plotting with OpenGL for whatever reason (maybe interactivity or something) you could use something like Visvis, Veusz or Chaco (not actually all OpenGL, some of them are Qt or something) which can do much prettier and more interactive plots than matplotlib. I actually can't stand matplotlib and would rather use the R plotting functions through Rpy2 than use it, I just had a bunch of bad experiences trying to make it work.
|
# ? Nov 20, 2012 17:44 |
|
I want interactivity and responsiveness. There are plenty of Python libraries that will generate really nice graphic images but I want something running off live data. And I got some opengl stuff working but the way pyglet makes you do it is very weird and if you call it directly its harder to use the buffers to draw tons of primitives at once. It can probably be done anyway but the documentation is so poor I can't tell.
|
# ? Nov 20, 2012 17:56 |
|
I found chaco to be a little weird at first but way more powerful than matplotlib in the end. Great for live data. I actually started a project a while back using chaco to draw networkx graphs and ended up installing the whole enthought distribution (which chaco is a part of) and making everything with enable and canvas. Enable has a PDF vector drawing system which when paired with its canvas module lets you easily make draggable, zoomable, arbitrarily large interactive 2D spaces. The only downside is that the documentation is a bit lacking so plan to spend a bunch of time poking around their examples and source code. I had exactly zero GUI experience and once I figured the system out it became ridiculously easy to work with.
|
# ? Nov 20, 2012 19:01 |
|
I have found NodeBox and Python to produce some really nice-looking visuals. Go to the "Twitter is the new shampoo" on this page
|
# ? Nov 20, 2012 20:49 |
|
Son of a bitch. That looks good.
|
# ? Nov 20, 2012 20:54 |
|
duck monster posted:Normally I use sqlite, but I have a loving massive dataset I'm working with and it just breaks sqlite. If you are willing to go non-relational mongo has a really nice python library.
|
# ? Nov 20, 2012 22:48 |
|
Dren posted:If you are willing to go non-relational mongo has a really nice python library. NoSQL is cargo-cult technology. Postgres is working fine
|
# ? Nov 22, 2012 16:40 |
|
I've exhausted my extremely limited Python knowledge attempting to troubleshoot this thing, so I'll bring it before the masters. When I run the game I get a 'global name "colormatch" is not defined' error in the handle_collide function in the Balloons class. If anyone could identify what the issue is I'd love it. I didn't want to fill up an entire page with code, so I pasted it to a pastebin. http://pastebin.com/G6JyRZ48
|
# ? Nov 23, 2012 07:06 |
|
It's just because you're not actually declaring colormatch before you're using it, as global variable just tells the interpreter that the variable is global without actually creating it. You shouldn't need to mark anything as global in your Balloons class either (unless you're creating the variable in that class), once the interpreter knows a variable is global it's usable everywhere: Python code:
vvv and like Jewel said, globals aren't really used that often as it's easier and less error-prone to just pass the variables directly into your class, and create classes to hold methods that require shared data. In your code, most of your methods like display_balloons, load_image etc. would be better placed in a MyGame class that keeps track of everything, and your globals in Balloons should actually be part of the Balloons class. The Gripper fucked around with this message at 07:27 on Nov 23, 2012 |
# ? Nov 23, 2012 07:18 |
|
I just woke up so I'm not in a state to actually fix your code, but I'm wary about your use of globals regardless. I don't think I've ever needed globals in python, because it's just so easy to pass things through the code?
|
# ? Nov 23, 2012 07:21 |
|
Jewel posted:I just woke up so I'm not in a state to actually fix your code, but I'm wary about your use of globals regardless. I don't think I've ever needed globals in python, because it's just so easy to pass things through the code? I'm doing Cousera's Interactive Introduction to Interactive Programming in Python and it's really weirding me out by how much they use globals there. http://www.codeskulptor.org/#examples-blackjack_template.py
|
# ? Nov 23, 2012 15:59 |
|
I didn't expect a reply so fast! After reading your posts I managed to fix it. Honestly, this is actually for an Intro to Game Design class so I was following a set of instructions that weren't too well written. Starting to question the validity of this class as time goes on judging from the PDF tutorials we are given. Edit - I'm dumb. I forgot the balloons are supposed to go up a line when they're unblocked. Salsa McManus fucked around with this message at 22:50 on Nov 23, 2012 |
# ? Nov 23, 2012 20:10 |
|
Symbolic Butt posted:I'm doing Cousera's Interactive Introduction to Interactive Programming in Python and it's really weirding me out by how much they use globals there. http://www.codeskulptor.org/#examples-blackjack_template.py Most of the things at the top are static data, which is fine as globals because it's not going to change. Also, people will hate on you for globals, but sometimes (like when you're writing an isolated 100 line script) it's not a big deal. The stuff at the bottom I suppose should be inside an if __name__ == "__main__": block, but I can understand why they left that out in an introduction because honestly that is a seriously weird convention.
|
# ? Nov 23, 2012 21:16 |
|
|
# ? May 9, 2024 11:14 |
|
Is there a thin database abstraction layer for Python that basically just takes user-supplied connection strings using whatever database driver a user feels like without having to do a bunch of manual legwork to import and instantiate some arbitrary class name in my own code? I don't want an ORM.
|
# ? Nov 28, 2012 05:14 |