Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Nobody
On Thu, 09 Sep 2010 12:23:17 -0700, Ethan Furman wrote: basically a Queue is a syncronization primitive used to share and pass data to and from parent/child processes. A pipe is as the name suggests, a socket pair connected end-to-end allowing for full-duplex communications. Isn't a

Re: accessing a text file

2010-09-09 Thread Nobody
On Wed, 08 Sep 2010 03:30:00 -0700, Baba wrote: Who is licensed to judge what can and cannot be posted as a question? Exactly the same set of people who are licensed to judge what can and cannot be posted as an answer. If you don't like the responses you get here, you could try posting your

Re: Catching a SIGSEGV signal on an import

2010-09-09 Thread Nobody
On Thu, 09 Sep 2010 05:23:14 -0700, Ryan wrote: But, since SIGSEGV is asynchronous SIGSEGV is almost always synchronous. In general, is there anyway to catch a SIGSEGV on import? No. If SIGSEGV is raised, it often indicates that memory has been corrupted. At that point, you can't assume

Re: Speed-up for loops

2010-09-03 Thread Nobody
On Fri, 03 Sep 2010 11:21:36 +0200, Michael Kreim wrote: An anonymous Nobody suggested to use Numpy. I did not do this, because I am very very new to Numpy and I did not figure out a Numpy specific way to do this. Maybe a Numpy expert has something for me? The problem with giving examples

Re: killing all subprocess childrens

2010-09-02 Thread Nobody
On Thu, 02 Sep 2010 13:12:07 +1000, Astan Chee wrote: I have a piece of code that looks like this: import subprocess retcode = subprocess.call([java,test,string]) print Exited with retcode + str(retcode) What I'm trying to do (and wondering if its possible) is to make sure that any

Re: python path separator

2010-09-02 Thread Nobody
On Wed, 01 Sep 2010 23:57:21 -0700, swapnil wrote: I could not find any documentation for variables os.path.sep and os.path.altsep. Although the first is pretty straightforward can anyone explain the purpose of the second variable? Is it even useful? The purpose is so that you can do e.g.:

Re: Speed-up for loops

2010-09-02 Thread Nobody
On Thu, 02 Sep 2010 12:02:40 +0200, Michael Kreim wrote: I was comparing the speed of a simple loop program between Matlab and Python. imax = 10 a = 0 for i in xrange(imax): a = a + 10 print a Are there any ways to speed up the for/xrange loop? Sure; the above can be

Re: Saving (unusual) linux filenames

2010-08-31 Thread Nobody
On Tue, 31 Aug 2010 18:13:44 +0100, MRAB wrote: this works for normal paths but as soon as i have a path that does include a , it breaks. The problem now is that (afaik) linux allows every char (aside from / and null) to be used in filenames. The only solution i can think of is using null as

Re: Saving (unusual) linux filenames

2010-08-31 Thread Nobody
On Tue, 31 Aug 2010 18:49:33 +, Grant Edwards wrote: How many filenames contain control characters? How many filenames contain ,? Not many, Unless you only ever deal with Unix folk, it's not /that/ uncommon to encounter filenames which are essentially complete sentences, punctuation

Re: How to convert (unicode) text to image?

2010-08-30 Thread Nobody
On Mon, 30 Aug 2010 12:50:32 +0200, Thomas Jollans wrote: Face the facts dude. The Python docs have some major problems. They were pretty good when Python was a new, cool, project used by a handful of geeks. They are good relative to the average (whatever that is) open source project -- but

Re: shlex, unicode, and subprocess.Popen on Windows

2010-08-30 Thread Nobody
On Mon, 30 Aug 2010 10:24:26 -0400, python wrote: Kudos for avoiding shell=True My understanding is that the only time one needs to use shell=True is when they are 'executing' a non-executable file whose executable must be discovered via file association rules? Does that sound accurate?

Re: Reading the access attributes of directories in Windows

2010-08-27 Thread Nobody
On Fri, 27 Aug 2010 13:28:46 +0600, Rami Chowdhury wrote: Having this as a separate permission allows normal users to add entries to log files but not to erase existing entries. Unix/Linux systems can do this already. Ooh, I didn't know that -- what combination of permissions would I have

Re: Writing byte stream as jpeg format to disk

2010-08-27 Thread Nobody
On Thu, 26 Aug 2010 23:56:26 -0700, Bryan wrote: follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 argument to make sure that you do not split on spurious b'\r\n\r\n' sequences inside the JPEG body. Do not decode the bytes. Correct, and I'll add that this is a case where we

