|
No. AMD64 in common parlance is just a synonym for x86-64. Use stuff built for it if you're on an x64 system, regardless whether Intel or AMD made your processor.
|
# ? Mar 22, 2010 05:22 |
|
|
# ? Jun 11, 2024 20:02 |
|
The only problem is some 3rd party modules may not have x64 binaries built, but hey, using Py3k is going to be the limit in that respect.
|
# ? Mar 22, 2010 06:07 |
|
OK, I'm running out of places to turn for help on this one. I have attempted to extend unittest.py to add a subclass of TextTestRunning which takes advantage of the multiprocessing module to run tests in parallel. I have everything working, with the exception of one thing: (the RuntimeError exceptions - the test suite failures are me testing failures and errors) code:
code:
|
# ? Mar 22, 2010 23:00 |
|
Has anyone done anything with Python and SOAP here? I have a project where I need to connect to a WCF service using Python. I am using suds and it was working great until I tried to use the service. I can create things with the factory and I can grab all of the methods and ports, but whenever I try to run a function from one of the ports it spits back Error 415 (I think, may be 451?). It is something about expecting application/soap+xml but got text/xml. I think this might be because the server could be running SOAP 1.1 and not 1.2, but I am not sure. Is there any way to force suds to expect text/xml? Should I be using something other than suds?
|
# ? Mar 23, 2010 00:05 |
|
spankweasel posted:
code:
|
# ? Mar 23, 2010 02:29 |
|
Scaevolus posted:Try Well, something new! Now I know -where- the offending __getattr__ is... code:
code:
Thanks for at least a breadcrumb on where the hell to look. Man, that issue is -EVERYWHERE- in anything using python2.6. Why the hell was the bug closed as "Nope, nothing to see here." with this many people suffering from this issue.
|
# ? Mar 23, 2010 03:09 |
|
Sweeper posted:Has anyone done anything with Python and SOAP here? I have a project where I need to connect to a WCF service using Python. I am using suds and it was working great until I tried to use the service. I can create things with the factory and I can grab all of the methods and ports, but whenever I try to run a function from one of the ports it spits back Error 415 (I think, may be 451?). It is something about expecting application/soap+xml but got text/xml. I think this might be because the server could be running SOAP 1.1 and not 1.2, but I am not sure. Is there any way to force suds to expect text/xml? Should I be using something other than suds? I've never had good experience consuming a WSDL with any utilities available in Python. I always end up writing a library to implement the calls I need. I think PyWebSvcs must only get tested against something available in Zope.
|
# ? Mar 23, 2010 06:33 |
|
If anyone is interested in NoSQL stuff I'm writing a series on Redis, with Python as the main development language. Have 2 articles done right now. http://degizmo.com/series-redis-tutorials/
|
# ? Mar 23, 2010 19:46 |
|
How do I get readline()/realines() to actually talk to specific lines in the file, rather than just the first line and all the lines up to the size limit respectively? Ie, I have an EMBL file, it contains a lot of poo poo, I need to sort through line by line until I find '//'. I guess I could just do it by doing code:
Thus, how do I tell readline() to search through the line until it passes 600 lines, then return line #601? Disclaimer: I'm a noob, if I'm missing something stupid, it's probably because I'm ignorant. Make sure to point it out.
|
# ? Mar 23, 2010 23:22 |
|
A file is just a sequence of characters. readline has no way of knowing where a newline is or where a particular string is without reading through the file in order.
|
# ? Mar 23, 2010 23:52 |
|
Sock on a Fish posted:I've never had good experience consuming a WSDL with any utilities available in Python. I always end up writing a library to implement the calls I need.
|
# ? Mar 24, 2010 00:38 |
|
Mirconium posted:But this seems hugely wasteful if I just have to talk to the first 200 lines of a 15kb file. code:
Scaevolus fucked around with this message at 04:20 on Mar 24, 2010 |
# ? Mar 24, 2010 01:35 |
|
Scaevolus posted:It's 2010. 15KB is nothing. This is an especially stupid "optimization" to attempt in a language like Python. Make sure you strip the trailing newline or that test for equality with '//' will never evaluate true!
|
# ? Mar 24, 2010 01:42 |
|
Does anyone know a lot about Python buffer objects? I want to do something like NumPy and take an optional argument for (C extension) functions that will provide a buffer to use to fill a C array that gets put into a NumPy array. Basically:code:
|
# ? Mar 24, 2010 19:56 |
|
Avenging Dentist posted:Does anyone know a lot about Python buffer objects? I want to do something like NumPy and take an optional argument for (C extension) functions that will provide a buffer to use to fill a C array that gets put into a NumPy array. Basically: I'm not sure if this is entirely relevant, but I was reading Cython docs a while back and it mentioned that efficient indexing into arrays is supported by the buffer object, but only (natively) in python 3; in python 2 theres some hackery going on in cython to emulate the same thing. Again, I'm not sure if this even has anything to do with what you are asking, but skim through this and see if anything jumps out at you: http://wiki.cython.org/enhancements/buffer
|
# ? Mar 24, 2010 20:10 |
|
Yeah, that's not really what I need. I just want to know how to take an object from Python into C, get its buffer interface, and then use that as a block of (contiguous) memory to pass to an internal C function, and then finally put that block into a NumPy array. If NumPy's source weren't such a bitch to read, I'd just look through it to see how they do it. I mean, I could probably figure it out, but this seems like an area where memory issues are rife, and I wanted to see what other people's experiences were (if any). Avenging Dentist fucked around with this message at 20:34 on Mar 24, 2010 |
# ? Mar 24, 2010 20:32 |
|
The buffer interface is pretty new, they were still working on getting it added when I was at Enthought a few years ago, unless I am misremembering. Have you tried just asking the numpy mailing list? Travis is usually pretty good about answering technical questions.
|
# ? Mar 24, 2010 20:37 |
|
It looks like NumPy only uses the new buffer protocol in 1.5 (and that the buffer protocol is a 2.6+ thing). I think I'll wait until NumPy 1.5 is out before worrying about this overly much.
|
# ? Mar 24, 2010 23:08 |
|
Is there any decent library for basically doing 2d geometry? Aside from shapely? I keep running into tiresome issues with checking to see if polygons intersect, using a line to splice a polygon, etc.
|
# ? Mar 25, 2010 22:22 |
|
What is the canonical way to read a file one byte at a time? Because python doesn't allow assignment in the conditional, I've been doing something like this: code:
code:
More generally, is there an idiom that means "keep giving me the return value of this expression until it returns false"? Something analagous to C's "while (c=func()) {}"? It seems to come up in various situtations, and I've been using while True with conditional breaks.
|
# ? Mar 26, 2010 20:44 |
|
I'd be lazy and do [char for line in file for char in line] But I'm really lazy
|
# ? Mar 26, 2010 20:53 |
|
Stabby McDamage posted:More generally, is there an idiom that means "keep giving me the return value of this expression until it returns false"? Something analagous to C's "while (c=func()) {}"? It seems to come up in various situtations, and I've been using while True with conditional breaks. The idiom is to make that function a generator. Any function that "keeps giving me the return value of this expression until it returns false", is basically what a generator is for. edit: you can also raise StopIteration in generators which will do the same thing as 'return False' if you don't like conditional breaks nbv4 fucked around with this message at 21:44 on Mar 26, 2010 |
# ? Mar 26, 2010 21:37 |
|
I have never posted in SH/SC or TCOC until now, so allow me to introduce myself. I started loving with computers around '96, and went into a professional IT career (which is now deceased), but never programmed anything except QBASIC, HTML, or basic Linux scripts. I've been a Linux geek for a while, and after 14 years of PC's, am finally starting to teach myself something more interesting. So, on to my question... After having have only worked with python for about 2 days, I decided it would be fun to hook up a breadboard with 7 segment displays and decoders to my parallel port. I have a function that can take a decimal or hex value and do what I want with it. The range of values I want to send to this function are from 0x00 - 0x99. My problem is the output of the function which calls the I/O function is producing a string such as '0x99' that the I/O function won't accept because it isn't a real numerical value. So my REAL question is... How do I change '0x99' to 0x99? AbsentMindedWelder fucked around with this message at 22:26 on Mar 26, 2010 |
# ? Mar 26, 2010 22:24 |
|
int('0x99', 16)
|
# ? Mar 26, 2010 22:32 |
|
nbv4 posted:The idiom is to make that function a generator. Any function that "keeps giving me the return value of this expression until it returns false", is basically what a generator is for. Okay then -- can the generator I wrote be improved? Basically, I'm just not used to using infinite loops with breaks for doing something as simple as byte-wise reading. If that's really the best way, then I'm a bit surprised.
|
# ? Mar 27, 2010 00:23 |
|
Yes, while True: is a common idiom. Sorry to disappoint. Also, I'm not sure I'd create a generator just to hide that if you're only doing this in one place.
|
# ? Mar 27, 2010 00:28 |
|
Avenging Dentist posted:int('0x99', 16) Here is my first official python program. Please critique. The hardware hooked up to the parallel port is basically just (2) 7447 IC's hooked up to (2) 7 segment displays, and a few resistors. I'm using pyParallel to handle the I/O functions. (This is an old machine running Debian with no GUI) code:
If you decide to use pyParallel you'll probably have to do 2 things to get it to work. -Edit setup.py to make it install correctly -rmmod lp If anyone is curious enough for a circuit diagram, you can pretty much figure it by looking up the 7447 documentation and a pin-out of a standard parallel port. Also this is a great website about interfacing the parallel port.
|
# ? Mar 27, 2010 01:06 |
|
Milde posted:Yes, while True: is a common idiom. Sorry to disappoint. Not in the case of reading lines from a file. IMO the most pythonic way is what king_kilr said, for line in file and then for char in line
|
# ? Mar 27, 2010 01:10 |
|
nbv4 posted:Not in the case of reading lines from a file. IMO the most pythonic way is what king_kilr said, for line in file and then for char in line Why would you want to double-buffer your input?
|
# ? Mar 27, 2010 01:15 |
|
Avenging Dentist posted:Why would you want to double-buffer your input? i didn't say it as the most efficient way... Anyways, I thought file objects were smart enough to be iterated over without needing to be buffered?
|
# ? Mar 27, 2010 01:43 |
|
nbv4 posted:Anyways, I thought file objects were smart enough to be iterated over without needing to be buffered? I'm talking about the internal buffer at the C level (Python file objects ultimately forward on to FILE*s in C) plus the additional "buffer" of the current line. This is further complicated by the fact that you have to look ahead to find where the current line ends, unlike with fixed-size buffers where you know the buffer size a priori. File I/O is one of the few places I'd be concerned about (non-asymptotic) efficiency in Python, since unnecessary reads from disk are slow even in Python terms.
|
# ? Mar 27, 2010 01:54 |
|
dv6speed posted:Thanks, worked perfectly! If you haven't already done so, you should skim over the Python Tutorial. It's pretty short, and introduces you to syntax that you might not run into otherwise. Set your editor to indent with spaces instead of tabs. Suggestions: code:
Scaevolus fucked around with this message at 02:25 on Mar 27, 2010 |
# ? Mar 27, 2010 02:16 |
|
Avenging Dentist posted:File I/O is one of the few places I'd be concerned about (non-asymptotic) efficiency in Python, since unnecessary reads from disk are slow even in Python terms.
|
# ? Mar 27, 2010 02:28 |
|
Scaevolus posted:Is there a modern OS that doesn't cache page reads? Paging doesn't have anything to do with this, since that would happen after reading from disk into a buffer. But then, I don't actually know (or care) how Python implements readline() so it's possible that if a line would be split by the file buffer that it won't go out to disk more than necessary. I suppose it's a more immediate concern that you'd have to figure out how much to read from the buffer every time you call readline(), which is unnecessary.
|
# ? Mar 27, 2010 02:47 |
|
Scaevolus posted:Are you using Python 3? If not, you shouldn't have parentheses around print statements. It's not a function in Python 2.x.
|
# ? Mar 27, 2010 02:51 |
|
dv6speed posted:I am reading "A byte of Python" for versoin 3.x, so yes. You really shouldn't use Python 3 unless you have a good reason why you need to. It's just going to bite you in the rear end in the future.
|
# ? Mar 27, 2010 02:54 |
|
Avenging Dentist posted:You really shouldn't use Python 3 unless you have a good reason why you need to. It's just going to bite you in the rear end in the future.
|
# ? Mar 27, 2010 02:59 |
|
dv6speed posted:Why do you say that? Mostly because very few modules have been ported over to it, and if you ask people for help, odds are that they're going to be more familiar with python 2. If you feel really strongly about leading the way into the future or something like that, by all means. Its deficiencies are not technical, but social.
|
# ? Mar 27, 2010 03:03 |
|
dv6speed posted:Why do you say that? There are still an awful lot of important third-party Python modules that don't have Python 3 support yet, and chances are you're going to decide you want one of them and then have to either 1) go back to Python 2 and unlearn a bunch of stuff, or 2) wait 6 months to a year until they release a Python 3 version.
|
# ? Mar 27, 2010 03:04 |
|
|
# ? Jun 11, 2024 20:02 |
|
Avenging Dentist posted:Paging doesn't have anything to do with this, since that would happen after reading from disk into a buffer. My most immediate concern is that it's a binary file that may go for an arbitrary length with no newlines, so reading line-by-line would mean it has a potentially unbounded memory requirement.
|
# ? Mar 27, 2010 03:37 |