Re: MySQLdb

2005-01-25 Thread nobody
The problem I have is that it takes just over two minuted to execute the 3000 insert statements which seems really slow! Are you creating a new DB connection for every insert? I just did a test on my system (Athlon 2500+), 3000 rows with an auto_increment field and a randomly generated 128

Re: MySQLdb

2005-01-26 Thread nobody
How many indices? Just the primary key (id). -- http://mail.python.org/mailman/listinfo/python-list

MIME encoding change in Python 2.4.3 (or 2.4.2? 2.4.1?) - problem and solution

2006-11-27 Thread Nobody
I have an application that processes MIME messages. It reads a message from a file, looks for a text/html and text/plain parts in it, performs some processing on these parts, and outputs the new message. Ever since I recently upgraded my Python to 2.4.3, the output messages started to come out

Re: 3.x and 2.x on same machine (is this info at Python.org??)

2009-11-14 Thread Nobody
On Fri, 13 Nov 2009 06:05:48 -0500, Dave Angel wrote: Currently i am using 2.6 on Windows and need to start writing code in 3.0. I cannot leave 2.x yet because 3rd party modules are still not converted. So i want to install 3.0 without disturbing my current Python2.x. What i'm afraid of is

Re: More Python versions on an XP machine

2009-11-15 Thread Nobody
On Sat, 14 Nov 2009 14:45:48 +0100, Gabor Urban wrote: this a very MS specific question. I do use a rather old Python version, because we have a couple of applications written for that. Porting them to a newer Python is not allowed by the bosses. Now we will start a new project with latest

Re: How to know if a file is a text file

2009-11-15 Thread Nobody
On Sat, 14 Nov 2009 17:02:29 +0100, Luca Fabbri wrote: I'm looking for a way to be able to load a generic file from the system and understand if he is plain text. The mimetype module has some nice methods, but for example it's not working for file without extension. Any suggestion? You

Re: How to know if a file is a text file

2009-11-15 Thread Nobody
On Sun, 15 Nov 2009 04:34:10 -0800, Chris Rebert wrote: I'm looking for a way to be able to load a generic file from the system and understand if he is plain text. The mimetype module has some nice methods, but for example it's not working for file without extension. Any suggestion? You

Re: How to know if a file is a text file

2009-11-15 Thread Nobody
On Sun, 15 Nov 2009 13:49:54 +0100, Luca wrote: I was quite sure that this is not a very simple task. Right now search only inside ASCII encode is not enough for me (my native language is outside this encode :-) Checking every single byte can be a good solution... I can start using the

Re: Slicing history?

2009-11-15 Thread Nobody
On Sun, 15 Nov 2009 10:50:43 -0800, Aahz wrote: Anyone remember or know why Python slices function like half-open intervals? I find it incredibly convenient myself, but an acquaintance familiar with other programming languages thinks it's bizarre and I'm wondering how it happened. How else

Re: import subprocess in python