Re: Discarding STDERR generated during subprocess.popen

2010-08-23 Thread Nobody
On Mon, 23 Aug 2010 10:38:02 -0700, Leon Derczynski wrote: I would like to run an external program, and discard anything written to stderr during its execution, capturing only stdout. My code currently looks like: def blaheta_tag(filename): blaheta_dir =

Re: Reading the access attributes of directories in Windows

2010-08-21 Thread Nobody
On Fri, 20 Aug 2010 19:41:44 +0200, Thomas Jollans wrote: Create Folders and Delete Subfolders and Files correspond to having write permission on a directory. How does append differ from write? If you have appending permissions, but not writing ones, is it impossible to seek? Or is there a

Re: path to data files

2010-08-19 Thread Nobody
On Thu, 19 Aug 2010 14:30:34 +0200, Alain Ketterlin wrote: If a python module requires a data file to run how would I reference this data file in the source in a way that does not depend on whether the module is installed system-wide, installed in $HOME/.local or is just placed in a directory

Re: Reading the access attributes of directories in Windows

2010-08-19 Thread Nobody
On Fri, 20 Aug 2010 00:04:29 +0200, Thomas Jollans wrote: This brings up an interesting, but probably quite complicated question: is it reasonable to try to express Windows permissions using full POSIX ACLs Do Windows NT permissions do anything more? Or, apart from the executable bit,

Re: when 'myArray * 'myObject' is not equal to 'myObject' * 'myArray'

2010-08-18 Thread Nobody
On Wed, 18 Aug 2010 05:56:27 -0700, Duim wrote: Although I'm sure somewhere this issue is discussed in this (great) group, I didn't know the proper search words for it (although I tried). I'm using python (2.6) scientifically mostly, and created a simple class to store time series (my

Re: 79 chars or more?

2010-08-17 Thread Nobody
On Mon, 16 Aug 2010 22:35:49 -0400, AK wrote: As monitors are getting bigger, is there a general change in opinion on the 79 chars limit in source files? I've experimented with 98 characters per line and I find it quite a bit more comfortable to work with that length, even though sometimes I

Re: writing \feff at the begining of a file

2010-08-13 Thread Nobody
On Fri, 13 Aug 2010 11:45:28 +0200, Jean-Michel Pichavant wrote: I'm trying to update the content of a $Microsoft$ VC2005 project files using a python application. Since those files are XML data, I assumed I could easily do that. My problem is that VC somehow thinks that the file is

Re: Line-by-line processing when stdin is not a tty

2010-08-12 Thread Nobody
On Wed, 11 Aug 2010 18:49:26 -0700, RG wrote: This doesn't explain why cat | cat when run interactively outputs line-by-line (which it does). STDIN to the first cat is a TTY, but the second one isn't. GNU cat doesn't use stdio, it uses read() and write(), so there isn't any buffering. For

Re: Floating numbers

2010-08-12 Thread Nobody
On Thu, 12 Aug 2010 18:19:40 -0700, Benjamin Kaplan wrote: But that's not keeping the number the way it was typed. It's just not showing you the exact approximation. Nor is 34.523 showing you the exact approximation. The closest double to 34.52 is 4858258098025923 / 2**47, whose

Re: Importing libs on Windows?

2010-08-12 Thread Nobody
On Thu, 12 Aug 2010 16:09:10 -0700, Brian Salter wrote: I've seen a number of tutorials that describe how to bring in a dll in python, but does anybody know of a tutorial for how to bring in a lib? Is it even possible? No. ctypes relies upon the OS to actually load the library, and the OS

Re: How to capture all the environment variables from shell?

2010-08-11 Thread Nobody
On Wed, 11 Aug 2010 13:08:59 +1000, Cameron Simpson wrote: The reason .bashrc gets overused for envars, aside from ignorance and propagated bad habits, is that in a GUI desktop the setup sequence is often a bit backwards. A conventional terminal/console login means you get a login shell that

Re: Line-by-line processing when stdin is not a tty

2010-08-11 Thread Nobody
On Wed, 11 Aug 2010 10:32:41 +, Tim Harig wrote: Usually you either need an option on the upstream program to tell it to line buffer explicitly once cat had an option -u doing exactly that but nowadays -u seems to be ignored

Re: easy question on parsing python: is not None

