|
chemosh6969 posted:I'm guessing xml.dom isn't installed or it's not on the path, since it's giving an import error. Yea, seems to be fine since switching into linux. Windows sucks :|
|
# ? Nov 30, 2008 01:04 |
|
|
# ? May 24, 2024 01:27 |
|
It looks like you're importing your own version of xml.dom.minidom, instead of the one packaged with Python. Your version is attempting to import PyExpat, which is not packaged with Google Appengine. You could try removing your xml/dom/minidom.py file and its parent directories. Google may have implemented their own DOM library that does not depend on a C DLL.
|
# ? Nov 30, 2008 02:21 |
|
Milde posted:Unicode isn't an encoding, it's a more general standard that specifies many different encodings, character sets, collations, etc. Your database is returning a latin-1-encoded string, not a UTF-8 string. You should check to see if your database's charset is set to UTF-8, and that you're instantiating your MySQLdb connection with charset='utf-8' and use_unicode=True as part of the arguments (to MySQLdb.connect()).
|
# ? Nov 30, 2008 21:13 |
|
I've been googling for a little less than an hour for a Python module that can parse functions and evaluate them. I haven't found anything like that, and I'm looking for something that can handle multiple (at least two) variables. Ideally I could prompt for keyboard input, they could type in "4(x^2)*y + x*sin(y)" and I would get an object that I could cause to evaluate at given values, like: code:
|
# ? Nov 30, 2008 21:29 |
|
MononcQc posted:I have tried both of these things before and it still doesn't work. I don't know, I think I'll just give up using utf8 for a collation/charset and go back to latin-1 databases, columns and tables. I just don't see the benefits after losing so much time for no reason. Did you convert all of the data in the database from latin-1 to utf-8? Since querying the database still returns latin-1 strings, I'd say that's the most likely cause of your problem. http://yoonkit.blogspot.com/2006/03/mysql-charset-from-latin1-to-utf8.html details how to do the conversion.
|
# ? Nov 30, 2008 21:51 |
|
kaschei posted:I've been googling for a little less than an hour for a Python module that can parse functions and evaluate them. I haven't found anything like that, and I'm looking for something that can handle multiple (at least two) variables.
|
# ? Nov 30, 2008 23:42 |
|
Habnabit posted:Did you convert all of the data in the database from latin-1 to utf-8? Since querying the database still returns latin-1 strings, I'd say that's the most likely cause of your problem. No, in fact the old latin-1 entries come out right, the new utf-8 ones are those that get messed up. I did the thing in that post (converting the database, table, each column). Next thing I'll try will be to just start with a new database right in utf8, as I figure the problem must be what I did rather than the language.
|
# ? Nov 30, 2008 23:52 |
|
kaschei posted:I've been googling for a little less than an hour for a Python module that can parse functions and evaluate them. I haven't found anything like that, and I'm looking for something that can handle multiple (at least two) variables. if you consider it safe to do a raw eval() you could use SymPy
|
# ? Dec 1, 2008 08:56 |
|
I was looking at GUI programming with Python, but I figured I'd just ask here instead of wading around the internet trying to find an answer: Do any of the Python GUI doohickies work in the same way the visual programming languages work, like VB.net and C#? As in, you can just drag and drop GUI components and then put your code in behind the scenes, as it were?
|
# ? Dec 3, 2008 17:08 |
|
Centipeed posted:I was looking at GUI programming with Python, but I figured I'd just ask here instead of wading around the internet trying to find an answer: Do any of the Python GUI doohickies work in the same way the visual programming languages work, like VB.net and C#? As in, you can just drag and drop GUI components and then put your code in behind the scenes, as it were? None that I know of. Both GTK+ and Qt have drag-and-drop interface designers, but rather than generate code they create UI definition files which the programmer loads explicitly (if you've ever used Interface Builder on a Mac, same idea). Gtk+ has Glade (win32 installer): Click here for the full 1024x768 image. Qt has Qt Designer: Click here for the full 1413x996 image. Either way you'll need to install the associated Python support, with PyGTK / PyGlade or PyQt
|
# ? Dec 3, 2008 18:29 |
|
I'm facing a decision in a script I'm working on and would appreciate any insight or comments. I'm turning raw bayer sensor data from an image acquisition system into basic DNG files suitable to be run through dcraw. I want to use disk space efficiently as these files will be archived for years and can take up an enormous amount of room. To do this, I want the pixel values stored in their native bit depth. I'm doing this all already, but repacking the data in 12-bits using my current method takes way too much time. I have to do a lot of bit masking and shifting to repack the data. Right now my test code operates on an array.array of bytes. Fundamentally, I'm rearranging things on a nibble level, which is why I'm masking and shifting bytes. Maybe there is an efficient way of dealing with 4-bit values? I couldn't really find anything, so here are the options I can see:
Examples of operations I'm doing: repacking 12-bit packed data into the expected order: code:
code:
|
# ? Dec 4, 2008 00:39 |
|
If you're packing these just for disk space storage, why not just run them through gzip?
|
# ? Dec 4, 2008 01:03 |
|
JoeNotCharles posted:If you're packing these just for disk space storage, why not just run them through gzip? The DNG format supports transparent lossless compression internally. It approaches file size I get when I properly pack the bits, but I can apply it on top of the properly packed bits for another 5-10% compression.
|
# ? Dec 4, 2008 01:48 |
|
performing a whole bunch of bitwise operations in a performance-critical loop is p. much the perfect example of when not to use Python. Use numpy, or if it doesn't have the appropriate operations / is still too slow then C.
|
# ? Dec 4, 2008 01:53 |
|
Python 3.0 released, according to Slashdot!
|
# ? Dec 4, 2008 20:03 |
|
Kire posted:Python 3.0 released, according to Slashdot! There is a Ptyon 3.0 thread already.
|
# ? Dec 4, 2008 20:10 |
|
Most likely there is a much easier way of doing what I want to do, but here goes. I want to put the contents of string.punctuation: code:
|
# ? Dec 4, 2008 20:19 |
|
Plastic Snake posted:Most likely there is a much easier way of doing what I want to do, but here goes. code:
|
# ? Dec 4, 2008 20:30 |
|
Why yes, yes it would. I was aiming for being able to just use string.punctuation instead of the actual string, but that was just because i didn't realize list() even existed. I'm just starting to learn Python so I've still got a long ways to go. Thanks for the help!
|
# ? Dec 4, 2008 20:35 |
|
Plastic Snake posted:Why yes, yes it would. I was aiming for being able to just use string.punctuation instead of the actual string, but that was just because i didn't realize list() even existed. I'm just starting to learn Python so I've still got a long ways to go. Thanks for the help! list(string.punctuation)
|
# ? Dec 4, 2008 21:00 |
|
Call me stupid, but why do you need it explicitly turned into a list given that strings already support indexing, slicing and iteration? (If you didn't know that -- well, they do )
|
# ? Dec 4, 2008 21:47 |
|
bitprophet posted:Call me stupid, but why do you need it explicitly turned into a list given that strings already support indexing, slicing and iteration? (If you didn't know that -- well, they do ) Even better! I've literally only been at this for maybe a week now, but I've tried to learn python a couple times before this. All the concepts and such are finally starting to click at a fairly decent pace, but I've just gotta dive in and do lots more of it to improve.
|
# ? Dec 4, 2008 23:50 |
|
I'm making a web app in Google App Engine and I'm not having much luck serializing a Model object into a JSON string. I'm using the simplejson library (it's what Google uses in their example code) and if I try to use the dumps() method on my Model object I get this error: code:
I did some search online and came across this: http://stackoverflow.com/questions/212125/turning-a-gqlquery-result-set-into-a-python-dictionary I'm doing exactly that in my own python code, but dumps() doesn't seem to be giving me back valid JSON. If my model looks like this: code:
code:
code:
I manually tested this JSON string, which does get parsed into my java script: code:
* I need to manually enclose the entire JSON string with square brackets. * I need to change my pagesJSON object to be more like an array instead of a dict/hash, so it just has a raw list of page objects inside it, instead of each page object being a key. That seems stupid though. There has to be a better solution here. And just so I don't leave anything out, here is my html javascript code for parsing the JSON (I'm using the yahoo user interface library). I got this code from the YUI site and barely changed it at all: code:
|
# ? Dec 6, 2008 04:40 |
|
my post was probably too long to fit in this thread.. i just made a new one: http://forums.somethingawful.com/showthread.php?threadid=3026496
|
# ? Dec 6, 2008 04:52 |
|
tayl0r posted:I get back this JSON: That is valid JSON. Your javascript code must be incorrect. tayl0r posted:I manually tested this JSON string, which does get parsed into my java script: If you want a list instead of a mapping, have you considered serializing a list? code:
|
# ? Dec 6, 2008 04:53 |
|
Ok, good to know that is valid json. The javascript example code I got from YUI probably just doesn't work with that format. I actually already did what you suggested (use a list instead of a dictionary) and it generates the json that works with my javascript. Although, my code is 4 lines and yours is just 1 =P Thanks for tip, Janin.
|
# ? Dec 6, 2008 05:19 |
|
I have been stumped trying to get this one piece of code to function properly. I am trying to use the pxssh library to execute commands on a remote shell. Whenever I try to put the sendline() commands in a for loop, it will run the first command, but just hang on the subsequent commands and never execute. I cannot for the life of me figure out why this is happening. Can someone shed some light on this? This works: code:
code:
|
# ? Dec 8, 2008 21:53 |
|
I'm looking for a canvas library. Basically I'd like to emulate the HTML canvas element, specifically I need to be able to add polygons, whose color has an alpha channel/transparency, I need to be able to edit polygons on the canvas, and I need to be able to get the actual color for a given pixel. Basically I'm trying to implement http://alteredqualia.com/visualization/evolve/ in python
|
# ? Dec 12, 2008 02:23 |
|
Generate SVG if you want vector output, but you may find that the python imagine library does enough for your needs.
|
# ? Dec 12, 2008 04:51 |
|
I just figured out the coolest thing (its probably not new to lot of you) If you are on linux and you can write to /dev/dsp and hear sound, check this out code:
chr (int ( max( min (128 * math.sin((x ** math.log( (x//5 % 23 + 1) **0.2)) * math.pi/180), 255),0) ) ) tripwire fucked around with this message at 06:34 on Dec 12, 2008 |
# ? Dec 12, 2008 06:10 |
|
I'm super excited to say that my PyCon talk was accepted! It's a panel on ORM philosophies and design decisions with Jacob Kaplan-Moss, Ian Bicking, Mike Bayer, Guido van Rossum, and Massimo Di Pierro. I know we had a few other goons who submitted talk proposals, what were your results?
|
# ? Dec 16, 2008 02:09 |
|
king_kilr posted:I'm super excited to say that my PyCon talk was accepted! It's a panel on ORM philosophies and design decisions with Jacob Kaplan-Moss, Ian Bicking, Mike Bayer, Guido van Rossum, and Massimo Di Pierro. I know we had a few other goons who submitted talk proposals, what were your results?
|
# ? Dec 16, 2008 03:36 |
|
king_kilr posted:I'm super excited to say that my PyCon talk was accepted! It's a panel on ORM philosophies and design decisions with Jacob Kaplan-Moss, Ian Bicking, Mike Bayer, Guido van Rossum, and Massimo Di Pierro. I know we had a few other goons who submitted talk proposals, what were your results? Both of mine - an intro to multiprocessing, and the "state of concurrency and distributed systems w/ python" were accepted.
|
# ? Dec 16, 2008 04:38 |
|
m0nk3yz posted:Both of mine - an intro to multiprocessing, and the "state of concurrency and distributed systems w/ python" were accepted. awesome, both of those sound super interesting, can't wait!
|
# ? Dec 16, 2008 06:39 |
|
Hello all I am a noob to python and programming and I am making an ultra simple script to download files off the net. I got that part working, but for the life of me I cant wrap my head around how to make a progress menu to show how much of the file is left to download. I am using urlgrabber to download the file and it appears that it has some method for reporting how much of the file is left to download but I have no idea how to use it.
|
# ? Dec 16, 2008 08:56 |
|
To display a progress bar, I think Tkinter has that capability. But I'm more of a newb than you are so I can't offer anything specific.
|
# ? Dec 16, 2008 21:27 |
|
Kire posted:To display a progress bar, I think Tkinter has that capability. But I'm more of a newb than you are so I can't offer anything specific. This is command line only, gui programming is beyond me.
|
# ? Dec 17, 2008 14:41 |
|
Capnbigboobies posted:This is command line only, gui programming is beyond me. Just saying, but Tkinter has a download bar as one of the examples that comes with it. You could either use that or at least the code as the basis for a command line one. edit: For those interested, I found a Python module for sending keystrokes to an active window. It's like AutoIt. http://www.rutherfurd.net/python/sendkeys/ chemosh6969 fucked around with this message at 19:05 on Dec 17, 2008 |
# ? Dec 17, 2008 19:03 |
|
I literally just (an hour ago) jumped into programming with Python. Right now i'm using this and am up to the 5th part. I'm understanding it so far but I'm not holding much in my memory. Is there a better online tutorial or even book I should use or is this just normal confusion that goes away after using Python for a few weeks.
|
# ? Dec 18, 2008 04:33 |
|
|
# ? May 24, 2024 01:27 |
|
IntoTheNihil posted:I literally just (an hour ago) jumped into programming with Python. Right now i'm using this and am up to the 5th part. I'm understanding it so far but I'm not holding much in my memory. Is there a better online tutorial or even book I should use or is this just normal confusion that goes away after using Python for a few weeks. If you have some programming background dive into python is pretty good, otherwise I like the regular python tutorial.
|
# ? Dec 18, 2008 04:55 |