2009-11-16 Thread Nobody
On Mon, 16 Nov 2009 04:58:00 -0800, sturlamolden wrote: On 16 Nov, 13:50, Kuhl chen_zhi...@yahoo.com wrote: Python 2.2.3 (#1, Feb  2 2005, 12:22:48) What's the mistake that I am making? How to solve it? Your Python version is too old. Your Python version is *way* too old. If you're

Re: Image to SVG conversion with Python

2009-11-16 Thread Nobody
On Mon, 16 Nov 2009 07:19:49 -0800, Carlo DiCelico wrote: I need to convert JPEG and PNG files to SVG. I'm currently using PIL to generate the JPEG/PNG files to begin with. However, I need to be able to scale the generated images up in size without a loss of image quality. Using SVG seems to

Re: Language mavens: Is there a programming with if then else ENDIF syntax?

2009-11-16 Thread Nobody
On Mon, 16 Nov 2009 08:54:28 -0800, Steve Ferg wrote: For a long time I've wondered why languages still use blocks (delimited by do/end, begin/end, { } , etc.) in ifThenElse statements. I've often thought that a language with this kind of block-free syntax would be nice and intuitive:

Re: New syntax for blocks

2009-11-17 Thread Nobody
On Tue, 17 Nov 2009 17:31:18 +, MRAB wrote: And if I ever find the genius who had the brilliant idea of using = to mean assignment then I have a particularly nasty dungeon reserved just for him. Also a foul-smelling leech-infested swamp for those language designers and compiler writers

Re: directory wildcard

2009-11-17 Thread Nobody
On Mon, 16 Nov 2009 14:19:16 -0800, hong zhang wrote:         print f, mcs This assigns decimal value, how can I assign Hex here to mcs? print f, %x % mcs -- http://mail.python.org/mailman/listinfo/python-list

Re: Command line arguments??

2009-11-17 Thread Nobody
On Mon, 16 Nov 2009 23:30:09 +, Rhodri James wrote: Quote the filenames or escape the spaces: C:\Python26\Python.exe C:\echo.py C:\New Folder\text.txt We've been living with this pain ever since windowed GUIs encouraged users to put spaces in their file names (Apple, I'm looking at

Re: Command line arguments??

2009-11-17 Thread Nobody
On Tue, 17 Nov 2009 11:47:46 -0800, Gerry wrote: How about this: lastarg = .join(sys.argv[2:]) What about it? IOW, why would you want to do that? -- http://mail.python.org/mailman/listinfo/python-list

Re: Command line arguments??

2009-11-18 Thread Nobody
On Tue, 17 Nov 2009 23:57:55 +, Rhodri James wrote: Quote the filenames or escape the spaces: C:\Python26\Python.exe C:\echo.py C:\New Folder\text.txt We've been living with this pain ever since windowed GUIs encouraged users to put spaces in their file names (Apple, I'm looking at

Re: getting properly one subprocess output

2009-11-18 Thread Nobody
On Wed, 18 Nov 2009 12:25:14 +0100, Jean-Michel Pichavant wrote: I'm currently inspecting my Linux process list, trying to parse it in order to get one particular process (and kill it). I ran into an annoying issue: The stdout display is somehow truncated (maybe a terminal length issue, I

Re: Minimally intrusive XML editing using Python

2009-11-18 Thread Nobody
On Wed, 18 Nov 2009 13:55:52 +0100, Thomas Lotze wrote: I wonder what Python XML library is best for writing a program that makes small modifications to an XML file in a minimally intrusive way. By that I mean that information the program doesn't recognize is kept, as are comments and

Re: getting properly one subprocess output

2009-11-20 Thread Nobody
On Thu, 19 Nov 2009 06:21:09 -0800, Bas wrote: Below is the script I use to automatically kill firefox if it is not behaving, maybe you are looking for something similar. lines = os.popen('ps ax|grep firefox').readlines() This isn't robust. It will kill any process with firefox anywhere in

Re: python simply not scaleable enough for google?

2009-11-21 Thread Nobody
On Fri, 20 Nov 2009 09:51:49 -0800, sturlamolden wrote: You can make a user-space scheduler and run a 10 tasklets on a threadpool. But there is a GIL in stackless as well. Nobody wants 10 OS threads, not with Python, not with Go, not with C. Also note that Windows has native

Re: Go versus Brand X

2009-11-21 Thread Nobody
On Fri, 20 Nov 2009 17:12:36 -0800, Aahz wrote: Comparing Go to another computer language -- do you recognize it? Here is a language so far ahead of its time that it was not only an improvement on its predecessors but also on nearly all its successors. - C. A. R. Hoare (although he was

Re: Imitating tail -f

2009-11-22 Thread Nobody
On Sun, 22 Nov 2009 03:43:31 +0100, Ivan Voras wrote: The problem is: poll() always returns that the fd is ready (without waiting), but read() always returns an empty string. Actually, it doesn't matter if I turn O_NDELAY on or off. select() does the same. Regular files are always ready for

Re: Minimally intrusive XML editing using Python

2009-11-23 Thread Nobody
On Mon, 23 Nov 2009 17:45:24 +0100, Thomas Lotze wrote: What's your real problem, or use case? Are you just concerned with diffing, or are others likely to read the xml, and want it formatted the way it already is? I'd like to put the XML under revision control along with other stuff.

Re: Relative versus absolute paths on Windows

2009-11-23 Thread Nobody
On Tue, 24 Nov 2009 02:23:19 +0100, Christian Heimes wrote: Gregory Ewing wrote: ntpath.join('d:\\foo', '\\bar') '\\bar' This does seem like a bug, though -- the correct result should really be 'd:\\bar', since that's what you would get if you used the name '\\bar' with 'd:' as your

Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-11-23 Thread Nobody
On Mon, 23 Nov 2009 22:06:29 +0100, Alf P. Steinbach wrote: 10. It says UnicodeDecodeError on mail nr. something something. That's what you get for using Python 3.x ;) If you must use 3.x, don't use the standard descriptors. If you must use the standard descriptors in 3.x, call detach() on

Re: sys.stdout is not flushed

2009-11-23 Thread Nobody
On Mon, 23 Nov 2009 23:08:25 +0100, Diez B. Roggisch wrote: Try printing stdout.write('\r--%d') ^M--0^M--1^M--2^M--3... ;) But it's probably good enough for the OP's purposes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Object Not Callable, float?

2009-11-30 Thread Nobody
On Mon, 30 Nov 2009 01:07:53 -0500, Mel wrote: In FORTRAN and PL/I words were un-reserved to a degree that's really bizarre. A short post can't begin to do it justice -- let's just mention that IF and THEN could be variable names, and DO 100 I=1.10 . The syntaxes were carefully crafted

Re: TypeError: an integer is required

2009-11-30 Thread Nobody
On Sun, 22 Nov 2009 18:29:25 +, MRAB wrote: os.open(C://Users//lutfi//Documents//te//log.txt , a ) open(C://Users//lutfi//Documents//te//log.txt , a ) Backslashes need to be doubled; forward slashes don't. -- http://mail.python.org/mailman/listinfo/python-list

Re: python and vc numbers

2009-11-30 Thread Nobody
On Mon, 30 Nov 2009 21:02:00 +1100, Daniel Dalton wrote: That did the trick, thanks, after I append [-2] Further testing under screen says otherwise -- it seems to give me the tty number, not the virtual console number. Is there any way to figure out what virtual console I'm am in I'm

Re: peppy

2009-11-30 Thread Nobody
On Tue, 01 Dec 2009 08:51:20 +0200, Johann Spies wrote: After reading about peppy on Freshmeat I decided to try it out after installing it using easy_install. But: $ peppy File /usr/lib/python2.5/site-packages/peppy-0.13.2-py2.5.egg/peppy/lib/multikey.py, line 120, in module

Re: Help in wxpython

2009-12-03 Thread Nobody
On Thu, 03 Dec 2009 07:55:19 +, r0g wrote: I have to recommend to opposite, stick with wx. What's the point of tying yourself into GTK when wx works on Mac, PC and Linux? The main drawbacks are that wxWidgets sucks compared to GTK or Qt (mostly due to being modelled on the Win32 API, which

Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-12-05 Thread Nobody
On Fri, 04 Dec 2009 00:33:57 +, Steven D'Aprano wrote: Just to be contrary, I *like* mbox. Me too. :-) Me too. Why? What features or benefits of mbox do you see that make up for it's disadvantages? Simplicity and performance. Maildir isn't simple when you add in the filesystem or

Re: question about subprocess and shells

2009-12-05 Thread Nobody
On Fri, 04 Dec 2009 13:38:11 -0800, Ross Boylan wrote: If one uses subprocess.Popen(args, ..., shell=True, ...) When args finishes execution, does the shell terminate? Either way seems problematic. That depends upon what args is. On Unix, if args ends with a , the shell will terminate as

Re: Specifying an API for a straeming parser

2009-12-05 Thread Nobody
On Fri, 04 Dec 2009 13:51:15 -0800, tyler wrote: Howdy folks, I'm working on a JSON Python module [1] and I'm struggling with an appropriate syntax for dealing with incrementally parsing streams of data as they come in (off a socket or file object). The underlying C-level parsing library

Re: subprocess kill

2009-12-09 Thread Nobody
On Mon, 07 Dec 2009 11:04:06 +0100, Jean-Michel Pichavant wrote: When using shell=True, your process is started in a shell, meaning the PID of your subprocess is not self.luca.pid, self.luca.pid is the PID of the shell. This isn't true for a simple command on Unix (meaning a program name

Re: When will Python 3 be fully deployed

2009-12-09 Thread Nobody
On Sun, 06 Dec 2009 22:10:15 +, Edward A. Falk wrote: I recently read that many libraries, including Numpy have not been ported to Python 3. When do you think that Python 3 will be fully deployed? It will never be fully deployed. There will always be people out there who haven't felt it

Re: switch

2009-12-09 Thread Nobody
On Tue, 08 Dec 2009 21:02:44 -0800, Kee Nethery wrote: I string together a bunch of elif statements to simulate a switch if foo == True: blah elif bar == True: blah blah elif bar == False: blarg elif This isn't what would normally be considered a switch (i.e.

Re: When will Python 3 be fully deployed

2009-12-09 Thread Nobody
On Wed, 09 Dec 2009 10:28:40 -0800, Rami Chowdhury wrote: But on Unix, it's a square-peg-round-hole situation. I dunno, I find it rather useful not to have to faff about with encoding to/from when working with non-ASCII files (with non-ASCII filenames) on Linux. For the kind of task I'm

Re: switch

2009-12-10 Thread Nobody
On Thu, 10 Dec 2009 05:47:19 +, Steven D'Aprano wrote: I string together a bunch of elif statements to simulate a switch if foo == True: blah elif bar == True: blah blah elif bar == False: blarg elif This isn't what would normally be considered a switch (i.e.

Re: a list/re problem

2009-12-12 Thread Nobody
On Fri, 11 Dec 2009 12:49:42 -0800, Ed Keith wrote: the following works: r = re.compile('\*(.+)\*') def f(s): m = r.match(s) if m: return m.group(1) else: return '' n = [f(x) for x in l if r.match(x)] But it is inefficient, because it is

Re: Moving from PHP to Python. Is it Possible

2009-12-13 Thread Nobody
On Fri, 11 Dec 2009 12:26:30 +0200, Sancar Saran wrote: 1-) Can I create Global (read/write access anywhere from my code) Multi dimensional, associative array (or hash) and store any kind of variable type. Global, no; at least not in the sense of e.g. C. Python doesn't have a global

Re: read text file byte by byte

2009-12-13 Thread Nobody
On Sun, 13 Dec 2009 12:39:26 -0800, Dennis Lee Bieber wrote: You originally stated that you want to scramble the bytes -- if you mean to implement some sort of encryption algorithm you should know that most of them work in blocks as the key is longer than one byte. Block ciphers work in

Re: read text file byte by byte

2009-12-14 Thread Nobody
On Sun, 13 Dec 2009 22:56:55 -0800, sjdevn...@yahoo.com wrote: The 3.1 documentation specifies that file.read returns bytes: Does it need fixing? There are no file objects in 3.x. The file() function no longer exists. The return value from open(), will be an instance of _io.something

Re: read text file byte by byte

2009-12-14 Thread Nobody
On Mon, 14 Dec 2009 03:14:11 +, MRAB wrote: You originally stated that you want to scramble the bytes -- if you mean to implement some sort of encryption algorithm you should know that most of them work in blocks as the key is longer than one byte. Block ciphers work in blocks.

Re: Seek support for new slice syntax PEP.

2009-12-14 Thread Nobody
On Mon, 14 Dec 2009 10:03:16 -0800, Dave wrote: Just as sets may now be written as {3,'hi'}, I propose that slices should be available using [start:end] syntax. Following example comes from projecteuler.net problem 166. The Numeric community would also like this, as would the general python

Re: read text file byte by byte

2009-12-16 Thread Nobody
On Mon, 14 Dec 2009 21:37:33 -0300, Gabriel Genellina wrote: There are no file objects in 3.x. The file() function no longer exists. The return value from open(), will be an instance of _io.something depending upon the mode, e.g. _io.TextIOWrapper for 'r', _io.BufferedReader for 'rb',

Re: Seek support for new slice syntax PEP.

2009-12-17 Thread Nobody
On Mon, 14 Dec 2009 14:18:49 -0500, Terry Reedy wrote: Many more people uses range objects (xrange in 2.x). A range object has the same info as a slice object *plus* it is iterable. This isn't quite true, as a range cannot have a stop value of None, i.e. you can't represent [n:] or [:] etc as

Re: Seek support for new slice syntax PEP.

2009-12-18 Thread Nobody
On Fri, 18 Dec 2009 09:49:26 -0500, Colin W. wrote: You don't say, but seem to imply that the slice components include None. That's how missing components are implemented at the language level: class foo: = def __getitem__(self, s): = return s =

Re: python gtk: input box and enter

2009-12-23 Thread Nobody
On Tue, 22 Dec 2009 23:41:31 -0800, edgue wrote: How do I use gtk to enter a (hidden) text press ENTER ... done? Connect the gtk.Entry's activate signal to the click() method: self.entry.connect(activate, self.click) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple distributed example for learning purposes?

2009-12-30 Thread Nobody
On Sat, 26 Dec 2009 20:06:02 +, Tim Golden wrote: I'm trying to come up with something which will illustrate the usefulness of a distributed processing model. Since I may not be using the term distributed exactly, my criteria are: * It should be clear that the application produces

Re: subprocess returncode is masked

2009-12-30 Thread Nobody
On Mon, 28 Dec 2009 17:12:23 +0100, Emmanuel wrote: I'm using Python 2.6 and the new subprocess module to get the exit value of an external executable. It appears the return value given by wait() or poll() operations is masked under Unix: I only get the lower 8 bits. So an exit value of

Re: Portable way to tell if a process is still alive

2009-12-30 Thread Nobody
On Tue, 29 Dec 2009 12:35:11 +0430, Laszlo Nagy wrote: Suppose we have a program that writes its process id into a pid file. Usually the program deletes the pid file when it exists... But in some cases (for example, killed with kill -9 or TerminateProcess) pid file is left there. I would

Re: Potential Conflicts by Installing Two Versions of Python (Windows)?

2010-01-02 Thread Nobody
On Fri, 01 Jan 2010 17:37:40 -0800, W. eWatson wrote: I suspect that if one installs v2.4 and 2.5, or any two versions, that one will dominate, or there will be a conflict. I suppose it would not be possible to choose which one should be used. Comments? The only inherent conflict is that

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-04 Thread Nobody
On Sun, 03 Jan 2010 13:56:24 -0800, cassiope wrote: I'm changing the uid and gid in the daemon (which runs with root permissions until the fork and uid/gid change). The uid and gid are confirmed by printing os.getuid() and os.getgid() in the script. Those tell you the *real* UID/GID.

Re: IOError - cannot create file (linux daemon-invoked script)

2010-01-05 Thread Nobody
On Mon, 04 Jan 2010 21:30:31 -0800, cassiope wrote: One more tidbit observed: my last note, that it works when using seteuid/setegid? Well - that only applies if the daemon is running under strace (!). It fails if started directly by root, or if the strace session has ended, leaving the

Re: fsync() doesn't work as advertised?

2010-01-05 Thread Nobody
On Mon, 04 Jan 2010 08:09:56 -0800, Brian D wrote: If I'm running a process in a loop that runs for a long time, I occasionally would like to look at a log to see how it's going. I know about the logging module, and may yet decide to use that. Still, I'm troubled by how fsync() doesn't

Re: please help shrink this each_with_index() implementation

2010-01-06 Thread Nobody
On Tue, 05 Jan 2010 12:20:58 -0800, Marco Nawijn wrote: You could use the build-in function enumerate inside a list comprehension. seq = range(5) [ (i,s) for i,s in enumerate(seq) ] [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] Just use list(), i.e. list(enumerate(seq)). --

Re: please help shrink this each_with_index() implementation

2010-01-06 Thread Nobody
On Tue, 05 Jan 2010 19:46:01 -0800, alex23 wrote: They will tell me how to use except: (which is a good example why a program should not use exceptions for its normal control flow if at all possible). Really? Magic functions that coerce and eat errors are a better coding technique than

Re: subprocess.Popen does not close pipe in an error case

2010-01-06 Thread Nobody
On Tue, 05 Jan 2010 15:50:39 -0800, Steven K. Wong wrote: Below, I have a Python script that launches 2 child programs, prog1 and prog2, with prog1's stdout connected to prog2's stdin via a pipe. (It's like executing prog1 | prog2 in the shell.) If both child programs exit with 0, then the

Re: Printing plain text with exact positioning on Windows

2010-01-07 Thread Nobody
On Tue, 05 Jan 2010 11:40:25 -0800, KvS wrote: Hardcopy document formats such as PostScript and PDF use positions relative to the edges of the page, not the margins. Right. Still, Acrobat Reader by default scales the contents to fit on a page and creates some margins by doing so, no? So if

Re: subprocess.Popen does not close pipe in an error case

2010-01-09 Thread Nobody
On Wed, 06 Jan 2010 11:39:37 -0800, Steven K. Wong wrote: Suppose now all the prog1.poll() calls/loop are replaced by a single prog1.wait(). Without the explicit prog1.stdout.close(), prog1.wait() will not return, so the calling process still hangs. Because calling prog1.wait() means that the

Re: subprocess.Popen does not close pipe in an error case

2010-01-10 Thread Nobody
On Wed, 06 Jan 2010 19:05:40 -0800, Steven K. Wong wrote: Well, the example code at http://www.python.org/ ... /subprocess.html#replacing-shell-pipeline has the same issue: Perhaps the doc can be improved to remind folks to close p1.stdout if the calling process doesn't need it, unless

Re: Ask how to use HTMLParser

2010-01-10 Thread Nobody
On Fri, 08 Jan 2010 11:44:48 +0800, Water Lin wrote: I am a new guy to use Python, but I want to parse a html page now. I tried to use HTMLParse. Here is my sample code: -- from HTMLParser import HTMLParser Note that HTMLParser only tokenises HTML; it doesn't actually

Re: lightweight encryption of text file

2010-01-10 Thread Nobody
On Fri, 08 Jan 2010 20:14:51 +0100, Daniel Fetchinson wrote: I have a plain text file which I would like to protect in a very simple minded, yet for my purposes sufficient, way. I'd like to encrypt/convert it into a binary file in such a way that possession of a password allows anyone to

Re: lightweight encryption of text file

2010-01-10 Thread Nobody
On Sun, 10 Jan 2010 09:59:31 +0100, Daniel Fetchinson wrote: Thanks, this looks very simple too, but where is the decryption code? Wikipedia seems to suggest that encryption and decryption are both the same but running crypt on the output of crypt doesn't give back the original string. So

Re: lightweight encryption of text file

2010-01-10 Thread Nobody
On Sun, 10 Jan 2010 15:30:12 +, Steven D'Aprano wrote: Thanks, this looks very simple too, but where is the decryption code? Wikipedia seems to suggest that encryption and decryption are both the same but running crypt on the output of crypt doesn't give back the original string. So

Re: integer and string compare, is that correct?

2010-01-10 Thread Nobody
Hellmut Weber wrote: being a causal python user (who likes the language quite a lot) it took me a while to realize the following: max = '5' n = 5 n = max False Section 5.9 Comparison describes this. Can someone give me examples of use cases Peter Otten wrote: The use cases

Re: lightweight encryption of text file

2010-01-10 Thread Nobody
On Sun, 10 Jan 2010 08:54:51 -0800, Paul Rubin wrote: Nobody nob...@nowhere.com writes: RC4 (aka ArcFour) is quite trivial to implement, and better than inventing your own cipher or using a Vignere: ... That's a cute implementation, but it has no authentication and doesn't include any

Re: lightweight encryption of text file

2010-01-10 Thread Nobody
On Sun, 10 Jan 2010 12:26:05 -0800, Paul Rubin wrote: I'd like it a lot if the Python stdlib could include a serious cryptography module. And I'd like a truckload of gold ;) Right now, even asking for HTTPS support is too much to ask. Heck, even asking for the fake HTTPS support to be

Re: integer and string compare, is that correct?

2010-01-11 Thread Nobody
On Sun, 10 Jan 2010 23:13:55 -0800, Dan Bishop wrote: If you actually need to perform comparisons across types, you can rely upon the fact that tuple comparisons are non-strict and use e.g.:         a = 5         b = '5'         (type(a).__name__, a) (type(b).__name__, b)         True

Re: sys.stdout vs. sys.stderr

2010-01-11 Thread Nobody
On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote: In Python 3.1 is there any difference in the buffering behavior of the initial sys.stdout and sys.stderr streams? No. Were they different at some earlier point in Python's evolution? That depends on the operating system. These

Re: pyserial: Unexpected Local Echo

2010-01-11 Thread Nobody
On Mon, 11 Jan 2010 23:27:03 +0800, Steven Woody wrote: I am using pyserial. But I always get the local echo after I write some characters onto serial port and I find no way to disable this behavior. When I say 'local echo', I mean the next read operation will get characters that was just

Re: Interesting (?) problem

2010-01-11 Thread Nobody
On Mon, 11 Jan 2010 18:57:24 +0100, mk wrote: I have two lists of IP addresses: hostips = [ 'a', 'b', 'c', 'd', 'e' ] thread_results = [ 'd', 'b', 'c' ] I need to sort thread_results in the same order as hostips. P.S. One clarification: those lists are actually more complicated

Re: Is python not good enough?

2010-01-15 Thread Nobody
On Fri, 15 Jan 2010 12:34:17 -0800, John Nagle wrote: Actually, no. It's quite possible to make a Python implementation that runs fast. It's just that CPython, a naive interpreter, is too primitive to do it. I was really hoping that Google would put somebody good at compilers in charge

Re: chr(12) Form Feed in Notepad

2010-01-15 Thread Nobody
On Fri, 15 Jan 2010 10:42:43 -0800, W. eWatson wrote: I thought I'd put a page break, chr(12), character in a txt file I wrote to skip to the top of the page. It doesn't work. Comments? The 1970's are over, and neither Notepad nor your printer attempts to maintain compatibility with a

Re: substitution

2010-01-18 Thread Nobody
On Mon, 18 Jan 2010 11:21:54 +0100, superpollo wrote: what is the most pythonic way to substitute substrings? say the subs are: quuux -- foo foo -- bar baz -- quux then i cannot apply the subs in sequence (say, .replace() in a loop), otherwise: fooxxxbazyyyquuux -- fooxxxbazyyyfoo

Re: subprocess troubles

2010-01-22 Thread Nobody
On Thu, 21 Jan 2010 11:25:08 +0100, Tomas Pelka wrote: have a problem with following piece of code: -- import subprocess paattern = python cmd = /usr/bin/locate arg1 = -i arg2 = -d /var/www/books/mlocate.db arg3 = str( + pattern) p1

Re: medians for degree measurements

2010-01-22 Thread Nobody
On Fri, 22 Jan 2010 16:09:03 -0800, Steve Howell wrote: I just saw the thread for medians, and it reminded me of a problem that I need to solve. We are writing some Python software for sailing, and we need to detect when we've departed from the median heading on the leg. Calculating

Re: Problems with the date of modification of files on the flash drive in windows

2010-01-22 Thread Nobody
On Fri, 22 Jan 2010 21:23:37 -0800, Aleksey wrote: I write crossplatform program and have next problem under windows (under linux is all OK) : I'm trying to get the UTC modification date of files on the flash drive under windows. In the flash card system is FAT. Timestamps stored on a FAT

Re: Default path for files

2010-01-30 Thread Nobody
On Sun, 24 Jan 2010 15:08:15 +, Rotwang wrote: Hi all, can anybody tell me whether there's a way to change the default location for files to be opened by open()? I'd like to be able to create files somewhere other than my Python folder without having to write the full path in the filename

Re: myths about python 3

2010-01-30 Thread Nobody
On Wed, 27 Jan 2010 12:56:10 -0800, John Nagle wrote: Arguably, Python 3 has been rejected by the market. Arguably, Python 3 has not yet been accepted by the market. Part of it is down to a catch-22: applications won't use Python 3 if the libraries on which they depend don't support it, and

Re: Python and Ruby

2010-01-30 Thread Nobody
On Wed, 27 Jan 2010 15:29:05 -0800, Jonathan Gardner wrote: There's a lot of magic in Ruby as well. For instance, function calls are made without parentheses. That's also true for most functional languages, e.g. Haskell and ML, as well as e.g. Tcl and most shells. Why require f(x) or (f x) if

Re: Keyboard input

2010-01-30 Thread Nobody
On Fri, 29 Jan 2010 16:53:43 +, Mr.SpOOn wrote: I'm using the raw_input method and it works fine, but I noted that I can't use backspace and when I accidentally press shift space (because I need to input uppercase letters separated by a space) it writes some strange characters. So, is

Re: Utility to screenscrape sites using javascript ?

2010-01-30 Thread Nobody
On Sat, 30 Jan 2010 06:21:01 -0800, KB wrote: I have a service I subscribe to that uses javascript to stream news. Ideally I would like to use python to parse the information for me. Note there is an option to take a static snapshot of the current stream but that is still done via Javascript.

Re: Python and Ruby

2010-01-31 Thread Nobody
On Sat, 30 Jan 2010 16:58:34 +, tanix wrote: I'm not familiar with Ruby, but most languages are cleaner than Python once you get beyond the 10-minute introduction stage. I'd have to agree. The only ones that beat Python in that department are Javascript and PHP. Plus CSS and HTML if you

Re: Python and Ruby

2010-01-31 Thread Nobody
On Sun, 31 Jan 2010 03:01:51 -0800, rantingrick wrote: That's also true for most functional languages, e.g. Haskell and ML, as well as e.g. Tcl and most shells. Why require f(x) or (f x) if f x will suffice? yuck! wrapping the arg list with parenthesis (python way) makes the most sense.

Re: Utility to screenscrape sites using javascript ?

2010-01-31 Thread Nobody
On Sat, 30 Jan 2010 11:28:47 -0800, KB wrote: I have a service I subscribe to that uses javascript to stream news. There's a Python interface to SpiderMonkey (Mozilla's JavaScript interpreter): http://pypi.python.org/pypi/python-spidermonkey Thanks! I don't see a documentation page,

Re: What's the Scoop on \\ for Paths? (Win)

2010-01-31 Thread Nobody
On Sun, 31 Jan 2010 13:41:55 -0600, Tim Chase wrote: The previous absolute-path fails in cmd.exe for a variety of apps because the / is treated as a parameter/switch to the various programs. Fortunately, the Python path-handling sub-system is smart enough to do the right thing, even when

Re: Python and Ruby

2010-02-01 Thread Nobody
On Sun, 31 Jan 2010 22:36:32 +, Steven D'Aprano wrote: for example, in if you have a function 'f' which takes two parameters to call the function and get the result you use: f 2 3 If you want the function itself you use: f How do you call a function of no arguments? There's

Re: Python and Ruby

2010-02-01 Thread Nobody
On Mon, 01 Feb 2010 14:35:57 -0800, Jonathan Gardner wrote: If it was common-place to use Curried functions and partial application in Python, you'd probably prefer f a b c to f(a)(b)(c) as well. That's just the point. It isn't common to play with curried functions or monads or anything

Re: Python and Ruby

2010-02-01 Thread Nobody
On Mon, 01 Feb 2010 14:13:38 -0800, Jonathan Gardner wrote: I judge a language's simplicity by how long it takes to explain the complete language. That is, what minimal set of documentation do you need to describe all of the language? That's not a particularly good metric, IMHO. A simple

Re: HTML Parser which allows low-keyed local changes?

2010-02-01 Thread Nobody
On Sun, 31 Jan 2010 20:57:31 +0100, Robert wrote: I tried lxml, but after walking and making changes in the element tree, I'm forced to do a full serialization of the whole document (etree.tostring(tree)) - which destroys the human edited format of the original HTML code. makes it rather

Re: How to guard against bugs like this one?

2010-02-02 Thread Nobody
be lexically scoped. The general pattern is: 1) You have something which refers to a resource by name. 2) There is a sequence of places which are searched for this name. Searching the current directory by default is the problem. Nobody in their right mind has . in the shell PATH and IMO