2010-08-09 Thread Nobody
On Mon, 09 Aug 2010 04:41:23 -0700, saeed.gnu wrote: x is not None is a really silly statement!! because id(None) and id of any constant object is not predictable! I don't know whay people use is instead of ==. you should write if x!=None instead of x is not None No, you should use the

Re: Is there any way to minimize str()/unicode() objects memory usage [Python 2.6.4] ?

2010-08-07 Thread Nobody
On Fri, 06 Aug 2010 18:39:27 -0700, dmtr wrote: Steven, thank you for answering. See my comments inline. Perhaps I should have formulated my question a bit differently: Are there any *compact* high performance containers for unicode()/str() objects in Python? By *compact* I don't mean

Re: Python why questions

2010-08-07 Thread Nobody
On Sat, 07 Aug 2010 09:53:48 -0400, D'Arcy J.M. Cain wrote: A new born baby is in his/her first year. It's year 1 of his/her life. For this reason, also the year 0 doesn't exist. From the fact that a baby can be half a year old, you derive that arrays should have floats as indices?

Re: Python why questions

2010-08-07 Thread Nobody
On Sat, 07 Aug 2010 13:48:32 +0200, News123 wrote: Common sense is wrong. There are many compelling advantages to numbering from zero instead of one: http://lambda-the-ultimate.org/node/1950 It makes sense in assembly language and even in many byte code languages. It makes sense if

Re: How to read large amounts of output via popen

2010-08-06 Thread Nobody
On Fri, 06 Aug 2010 02:06:29 -0700, loial wrote: I need to read a large amount of data that is being returned in standard output by a shell script I am calling. (I think the script should really be writing to a file but I have no control over that) If the script is writing to stdout, you

Re: subprocess escaping POpen?!

2010-08-05 Thread Nobody
On Thu, 05 Aug 2010 12:23:35 +0100, Chris Withers wrote: ...then the output is indeed captured. So, what is svn doing differently? How is it escaping its jail? maybe it does not read from stdin but directly from /dev/tty But why only the request for auth credentials? So that you can do

Re: ctypes: pointer to method

2010-08-05 Thread Nobody
On Thu, 05 Aug 2010 10:50:21 -0700, Martin Landa wrote: is it possible to pass pointer to a method using ctypes. I don't know about methods, but it works for functions. Sample code: ... G_set_error_routine(byref(self._print_error)) This won't work; you have to be more explicit,

Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 17:17:35 -0700, Peter wrote: But I always used to tell people - by the time I got a program to compile then I figured 99% of the bugs were already discovered! Try that with C/C++ or almost any other language you care to name :-) ML and Haskell are also quite good for this

Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 15:18:30 -0700, sturlamolden wrote: Has it ever been planned to rewrite in C++ the historical implementation (of course in an object oriented design) ? OO programming is possible in C. Just take a look at GNOME and GTK. One feature which can't readily be implemented in

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Nobody
On Mon, 02 Aug 2010 23:27:37 +0200, Zdenek Maxa wrote: I need to start a process (using subprocess.Popen()) and wait until the new process either fails or successfully binds a specified port. The fuser command seems to be indented exactly for this purpose. Could anyone please provided a hint

Re: Why is python not written in C++ ?

2010-08-03 Thread Nobody
On Tue, 03 Aug 2010 18:48:24 +1000, James Mills wrote: One feature which can't readily be implemented in C is the automatic clean-up side of the RAII idiom. C is a Turing-Complete Language is it not ? If so, therefore is it not true anything can be implemented ? Even the automated

Re: run subprocesses in parallel

2010-08-02 Thread Nobody
On Mon, 02 Aug 2010 14:21:38 +0200, Christian Heimes wrote: You might want to drop shell=True and use a list as arguments instead. The two issues (whether shell is True/False and whether the command is a list or string) are orthogonal. You should always use a list for the command, unless you

Re: Ascii to Unicode.

2010-07-29 Thread Nobody
On Thu, 29 Jul 2010 23:49:40 +, Steven D'Aprano wrote: It looks to me like Python uses a 16-bit implementation internally, It typically uses the platform's wchar_t, which is 16-bit on Windows and (typically) 32-bit on Unix. IIRC, it's possible to build Python with 32-bit Unicode on

Re: How to capture all the environment variables from shell?

2010-07-27 Thread Nobody
On Mon, 26 Jul 2010 21:42:24 -0500, Tim Chase wrote: Please! Never export anything from your .bashrc unless you really know what you're doing. Almost all exports should be done in your .bash_profile Could you elaborate on your reasoning why (or why-not)? I've found that my .bash_profile

Re: Unicode error

2010-07-25 Thread Nobody
On Fri, 23 Jul 2010 18:27:50 -0400, Terry Reedy wrote: But in the meanwhile, once you get an error, you know what it is. You can intentionally feed code bad data and see what you get. And then maybe add a test to make sure your code traps such errors. That doesn't really help with

Re: Unicode error

2010-07-25 Thread Nobody
On Sun, 25 Jul 2010 14:47:11 +, Steven D'Aprano wrote: But in the meanwhile, once you get an error, you know what it is. You can intentionally feed code bad data and see what you get. And then maybe add a test to make sure your code traps such errors. That doesn't really help with

Re: non-blocking IO EAGAIN on write

2010-07-23 Thread Nobody
On Fri, 23 Jul 2010 10:45:32 +0200, Thomas Guettler wrote: I use non-blocking io to check for timeouts. Sometimes I get EAGAIN (Resource temporarily unavailable) on write(). My working code looks like this. But I am unsure how many bytes have been written to the pipe if I get an EAGAIN

Re: Unicode error

2010-07-23 Thread Nobody
On Fri, 23 Jul 2010 10:42:26 +, Steven D'Aprano wrote: Don't write bare excepts, always catch the error you want and nothing else. That advice would make more sense if it was possible to know which exceptions could be raised. In practice, that isn't possible, as the documentation seldom

Re: Kick off a delete command from python and not wait

2010-07-20 Thread Nobody
On Tue, 20 Jul 2010 10:32:12 -0700, Chris Rebert wrote: I believe you need to /eventually/ call .wait() as shown to avoid the child becoming a zombie process. Alternatively, you can call .poll() periodically. This is similar to .wait() insofar as it will reap the process if it has terminated,

Re: why is this group being spammed?

2010-07-19 Thread Nobody
On Sun, 18 Jul 2010 15:18:59 -0700, sturlamolden wrote: why is this group being spammed? There used to be bots that issued cancel messages against spam, but I don't think they are actively maintained anymore. Mostly because cancel messages are invariably ignored nowadays. --

Re: how to copy and move file with its attribute?

2010-07-19 Thread Nobody
On Mon, 19 Jul 2010 17:57:31 +0100, MRAB wrote: About this one. I tried the os.system copy. But it seems I cant find the right syntax. *os.system (xcopy /s %s %s % (dirname1, dirname2))* This one seems to not working. In what way doesn't it work? If the names contain spaces then

Re: CPython Signal Handler Check for SIGKILL

2010-07-19 Thread Nobody
On Mon, 19 Jul 2010 20:06:16 +0200, Antoine Pitrou wrote: So, in short, Python doesn't check SIGKILL by itself. It's just forbidden by the underlying C standard library, Actually, it's forbidden by the kernel. The C library just passes along the error to Python, which just passes it to the

Re: Python -- floating point arithmetic

2010-07-07 Thread Nobody
On Wed, 07 Jul 2010 15:08:07 +0200, Thomas Jollans wrote: you should never rely on a floating-point number to have exactly a certain value. Never is an overstatement. There are situations where you can rely upon a floating-point number having exactly a certain value. First, floating-point

Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)

2010-07-03 Thread Nobody
On Fri, 02 Jul 2010 12:07:33 -0700, John Nagle wrote: I think one point which needs to be emphasized more is what does python 3 bring to people. The what's new in python 3 page gives the impression that python 3 is about removing cruft. That's a very poor argument to push people to switch.

Re: subprocess query

2010-07-03 Thread Nobody
On Sat, 03 Jul 2010 10:33:49 -0400, Sudheer wrote: What's wrong with the following code. The program waits indefenitely at 'output = p2.stdout.read()' from subprocess import * p1=Popen(['tr', 'a-z', 'A-Z'],stdin=PIPE,stdout=PIPE) p2=Popen(['tr','A-Z',

Re: [farther OT] Re: Why Is Escaping Data Considered So Magical?

2010-07-01 Thread Nobody
On Wed, 30 Jun 2010 23:40:06 -0600, Michael Torrie wrote: Given char buf[512], buf's type is char * according to the compiler and every C textbook I know of. No, the type of buf is char [512], i.e. array of 512 chars. If you use buf as an rvalue (rather than an lvalue), it will be implicitly