Re: Need help with a program

2010-02-03 Thread Nobody
On Tue, 02 Feb 2010 15:07:05 -0800, Aahz wrote: If you have a problem and you think that regular expressions are the solution then now you have two problems. Regex is really overkill for the OP's problem and it certainly doesn't improve readability. If you're going to use a quote, it works

Re: converting XML to hash/dict/CustomTreeCtrl

2010-02-03 Thread Nobody
On Wed, 03 Feb 2010 08:07:50 +1100, Astan Chee wrote: Sorry for being vague but here my question about converting an xml into a dict. I found some examples online but none gives the dict/result I want. Which is kinda wrong. I expect the dict to have the Space usage summary, but it

Re: How to guard against bugs like this one?

2010-02-03 Thread Nobody
On Tue, 02 Feb 2010 10:38:53 -0800, Carl Banks wrote: I don't know if that's necessary. Only supporting the foo.h case would work fine if Python behaved like gcc, i.e. if the current directory referred to the directory contain the file performing the import rather than in the process' CWD.

Re: Refreshing of urllib.urlopen()

2010-02-04 Thread Nobody
On Wed, 03 Feb 2010 21:33:08 -0600, Michael Gruenstaeudl wrote: I am fairly new to Python and need advice on the urllib.urlopen() function. The website I am trying to open automatically refreshes after 5 seconds and remains stable thereafter. With urllib.urlopen().read() I can only read

Re: read a process output with subprocess.Popen

2010-02-04 Thread Nobody
On Thu, 04 Feb 2010 04:28:20 -0800, Ashok Prabhu wrote: I m trying a read the output of a process which is running continuously with subprocess.Popen. However the readline() method hangs for the process to finish. Please let me know if the following code can be made to work with

Re: Repost: Read a running process output

2010-02-05 Thread Nobody
On Fri, 05 Feb 2010 03:57:17 -0800, Ashok Prabhu wrote: I very badly need this to work. I have been googling out for a week with no significant solution. I open a process p1 which does keeps running for 4+ hours. It gives some output in stdout now and then. I open this process with

  1   2   3   4   5   6   7   8   >