Re: Very odd output from subprocess

2010-07-01 Thread Nobody
On Wed, 30 Jun 2010 21:12:12 -0700, m wrote: If I add the line: for l in line: print ord(l),'\t',l after the first readline, I get the following: 27 91[ 480 480 109 m 27 91[ 513 557 109 m before the codes begin for the string as it

Re: Why are String Formatted Queries Considered So Magical?

2010-06-30 Thread Nobody
On Tue, 29 Jun 2010 08:41:03 -0400, Roy Smith wrote: And what about regular expressions? What about them? As the saying goes: Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. That's silly. RE is a

Re: Why are String Formatted Queries Considered So Magical?

2010-06-29 Thread Nobody
On Tue, 29 Jun 2010 12:30:36 +1200, Lawrence D'Oliveiro wrote: Seriously, almost every other kind of library uses a binary API. What makes databases so special that they need a string-command based API? HTML is also effectively a string-based API. HTML is a data format. The sane way to

Re: Why Is Escaping Data Considered So Magical?

2010-06-27 Thread Nobody
On Sun, 27 Jun 2010 14:36:10 +1200, Lawrence D'Oliveiro wrote: In any case, you're still trying to make arguments about whether it's easy or hard to get it right, which completely misses the point. Eliminating the escaping entirely makes it impossible to get it wrong. Except nobody has yet

Re: Why Is Escaping Data Considered So Magical?

2010-06-26 Thread Nobody
On Sat, 26 Jun 2010 12:40:41 +1200, Lawrence D'Oliveiro wrote: I construct ad-hoc queries all the time. It really isn’t that hard to do safely. Wrong. Even if you get the quoting absolutely correct (which is a very big if), you have to remember to perform it every time, without

Re: Why Is Escaping Data Considered So Magical?

2010-06-26 Thread Nobody
On Fri, 25 Jun 2010 20:43:51 -0400, Roy Smith wrote: To bring this back to something remotely Python related, the point of all this is that security is hard. Oh, this isn't solely a security issue. Ask anyone with a surname like O'Neil, O'Connor, O'Leary, etc; they've probably broken a lot

Re: improving python performance by extension module (64bit)

2010-06-26 Thread Nobody
On Fri, 25 Jun 2010 20:08:27 -0400, geremy condra wrote: I have written Haskell that runs faster than C, and Forth that runs faster than C, Faster than *what* C, though? With Haskell, there's seldom a significant performance hit for using -fvia-C, so you would probably have been able to get

Re: I strongly dislike Python 3

2010-06-26 Thread Nobody
On Sat, 26 Jun 2010 18:33:02 +0200, Thomas Jollans wrote: * str is now unicode = unicode is no longer a pain in the a True. Now byte strings are a pain in the arse. -- http://mail.python.org/mailman/listinfo/python-list

Re: I strongly dislike Python 3

2010-06-26 Thread Nobody
On Sat, 26 Jun 2010 21:08:48 +0200, Martin v. Loewis wrote: I think that's not true. If enough people want to support Python 2 it might be possible to advance Python 2. That won't be sufficient: enough people wanting support won't have any effect. People also need to want it enough to

Re: Why Is Escaping Data Considered So Magical?

2010-06-25 Thread Nobody
On Fri, 25 Jun 2010 12:25:56 +1200, Lawrence D'Oliveiro wrote: Just been reading this article ... which says that a lot of security holes are arising these days because everybody is concentrating on unit testing of their own particular components, with less attention being devoted to overall

Re: Why Is Escaping Data Considered So Magical?

2010-06-25 Thread Nobody
On Fri, 25 Jun 2010 12:15:08 +, Jorgen Grahn wrote: I don't do SQL and I don't even understand the terminology properly ... but the discussion around it bothers me. Do those people really do this? Yes. And then some. Among web developers, the median level of programming knowledge

Re: Pythonic Idiom For Searching An Include Path

2010-06-24 Thread Nobody
On Wed, 23 Jun 2010 17:27:16 -0500, Tim Daneliuk wrote: Given a program 'foo' that takes a command line argument '-I includefile', I want to be able to look for 'includefile' in a path specified in an environment variable, 'FOOPATH'. I'd like a semantic that says: If 'includefile'

Re: daemonizing after binding to port

2010-06-20 Thread Nobody
On Sun, 20 Jun 2010 20:00:14 +1000, Ben Finney wrote: I'm starting a SocketServer.TCPServer in my program, but since I want to report problems to script starting the program, I want to go daemon *after* TCPServer has done binding to port. Is this likely to cause problems? I mean, my client

Re: Pick items from list with probability based upon property of list member ?

2010-06-20 Thread Nobody
On Sun, 20 Jun 2010 03:19:55 -0700, southof40 wrote: I want to select an object from the list with a probability of : cars 0.7, bikes 0.3, trucks 0.1. I've currently implemented this by creating another list in which each car object from the original list appears 7 times, each bike 3 times

Re: How do I fix this test so it runs on Windows? (it uses tzset)

2010-06-18 Thread Nobody
On Thu, 17 Jun 2010 11:45:03 +0100, Chris Withers wrote: For whatever reason, tython's time module doesn't provide the tzset() function on Windows. However, you should be able to use it via ctypes. This sounds pretty heavyweight for a unit test. I'm not even sure how I would do this ;-)

Re: Communicating with a program using subprocess

2010-06-18 Thread Nobody
On Thu, 17 Jun 2010 11:22:37 +0200, Laurent Verweijen wrote: This is easy to understand, but I want to pipe it's input/output by another python program. (I will show what I am doing on the console to test it) from subprocess import * p =

Re: How do I fix this test so it runs on Windows? (it uses tzset)

2010-06-16 Thread Nobody
On Wed, 16 Jun 2010 16:30:02 +0100, Chris Withers wrote: I'd like to make test_non_gmt_timezone at the bottom of https://... run on Windows, any suggestions? MSVCRT has _tzset(), which understands the TZ environment variable. http://msdn.microsoft.com/en-us/library/90s5c885%28VS.80%29.aspx

Re: Writing to open subprocess pipes.

2010-06-16 Thread Nobody
On Wed, 16 Jun 2010 16:29:42 -0400, Brandon McGinty wrote: Both subprocess and os.popen* only allow inputput and output one time, and the output to be read only when the process terminates. This is incorrect; you can read from and write to the pipe as you wish. However: you may have problems

Re: Python OpenSSL library

2010-06-15 Thread Nobody
On Tue, 15 Jun 2010 22:57:24 +0200, Antoine Pitrou wrote: Also, following issue1589 (certificate hostname checking), I think it would be useful at least to provide the necessary helper functions in order to check certificate conformity, even if they aren't called implicitly. I would encourage

Re: Python OpenSSL library

2010-06-14 Thread Nobody
On Mon, 14 Jun 2010 10:43:02 -0700, John Nagle wrote: The new SSL module in Python 2.6 There isn't an SSL module in Python 2.6. There is a module named ssl which pretends to implement SSL, but in fact doesn't. is convenient, but insecure. In which case, it isn't actually convenient, in

Re: How do subprocess.Popen(ls | grep foo, shell=True) with shell=False?

2010-06-12 Thread Nobody
On Thu, 10 Jun 2010 08:40:03 -0700, Chris Seberino wrote: On Jun 10, 6:52 am, Nobody nob...@nowhere.com wrote: Without the p1.stdout.close(), if the reader (grep) terminates before consuming all of its input, the writer (ls) won't terminate so long as Python retains the descriptor

Re: How do subprocess.Popen(ls | grep foo, shell=True) with shell=False?

2010-06-10 Thread Nobody
On Wed, 09 Jun 2010 21:15:48 -0700, Chris Seberino wrote: How do subprocess.Popen(ls | grep foo, shell=True) with shell=False? The same way that the shell does it, e.g.: from subprocess import Popen, PIPE p1 = Popen(ls, stdout=PIPE) p2 = Popen([grep, foo], stdin=p1.stdout, stdout = PIPE)

Re: GUIs - A Modest Proposal

2010-06-07 Thread Nobody
On Sun, 06 Jun 2010 15:55:41 -0700, ant wrote: If we are to make progress, I can see two obvious approaches: 1) Improve Tkinter to the point where it is supportable and supported by a good fraction of Python programmers or 2) Drop Tkinter as the default and use something else. You forgot:

Re: Reading file bit by bit

2010-06-07 Thread Nobody
On Mon, 07 Jun 2010 02:31:08 -0700, Richard Thomas wrote: You're reading those bits backwards. You want to read the most significant bit of each byte first... Says who? There is no universal standard for bit-order. Among bitmap image formats, XBM is LSB-first while BMP and PBM are MSB-first.

Re: Replace in large text file ?

2010-06-06 Thread Nobody
On Sat, 05 Jun 2010 16:35:42 +0100, MRAB wrote: In plain language what I wish to do is: Remove all comma's Replace all @ with comma's input_file = open(some_huge_file.txt, r) output_file = open(newfilename.txt, w) for line in input_file: I'd probably process it in larger chunks:

Re: Help (I can't think of a better title)

2010-05-23 Thread Nobody
On Sat, 22 May 2010 17:16:40 -0700, Lanny wrote: Ideally roomlist['start_room'].exits would equal {'aux_room' : 'west', 'second_room' : 'north'} but it doesn't. Sorry if this is unclear or too long, but I'm really stumped why it is giving bad output Just to condense a point which the other

Re: write a 20GB file

2010-05-15 Thread Nobody
On Fri, 14 May 2010 18:38:55 -0400, J wrote: someone smarter than me can correct me, but file.write() will write when it's buffer is filled, or close() or flush() are called. And, in all probability, seek() will either flush it immediately or cause the next write() to flush it before writing

Re: Is Python a functional programming language?

2010-05-14 Thread Nobody
On Tue, 11 May 2010 18:31:03 -0700, Paul Rubin wrote: is called an equation rather than an assignment. It declares x is equal to 3, rather than directing x to be set to 3. If someplace else in the program you say x = 4, that is an error, normally caught by the compiler, since x cannot be

Re: Is Python a functional programming language?

2010-05-14 Thread Nobody
On Thu, 13 May 2010 12:29:08 +1200, Lawrence D'Oliveiro wrote: Some people would prefer to have a manageable set of rules rather than having to remember the results of all of the possible combinations of interactions between language features. What are you accusing Python of, exactly? I'm

Re: write a 20GB file

2010-05-14 Thread Nobody
On Fri, 14 May 2010 10:50:49 -0400, J wrote: someone smarter than me can correct me, but file.write() will write when it's buffer is filled, or close() or flush() are called. And, in all probability, seek() will either flush it immediately or cause the next write() to flush it before writing

Re: fast regex

2010-05-11 Thread Nobody
On Tue, 11 May 2010 17:48:41 +1200, Lawrence D'Oliveiro wrote: I was working with regex on a very large text, really large but I have time constrained. “Fast regex” is a contradiction in terms. Not at all. A properly-written regexp engine will be limited only by memory bandwidth, provided

Re: Is Python a functional programming language?

2010-05-11 Thread Nobody
On Tue, 11 May 2010 07:36:30 -0700, Paul Rubin wrote: Offhand I can't tell that imperative and procedural mean something different. Both basically mean that the programmer specifies a series of steps for the computer to carry out. Functional languages are mostly declarative; for example, an

Re: Is Python a functional programming language?

2010-05-11 Thread Nobody
On Tue, 11 May 2010 23:13:10 +1200, Lawrence D'Oliveiro wrote: But the beauty is that Python is multi-paradigm ... The trouble with “multi-paradigm” is that it offends the zealots on all sides. Is that how you view people who like languages to exhibit a degree of consistency? Some people

Re: Is Python a functional programming language?

2010-05-10 Thread Nobody
On Tue, 11 May 2010 00:24:22 +1200, Samuel Williams wrote: Is Python a functional programming language? Not in any meaningful sense of the term. Is this a paradigm that is well supported by both the language syntax and the general programming APIs? No. I heard that lambdas were limited to

Re: strange interaction between open and cwd

2010-05-05 Thread Nobody
On Wed, 05 May 2010 02:41:09 +0100, Baz Walter wrote: i think the algorithm also can't guarantee the intended result when crossing filesystem boundaries. IIUC, a stat() call on the root directory of a mounted filesystem will give the same inode number as its parent. Nope; it will have the

Re: strange interaction between open and cwd

2010-05-05 Thread Nobody
On Wed, 05 May 2010 13:23:03 +0100, Baz Walter wrote: so if several filesystems are mounted in the same parent directory, there is no way to tell which of them is the right one. The only case which would cause a problem here is if you mount the same device on two different subdirectories of

Re: strange interaction between open and cwd

2010-05-05 Thread Nobody
On Thu, 06 May 2010 10:21:45 +1000, Cameron Simpson wrote: Look at the st_rdev field (== the device holding this inode). When that changes, you've crossed a mount mount point. st_dev reports the device on which the inode resides. st_rdev is only meaningul if the inode type is block device

Re: [OT] strange interaction between open and cwd

2010-05-04 Thread Nobody
On Tue, 04 May 2010 23:02:29 +1000, Charles wrote: I am by no means an expert in this area, but what I think happens (and I may well be wrong) is that the directory is deleted on the file system. The link from the parent is removed, and the parent's link count is decremented, as you observed,

Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Tue, 04 May 2010 20:08:36 +1200, Gregory Ewing wrote: except that Python objects can form a generalized graph, and Unix filesystems are constrained to be a tree. Actually I believe that root is allowed to create arbitrary hard links to directories in Unix, so it's possible to turn the

Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Mon, 03 May 2010 06:18:55 -0700, Chris Rebert wrote: but how can python determine the parent directory of a directory that no longer exists? Whether or not /home/baz/tmp/xxx/ exists, we know from the very structure and properties of directory paths that its parent directory is, *by

Re: strange interaction between open and cwd

2010-05-04 Thread Nobody
On Tue, 04 May 2010 14:36:06 +0100, Baz Walter wrote: this will work so long as the file is in a part of the filesystem that can be traversed from the current directory to the root. what i'm not sure about is whether it's possible to cross filesystem boundaries using this kind of technique.

Re: Exclusively lock a file to prevent other processes from reading it?

2010-05-04 Thread Nobody
On May 4, 2010, at 5:37 PM, pyt...@bdurham.com wrote: Is there a way to exclusively lock a file to prevent other processes from reading it while we have it open? My environment is Python 2.6.4 (32-bit) under Windows, but I'm looking for a cross-platform solution if that's possible. Some

Re: Python and Regular Expressions

2010-04-08 Thread Nobody
On Wed, 07 Apr 2010 18:25:36 -0700, Patrick Maupin wrote: Regular expressions != Parsers True, but lots of parsers *use* regular expressions in their tokenizers. In fact, if you have a pure Python parser, you can often get huge performance gains by rearranging your code slightly so that

Re: Have you embraced Python 3.x yet?

2010-03-26 Thread Nobody
On Fri, 26 Mar 2010 13:23:25 +, Harishankar wrote: Have you people embraced Python 3.x or still with 2.5 or 2.6? Still with 2.6, and probably will be indefinitely. I use Python mostly for Unix scripting: the kind of task which would traditionally have used Bourne shell. For that purpose,

[issue8216] Nur jetzt beste Software zu besten Preisen!

2010-03-23 Thread Nobody/Anonymous
New submission from Nobody/Anonymous: body,#wrap{text-align:center;margin:0px;background-color:#FFFEF8;}/*...@tab Top b...@section top b...@tip Choose a set of colors that look good with the colors of your logo image or text header.*/#header{background-color:#FFFEF8;margin:0px;/*...@editable

[issue8181] Guenstiger kaufen Sie Software nicht!

2010-03-20 Thread Nobody/Anonymous
New submission from Nobody/Anonymous: body,#wrap{text-align:center;margin:0px;background-color:#FFFEF8;}/*...@tab Top b...@section top b...@tip Choose a set of colors that look good with the colors of your logo image or text header.*/#header{background-color:#FFFEF8;margin:0px;/*...@editable

[issue8186] Hohe Qualitaet und beste Preise garantiert.

2010-03-20 Thread Nobody/Anonymous
New submission from Nobody/Anonymous: body,#wrap{text-align:center;margin:0px;background-color:#FFFEF8;}/*...@tab Top b...@section top b...@tip Choose a set of colors that look good with the colors of your logo image or text header.*/#header{background-color:#FFFEF8;margin:0px;/*...@editable

[issue8187] Online kaufen die beste Software!

2010-03-20 Thread Nobody/Anonymous
New submission from Nobody/Anonymous: body,#wrap{text-align:center;margin:0px;background-color:#FFFEF8;}/*...@tab Top b...@section top b...@tip Choose a set of colors that look good with the colors of your logo image or text header.*/#header{background-color:#FFFEF8;margin:0px;/*...@editable

[issue8189] Gute Programme billig hier!

2010-03-20 Thread Nobody/Anonymous
New submission from Nobody/Anonymous: body,#wrap{text-align:center;margin:0px;background-color:#FFFEF8;}/*...@tab Top b...@section top b...@tip Choose a set of colors that look good with the colors of your logo image or text header.*/#header{background-color:#FFFEF8;margin:0px;/*...@editable

<    1   2   3   4   5   6   7   8   >