Re: How to emit UTF-8 from console mode?
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] LC_CTYPE=en_US.UTF-8 urxvt-X.exe& perl -wle "binmode STDOUT, q[:utf8]; print chr() for 0x410 .. 0x430;" Can someone help me translate it into python? LC_CTYPE=en_US.UTF-8 urxvt-X.exe& python -c 'for i in range(0x410, 0x431):print unichr(i),' I would not expect it to work from cmd.exe with python It should work in cmd.exe, as long as the terminal's encoding supports these characters in the first place. Use chcp.exe to find out what the terminal's encoding is. The Python program is not completely equivalent, as it leaves the output encoding to Python, rather than assuming a fixed UTF-8 output encoding. Regards, Martin Make sure you are using the Lucida Console font for the cmd.exe window and type the commands: chcp 1251 python -c "print ''.join(unichr(i) for i in range(0x410,0x431))" Output: АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯа UTF-8 encoding (chcp 65001) doesn't work (Python doesn't recognize it: "LookupError: unknown encoding: cp65001") and I couldn't get any Chinese code pages to work either. There is some trick I don't know, because Chinese versions of Windows can display Chinese. I have the East Asian languages installed and Chinese IME enabled, but it doesn't help for console apps. --Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: How to emit UTF-8 from console mode?
> LC_CTYPE=en_US.UTF-8 urxvt-X.exe& > perl -wle "binmode STDOUT, q[:utf8]; print chr() for 0x410 .. 0x430;" > Can someone help me translate it into python? LC_CTYPE=en_US.UTF-8 urxvt-X.exe& python -c 'for i in range(0x410, 0x431):print unichr(i),' > I would not expect it to work > from cmd.exe with python It should work in cmd.exe, as long as the terminal's encoding supports these characters in the first place. Use chcp.exe to find out what the terminal's encoding is. The Python program is not completely equivalent, as it leaves the output encoding to Python, rather than assuming a fixed UTF-8 output encoding. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python script for tracert
Thank you so much Gabriel.. It works On Wed, Oct 1, 2008 at 3:25 AM, Gabriel Genellina <[EMAIL PROTECTED]>wrote: > En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <[EMAIL PROTECTED]> > escribió: > > > Hello.. I'm trying to do a scripting for tracert in windows using >> python... >> I'm using popen(), but it displays only after the tracert is completed. i >> want the results to be displayed for every route. >> >> can anyone help me in this.. >> > > Use the subprocess module: > > import subprocess > host = 'www.microsoft.com' > p = subprocess.Popen(["tracert", '-d', '-w', '100', host], > stdout=subprocess.PIPE, stderr=subprocess.STDOUT) > while True: >line = p.stdout.readline() >if not line: break >print '-->',line, > p.wait() > > -- > Gabriel Genellina > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: writing dll in python?
nishalrs wrote: Hello All, My main motivation is to build a collection of useful mathematical models (that I have developed over the years) to design ultrasonic sensors. This should be some sort of a library that should be able to be used for desktop/web application development, to run in variety of operating systems. I am more than convinced after looking at python.org website, it is the right tool for the job. I intend to learn python, but I am not really sure, where to begin. Should I write all the functions as simple python scripts? Or is there some facility for creating a .dll like library, that could be more suitable for what in intend to develop? Any help is much appreciated. Regards, Nishal DLLs are so 1990s . You can more easily write COM objects in Python that can easily be utilized by essentially virtually every programming language that exists on Windows. -Larry -- http://mail.python.org/mailman/listinfo/python-list
Re: Would this be called a bug in inspect ?
Stef Mientki wrote: But the real point is, should a module like inspect not be insensitive to these kind of errors ? In my opinion, no. In any case, the doc says "inspect.getmembers(object[, predicate]) Return all the members of an object in a list of (name, value) pairs sorted by name. " so it is behaving according to spec. Getting the name,value pairs should not raise exceptions. If it does, *something* is wrong, as it was in this case. Stopping is as sensible as anything, and in line with the general behavior of Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Output of pexpect
On Sep 30, 8:48 pm, Anh Khuong <[EMAIL PROTECTED]> wrote: > Hi all, > > I am using pexpect and I want to send output of pexpet to both stdout and log > file concurrently. > Anybody know a solution for it please let me know. spawn class takes a 'logfile' parameter: __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None) More logging info at: http://pexpect.sourceforge.net/pexpect.html >From the above link: The logfile member turns on or off logging. All input and output will be copied to the given file object. Set logfile to None to stop logging. This is the default. Set logfile to sys.stdout to echo everything to standard output. The logfile is flushed after each write. Example log input and output to a file:: child = pexpect.spawn('some_command') fout = file('mylog.txt','w') child.logfile = fout Example log to stdout:: child = pexpect.spawn('some_command') child.logfile = sys.stdout The logfile_read and logfile_send members can be used to separately log the input from the child and output sent to the child. Sometimes you don't want to see everything you write to the child. You only want to log what the child sends back. For example:: child = pexpect.spawn('some_command') child.logfile_read = sys.stdout To separately log output sent to the child use logfile_send:: self.logfile_send = fout I am not very sure if you can do the logging to two different files at the same time (ie sys.stdout as well as another file-object). I guess that's your question. The above should give you a starting point to explore. [May be give a fake file like object and intercept the write/ flush calls?] Karthik > > Thanks -- http://mail.python.org/mailman/listinfo/python-list
How to emit UTF-8 from console mode?
The following perl program works when I run it from urxvt-X console on cygwin-x windows LC_CTYPE=en_US.UTF-8 urxvt-X.exe& perl -wle "binmode STDOUT, q[:utf8]; print chr() for 0x410 .. 0x430;" This little one liner prints the Russian alphabet in Cryllic. With some slight modification it will also print a lot of other alphabets too -- including Hebrew, chinese and japanese. It does not work with cmd.exe because apparently cmd.exe cannot deal with UTF-8. Can someone help me translate it into python? I would not expect it to work from cmd.exe with python, but I am hopeful it will work with urxvt-X! Thanks, Siegfried -- http://mail.python.org/mailman/listinfo/python-list
Output of pexpect
Hi all, I am using pexpect and I want to send output of pexpet to both stdout and log file concurrently. Anybody know a solution for it please let me know. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Wait or not?
On Oct 1, 9:20 am, Eric <[EMAIL PROTECTED]> wrote: > I've been wanting to learn Python for a while now but I can't decide > on whether to wait for Python 3's final release and learn it or just > go ahead and learn 2.x. Would it be hard to make the transition being > a noob? If you only want to learn why do you need to wait for py3.0's final release? Get the rc1 and start learning now. On the other hand if you want to write production code get 2.5 and start writing now, most of what you'll learn between now and the final release of 3.0 will not change. -- http://mail.python.org/mailman/listinfo/python-list
EARN $$$ IN EVERY MONTH
hai, i am srinu from india. i am sending a blog url for yours use. click on the blog and get more information to choose yours job. the blog url is: http://earnmonthlyincome.blogspot.com/ goodluck -- http://mail.python.org/mailman/listinfo/python-list
Re: __buitins__ key added during eval()
William Purcell wrote: I want to use eval to evaluate wx.TextCtrl inputs. How can I keep python from adding the __builtins__ key to mydict when I use it with eval? Other wise I have to __delitem__('__builtins__') everytime I use eval? >>> mydict = {'a':2,'b':3} >>> eval('a*b',mydict) 6 >>> mydict {'a': 2, '__builtins__': {'IndexError': 'exceptions.IndexError'>, ...(I'll spare you the rest)...}, 'b': 3} Also, how come eval has this behavior? Is it desirable? -Bill -- http://mail.python.org/mailman/listinfo/python-list no too sure, but eval('a*b', None, mydict) seems to work how you expect. -- http://mail.python.org/mailman/listinfo/python-list
__buitins__ key added during eval()
I want to use eval to evaluate wx.TextCtrl inputs. How can I keep python from adding the __builtins__ key to mydict when I use it with eval? Other wise I have to __delitem__('__builtins__') everytime I use eval? >>> mydict = {'a':2,'b':3} >>> eval('a*b',mydict) 6 >>> mydict {'a': 2, '__builtins__': {'IndexError': , ...(I'll spare you the rest)...}, 'b': 3} Also, how come eval has this behavior? Is it desirable? -Bill -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Wed, 01 Oct 2008 09:06:08 +1000, Ben Finney wrote: > > > Note that I consider a work free even if it fails to grant “the > > right to distribute misrepresentations of the author's words”, > > because that act is an exercise of undue power over another > > person, and so falls outside the limit imposed by the freedoms of > > others. > > But distributing modified source code *does* misrepresent the > author's words, because you confuse authorship. That's a possibility. There are other ways to avoid it than to restrict the freedom to redistribute; for example, some licenses state that modified works must clearly state who, when, and what was modified. I would not consider that a non-free restriction, since the freedom of the original distributor *and* the freedom of the redistributor is preserved. > If that is why the gnuplot people do not allow you to distribute > such modified documents, then the only "freedom" they fail to grant > is exactly the one you don't consider necessary for a free licence: > "the right to distribute misrepresentations of the author's words". We're going around in circles. I've already pointed out another freedom they fail to grant: the freedom to redistribute a modified work *as modified*. It's not equivalent to the act of misrepresentation. -- \ “War is God's way of teaching geography to Americans.” —Ambrose | `\Bierce | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On 2008-09-30, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote: > How would the python equivalent go ? >> >> You would drag yourself out of the 1960s, install numpy, and >> then do something like this: > > I think that was thoughtlessly rude to somebody who is asking > a perfectly reasonable question. Sheesh. I guess I should have added a smiley face. So much for trying to be helpful. -- Grant -- http://mail.python.org/mailman/listinfo/python-list
Re: Time.sleep(0.0125) not available within Linux
On 2008-09-30, Michael Torrie <[EMAIL PROTECTED]> wrote: >> Just a thought, your minimum sleep time is probably limited by >> the resolution of the system "HZ" clock. Type >> >> less /proc/config.gz >> >> and search for the value of the "CONFIG_HZ" setting. On the >> Athlon 64 machine I'm using to write this, it's 250, which >> should allow for sleep intervals in multiples of 0.004 >> seconds. > > Since most distributions do not create this file in /proc for whatever > reason, It's also common to put a copy of the config file in /boot (or wherever the kernel binaries are installed). I prefer the /proc/config.gz setup myself, and that's how I configure all my systems. > and some people are being deliberately obtuse, does anyone > know how to ask the kernel what the timer resolution is? Is > it stored anywhere else in /proc or /sys? I kind of think > most distros set it to 1000 Hz, but I'm not sure. We could look in /usr/include: $ grep -r ' HZ ' /usr/include /usr/include/scsi/sg.h:#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ /usr/include/linux/ixjuser.h:* IXJCTL_HZ sets the value your Linux kernel uses for HZ as defined in /usr/include/linux/n_r3964.h: * Fixed HZ usage on 2.6 kernels /usr/include/asm/param.h:#define HZ 100 But, I happen to know that's wrong and I'm running a kernel with HZ=250. So let's look elsewhere. How about in /proc/sys/kernel? $ cat /proc/sys/kernel/sched_min_granularity_ns 400 That looks suspiciously like 1/HZ in nanoseconds. -- Grant -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
En Mon, 29 Sep 2008 19:04:18 -0300, Ivan Reborin <[EMAIL PROTECTED]> escribió: 1. Multi dimensional arrays - how do you load them in python For example, if I had: --- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 --- with "i" being the row number, "j" the column number, and "k" the .. uhmm, well, the "group" number, how would you load this ? I agree that using NumPy is the way to go if you're going to do lots of array calculations. But a plain Python code would look like this (more comprehensible than other posted versions, I hope): --- begin code --- def read_group(fin, rows_per_group): rows = [] for i in range(rows_per_group): line = fin.readline() row = [float(x) for x in line.split()] rows.append(row) fin.readline() # skip blank line return rows # simulate a file using a string instead # actual code would use: fin = open(filename) from StringIO import StringIO fin = StringIO("""1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 """) # read 2 groups of 3 lines each matrix = [read_group(fin, 3) for k in range(2)] print matrix --- end code --- A more compact version of read_group (collapsing all rows.append onto the outer list comprehension): --- begin code --- def read_group(fin, rows_per_group): rows = [[float(x) for x in fin.readline().split()] for i in range(rows_per_group)] fin.readline() # skip blank line return rows --- end code --- -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I customize builtin module search path to prefix/lib to prefix/lib64?
In addition to that, .pth cannot prepend search path. All thing it can do is appending to it. In my case, I have to put lib64 before lib/. On 9/26/08, js <[EMAIL PROTECTED]> wrote: > For 64bit python, there's no need to look at lib/lib-dynload because > libraries for 64bit should be in > lib64/lib-dynload. Having module search path which point to libraries > the python can not understand > is, IMHO, wrong. > > On Fri, Sep 26, 2008 at 3:03 AM, Mike Driscoll <[EMAIL PROTECTED]> wrote: >> On Sep 25, 10:41 am, js <[EMAIL PROTECTED]> wrote: >>> Hi list, >>> >>> Is it possible to change module search path (PYTHONPATH) built-in to >>> Python interpreter? >>> I thought I can change it with configure --libdir but it didn't work for >>> me. >>> I also tried patching around python source tree replacing lib to lib64 >>> but it didn't work either. >>> >>> Adjusting sys.path directly or using environ should do the trick but >>> I'd rather want to make it the default path for my python >>> >>> Thanks, >> >> Why not just add a custom path file (*.pth)? EasyInstall, wx, PyWin32 >> and others do it. Of course there's always sys.path.append as well. >> >> Mike >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Wed, 01 Oct 2008 09:06:08 +1000, Ben Finney wrote: > Terry Reedy <[EMAIL PROTECTED]> writes: > >> Steven D'Aprano wrote: >> > We agree that the restriction is artificial, and I think irrational >> > (although I'd be interested in hearing the gnuplot developers' >> > reasoning before making a final judgment). >> >> I believe it is a matter of preserving clarity of authorship, just as >> is the quoting mechanism we take for granted in posts like this. If I >> removed the quote marks above and silently edited what Ben and you >> wrote, I might upset someone and certainly could confuse readers. > > That, if it were to be prosecuted under law, would be a matter already > covered by laws other than copyright: fraud, libel, etc. > > Note that I consider a work free even if it fails to grant “the right to > distribute misrepresentations of the author's words”, because that act > is an exercise of undue power over another person, and so falls outside > the limit imposed by the freedoms of others. But distributing modified source code *does* misrepresent the author's words, because you confuse authorship. Given only the modified version of the source code, how is the recipient supposed to identify which parts of the source code were written by the original authors and which parts where written by you? If that is why the gnuplot people do not allow you to distribute such modified documents, then the only "freedom" they fail to grant is exactly the one you don't consider necessary for a free licence: "the right to distribute misrepresentations of the author's words". -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with "ImportError: No module named..." and sockets
En Tue, 30 Sep 2008 19:44:51 -0300, Daniel <[EMAIL PROTECTED]> escribió: On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]> escribió: > [BEGIN CODE] > #!/usr/bin/python > import SocketServer > import os, sys > newpath = os.path.normpath( os.path.join( __file__, "../../.." )) > sys.path.insert(0, newpath) > from pop.command.UpdateCommand import * > import cPickle > Traceback (most recent call last): > [...] > ImportError: No module named UpdateCommand > I import the module at the top of the file server.py, but it doesn't > throw the ImportError until it tries to unpickle. Notice that you don't import the UpdateCommand module - you import all names defined inside it instead. It's not the same thing. Seehttp://effbot.org/zone/import-confusion.htm -- Gabriel Genellina Thank you Gabriel, The class inside that module has the same name, UpdateCommand. Since this is the object that was pickled, it should be available to the unpickle command. I already understood the difference between import methods and I think I'm covered. I did just try "import pop.command.TesterUpdateCommand" instead and I get the same error. (TesterUpdateCommand != UpdateCommand...) In your *pickling* code, just before pickling the object, see what you get from this: cls = obj.__class__ print cls.__module__ print cls.__name__ Suppose you get "SomeModuleName" and "SomeClassName". Then, in your *unpickling* environment, this must succeed: import SomeModuleName cls = SomeModuleName.SomeClassName If not, you should rearrange things (on both sides, probably) to make the reference work. This is basically what pickle does. Looks like the module lives in a package - make sure you import the *package* both when pickling and unpickling. The sys.path manipulation looks suspicious. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On Tue, 30 Sep 2008 14:34:31 +, Marc 'BlackJack' Rintsch wrote: > On Tue, 30 Sep 2008 15:42:58 +0200, Ivan Reborin wrote: > >> On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> >> wrote: >>>= >>>from __future__ import with_statement from functools import partial >>>from itertools import islice >>>from pprint import pprint >>> >>> >>>def read_group(lines, count): >>>return [map(int, s.split()) for s in islice(lines, count)] >>> >>>def main(): >>>with open('test.txt') as lines: >>>lines = (line for line in lines if line.strip()) >>>result = list(iter(partial(read_group, lines, 3), list())) >>>pprint(result, width=30) >>> >>>if __name__ == '__main__': >>>main() >>>= >> >> I'm afraid I must admit I find the code above totally uncomprehesible >> (I can't even see where the array here is mentioned - "result"?) and >> inpractical for any kind of engineering practice I had in mind. > > Learn Python then to understand that code. ;-) > > There is no array. The data type is called "list" in Python, so > `result` is a nested list. And in Python it quite unusual to build > lists by creating them with the final size filled with place holder > objects and then fill the real values in. Instead lists are typically > created by appending values to existing lists, using list comprehension > or the `list()` function with some iterable object. I would weaken that claim a tad... I'd say it is "usual" to write something like this: alist = [] for x in some_values: alist.append(something_from_x) but it is not uncommon (at least not in my code) to write something like this equivalent code instead: alist = [None]*len(some_values) for i, x in enumerate(some_values): alist[i] = something_from_x Most often the first way is most natural, but the second way is sometimes more natural. It will also be more familiar to somebody coming from Fortran, and it is a micro-optimization for large lists because it doesn't need to resize the list as it grows. I stress the *micro*-optimization, because Python lists are highly optimized to resize as rarely as possible and as quickly as possible, so you're not saving much time. And Marc, I think you're being a little unfair to the OP, who is clearly unfamiliar with Python. I've been using Python for perhaps ten years, and I still find your code above dense and hard to comprehend. It uses a number of "advanced Python concepts" that a newbie is going to have trouble with: - the with statement acts by magic; if you don't know what it does, it's an opaque black box. - you re-use the same name for different uses, which can cause confusion. - generator expressions. - functional programming using partial. - you call a function that uses a list comprehension with both map and iterator slicing inside it. No wonder the OP had trouble with it. *I* have trouble with it, and would need to sit down at the interactive interpreter and play around with it for a while to be sure what it actually does. If it was your intention to make Python look as obtuse and mysterious as possible, you almost succeeded. The one things you missed was to replace the read_group function with a lambda in the partial. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote: >>> How would the python equivalent go ? > > You would drag yourself out of the 1960s, install numpy, and then do > something like this: I think that was thoughtlessly rude to somebody who is asking a perfectly reasonable question. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Time.sleep(0.0125) not available within Linux
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Grant > Edwards wrote: > >> On 2008-09-23, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: >> >>> I was wondering if anyone has come across the issue of not being allowed >>> to have the following within a Python script operating under Linux: >>> >>> time.sleep(0.0125) >> No, I have not. And I doubt anybody else has. > > Just a thought, your minimum sleep time is probably limited by the > resolution of the system "HZ" clock. Type > > less /proc/config.gz > > and search for the value of the "CONFIG_HZ" setting. On the Athlon 64 > machine I'm using to write this, it's 250, which should allow for sleep > intervals in multiples of 0.004 seconds. Since most distributions do not create this file in /proc for whatever reason, and some people are being deliberately obtuse, does anyone know how to ask the kernel what the timer resolution is? Is it stored anywhere else in /proc or /sys? I kind of think most distros set it to 1000 Hz, but I'm not sure. -- http://mail.python.org/mailman/listinfo/python-list
Re: Wait or not?
On Sep 30, 4:20 pm, Eric <[EMAIL PROTECTED]> wrote: > I've been wanting to learn Python for a while now but I can't decide > on whether to wait for Python 3's final release and learn it or just > go ahead and learn 2.x. Would it be hard to make the transition being > a noob? It shouldn't be a hard transition. I would recommend learning 2.x anyway. You are likely to want to use 3rd party modules (or you will anyway). You won't want to wait for module support to be added in 3.0. The 2.x series isn't going to go away for quite a while. I think they are planning to continue to do releases all the way up to 2.9 or so. Even then, the biggest thing that a new user is going to run into is `print("stuff")` vs. `print "stuff"`. Matt -- http://mail.python.org/mailman/listinfo/python-list
Wait or not?
I've been wanting to learn Python for a while now but I can't decide on whether to wait for Python 3's final release and learn it or just go ahead and learn 2.x. Would it be hard to make the transition being a noob? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
Terry Reedy <[EMAIL PROTECTED]> writes: > Steven D'Aprano wrote: > > We agree that the restriction is artificial, and I think > > irrational (although I'd be interested in hearing the gnuplot > > developers' reasoning before making a final judgment). > > I believe it is a matter of preserving clarity of authorship, just > as is the quoting mechanism we take for granted in posts like this. > If I removed the quote marks above and silently edited what Ben and > you wrote, I might upset someone and certainly could confuse > readers. That, if it were to be prosecuted under law, would be a matter already covered by laws other than copyright: fraud, libel, etc. Note that I consider a work free even if it fails to grant “the right to distribute misrepresentations of the author's words”, because that act is an exercise of undue power over another person, and so falls outside the limit imposed by the freedoms of others. -- \ “What is it that makes a complete stranger dive into an icy | `\ river to save a solid gold baby? Maybe we'll never know.” —Jack | _o__) Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
Steven D'Aprano <[EMAIL PROTECTED]> writes: > I simply don't think that having to run some variation on > > patch -i patchfile.patch > > is a requirement so onerous that it makes the gnuplot licence > non-free. Perhaps I'm just more tolerant of eccentricities than you > :) The distinction here is that this command must be run by *every* recipient of a modified work. A work where one must do that is more onerous for *each* recipient than one where it's already been patched for the recipient. Thus there is value, and no loss of freedom, in you as a redistributor doing that work *once* and then redistributing the work intact to any recipient. Your freedom to do this useful, harmless action is restricted artificially by copyright, and is not granted by the license. So, recipients of the 'gnuplot' code are artificially restricted from performing an action useful to society that does no harm. -- \“The Bermuda Triangle got tired of warm weather. It moved to | `\ Alaska. Now Santa Claus is missing.” —Steven Wright | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with "ImportError: No module named..." and sockets
On Sep 30, 4:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]> > escribió: > > > > > [BEGIN CODE] > > #!/usr/bin/python > > import SocketServer > > import os, sys > > newpath = os.path.normpath( os.path.join( __file__, "../../.." )) > > sys.path.insert(0, newpath) > > > from pop.command.UpdateCommand import * > > import cPickle > > > Traceback (most recent call last): > > [...] > > ImportError: No module named UpdateCommand > > > I import the module at the top of the file server.py, but it doesn't > > throw the ImportError until it tries to unpickle. > > Notice that you don't import the UpdateCommand module - you import all > names defined inside it instead. It's not the same thing. > Seehttp://effbot.org/zone/import-confusion.htm > > -- > Gabriel Genellina Thank you Gabriel, The class inside that module has the same name, UpdateCommand. Since this is the object that was pickled, it should be available to the unpickle command. I already understood the difference between import methods and I think I'm covered. I did just try "import pop.command.TesterUpdateCommand" instead and I get the same error. -- http://mail.python.org/mailman/listinfo/python-list
Visit this sites please
http://forums.vogue.com.au/member.php?u=91686 tube8 http://forums.vogue.com.au/member.php?u=91688 redtube http://forums.vogue.com.au/member.php?u=91689 pornhub http://forums.vogue.com.au/member.php?u=91690 yobt http://www.dynamicdrive.com/forums/member.php?u=33924 tube8 http://www.dynamicdrive.com/forums/member.php?u=33925 redtube Visit this sites please -- http://mail.python.org/mailman/listinfo/python-list
Visit this sites please
http://forums.vogue.com.au/member.php?u=91686 tube8 http://forums.vogue.com.au/member.php?u=91688 redtube http://forums.vogue.com.au/member.php?u=91689 pornhub http://forums.vogue.com.au/member.php?u=91690 yobt http://www.dynamicdrive.com/forums/member.php?u=33924 tube8 http://www.dynamicdrive.com/forums/member.php?u=33925 redtube Visit this sites please -- http://mail.python.org/mailman/listinfo/python-list
Re: problem with "ImportError: No module named..." and sockets
En Tue, 30 Sep 2008 18:38:19 -0300, Daniel <[EMAIL PROTECTED]> escribió: [BEGIN CODE] #!/usr/bin/python import SocketServer import os, sys newpath = os.path.normpath( os.path.join( __file__, "../../.." )) sys.path.insert(0, newpath) from pop.command.UpdateCommand import * import cPickle Traceback (most recent call last): [...] ImportError: No module named UpdateCommand I import the module at the top of the file server.py, but it doesn't throw the ImportError until it tries to unpickle. Notice that you don't import the UpdateCommand module - you import all names defined inside it instead. It's not the same thing. See http://effbot.org/zone/import-confusion.htm -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Backup a directory
On Tue, Sep 30, 2008 at 1:21 PM, <[EMAIL PROTECTED]> wrote: > Hello, > > > I'm looking for a script that creates a backup of a directory but keeps only > one backup. > I've tried using all the os modules commands but could not create one. > > > Does any one has any such custom script or function? You could probably whip one up very easily using the tarfile module [http://docs.python.org/lib/module-tarfile.html] and shutil.move() [http://docs.python.org/lib/module-shutil.html]. Just make a new TarFile of the directory, save it, then replace any previous backup file using shutil.move() Good luck, and have fun! Regards, Chris P.S. And if you're on *nix, you might consider just using a shell script and the 'tar' command. Right tool for the right job and all that. -- Follow the path of the Iguana... http://rebertia.com > > > Thanks and regards, > rajat > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python script for tracert
En Tue, 30 Sep 2008 03:53:21 -0300, cindy jones <[EMAIL PROTECTED]> escribió: Hello.. I'm trying to do a scripting for tracert in windows using python... I'm using popen(), but it displays only after the tracert is completed. i want the results to be displayed for every route. can anyone help me in this.. Use the subprocess module: import subprocess host = 'www.microsoft.com' p = subprocess.Popen(["tracert", '-d', '-w', '100', host], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while True: line = p.stdout.readline() if not line: break print '-->',line, p.wait() -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: md5 hash problems
On Tue, Sep 30, 2008 at 2:25 PM, Michele <[EMAIL PROTECTED]> wrote: > Hi there, > why is this code generating a problem? > input = open('foo.img','rb').read().decode('ISO-8859-1') import md5 md5.new(input).hexdigest() > Traceback (most recent call last): > File "", line 1, in > UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in > position 6: > ordinal not in range(128) You're trying to run md5 over a unicode string, but I'm pretty sure it's only defined for bytes, and when Python tries to autoconvert the unicode to bytes (by encoding it in ASCII), this fails because you particular unicode string contains non-ASCII characters. Basically make sure to pass md5.new() bytes and not unicode, either by removing the call to .decode(), or calling .encode() on the unicode object before passing it to md5.new() Regards, Chris -- Follow the path of the Iguana... http://rebertia.com > > Thank you. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
problem with "ImportError: No module named..." and sockets
Hello, I'm trying to build a very simple IPC system. What I have done is create Data Transfer Objects (DTO) for each item I'd like to send across the wire. I am serializing these using cPickle. I've also tried using pickle (instead of cPickle), but I get the same response. Below is the code. I'll put the rest of my comments after the code [BEGIN CODE] #!/usr/bin/python import SocketServer import os, sys newpath = os.path.normpath( os.path.join( __file__, "../../.." )) sys.path.insert(0, newpath) from pop.command.UpdateCommand import * import cPickle class RequestHandler(SocketServer.StreamRequestHandler): "Handles one request to mirror some text." def handle(self): total_data=[] line = True while line: line = self.rfile.readline().strip() total_data.append(line) receivedCommand = '\n'.join(total_data) newUpdate = cPickle.loads(receivedCommand) print type(newUpdate) for item in newUpdate.items: print str(type(item)) + " with filename: " + item.filename if __name__ == '__main__': import sys if len(sys.argv) < 3: print 'Usage: %s [hostname] [port number]' % sys.argv[0] sys.exit(1) hostname = sys.argv[1] port = int(sys.argv[2]) server = SocketServer.ThreadingTCPServer((hostname, port), RequestHandler) server.serve_forever() [/END CODE] So I can create the UpdateCommand object on the client, send it across the wire and I get as far as the line "newUpdate = cPickle.loads(receivedCommand)", which when it runs produces the following error: Traceback (most recent call last): File "C:\Python25\lib\SocketServer.py", line 464, in process_request_thread self.finish_request(request, client_address) File "C:\Python25\lib\SocketServer.py", line 254, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Python25\lib\SocketServer.py", line 522, in __init__ self.handle() File "C:\Documents and Settings\dwatrous\My Documents\projects\POP \svn\pop\lib\server.py", line 29, in handle newUpdate = cPickle.loads(receivedCommand) ImportError: No module named UpdateCommand I import the module at the top of the file server.py, but it doesn't throw the ImportError until it tries to unpickle. Please help with any ideas that you have. -- http://mail.python.org/mailman/listinfo/python-list
Re: Advice for a replacement for plone.
Ken Seehart <[EMAIL PROTECTED]> wrote: > I want a new python based CMS. ... One that won't keep me up all night > > I've been fooling around with zope and plone, and I like plone for some > things, such as a repository for online project documentation. However > for general-purpose web development it is too monolithic. Is there > anything out there with the following properties? > > 0. Web page being developed is a typical small business home page (i.e. > not a newspaper or a blog). > 1. Page owner can edit pages on line with no expertise (plone does great > here). > 2. Main page does not look plone-like. For an example of a main page > that does not look plone-like, see http://www.arbitrary.com/ Note the > lack of CMS style navigation widgets. > 3. Item 2 should be reachable with nearly no effort (plone fails utterly > here). > 4. Target viewer (not the owner), should /not/ see something that looks > at all like a CMS system, but rather see exactly what the page owner > wants the page to look like. > 5. Page owner should be able to view and navigate the tree of contents, > and select pages to edit with a wysiwyg editor (plone does great here)... > 6. ... But the target viewer should not see this tree. See items 2 and 4. > 7. Potential to add python scripted pages of various kinds. > > There are a couple different design approaches to making a > development environment. You can let the developer start with nothing, > and provide the developer with tools to create something (e.g. zope, > most plain text editors), or you can start with a finished result and > let the developer rip out and discard what is not desired (e.g. plone). > I often prefer to start with nothing. It's a natural starting point. > Note that systems that are based on starting with nothing can provide > the benefits of starting with something by providing templates and such. > > > I would love to see a system that would give me an editable Hello World > page in under 5 minutes. Hello World would be a page consisting of > nothing but the words "hello world" (no tools, no navigation bar, and > certainly no CMS navigation stuff) in a url such as > www.myhelloworldwebsite.com/hello and a different url to edit the page, > such as www.myhelloworldwebsite.com/hello/edit or > www.mywebsite.com/edit/hello Django + flatpages maybe? Coming from the starting from nothing approach. There are links to some sites built with it in the docs below. http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/ A bit more of a learning curve but you'll definitely be in charge. Somebody used to Django could set up a flatpages site in 5 minutes probably! It will take you a couple of hours the first time though. -- Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
md5 hash problems
Hi there, why is this code generating a problem? >>> input = open('foo.img','rb').read().decode('ISO-8859-1') >>> import md5 >>> md5.new(input).hexdigest() Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in position 6: ordinal not in range(128) >>> Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: pylab without X11
This may help ... or not ( 2nd part ) try not to do pylab.figure() in your script: pylab.plot, or pylab.imshow or whatever you want to use then savefig("myFigure.png")for example do not use show() in my case ( with the WXAgg backend ), it works, it generates the png file Marc Willem-Jan Vriend a écrit : I want to use pylab (matplotlib) on a machine without X11. I'm trying to generate onthefly graphics for an apache2 web service, so they do not have to be displayed on this machine ! When i do pylab.figure() I get the error TclError: couldn't connect to display ":0.0" I tried setting the DISPLAY environment variable to "", ":0.0" but I got the same error message. Any help is very much appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Matplotlib Polar Plot Clockwise
I have been playing with this for a couple days now and there doesn't seem to be any easy way to fix this except manipulating the data, which is undesirable. It would be some much better if there was a setting in matplotlibrc to choose to plot clockwise or counter- clockwise and the position on 0° I am now trying the transformations, but it looks just too complicated. Anybody ever ran into this. Thanks, Justin. -- http://mail.python.org/mailman/listinfo/python-list
Re: Would this be called a bug in inspect ?
Terry Reedy wrote: Stef Mientki wrote: print getmembers ( wx ) crashes but not always: >>> print getmembers (wx) [('ACCEL_ALT', 1), ('ACCEL_CMD', 2), ('ACCEL_CTRL', 2), ('ACCEL_NORMAL', 0), ('ACCEL_SHIFT', 4), ('ADJUST_MINSIZE', 0), ( I suspect that wx has an erratic bug, which their tests do not catch. So I would send this off to them. I did, and the bug is already fixed, but I need some more time to update, while most of my programs crash with the newer version. But the real point is, should a module like inspect not be insensitive to these kind of errors ? cheers, Stef >>> print getmembers (wx) Traceback (most recent call last): File "", line 1, in File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 242, in __repr__ def __repr__(self): return 'wx.Colour' + str(self.Get(True)) File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 230, in Get return _gdi_.Colour_Get(*args, **kwargs) TypeError: in method 'Colour_Get', expected argument 1 of type 'wxColour *' -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: pylab without X11
This may help you ... or not You may have to change your backend : p13 of the matplotlib user guide: backends p17 how to change the backend in the matplotlibrc An example of matplotlibrc ( backend choice is at the beginning ): http://matplotlib.sourceforge.net/matplotlibrc You may choose PS or SVG or pdf, there might be other possibilities, I do not know To save the file : savefig Marc Willem-Jan Vriend a écrit : I want to use pylab (matplotlib) on a machine without X11. I'm trying to generate onthefly graphics for an apache2 web service, so they do not have to be displayed on this machine ! When i do pylab.figure() I get the error TclError: couldn't connect to display ":0.0" I tried setting the DISPLAY environment variable to "", ":0.0" but I got the same error message. Any help is very much appreciated. -- http://mail.python.org/mailman/listinfo/python-list
QSessionManager example request
Hi all, I am trying to write an application that will test the sleep function of the laptop. I am using pyqt for this. I need to continue to run my gui after the laptop wakes up from sleep mode so that i may continue some counters and repeat the sleep command again. I think i may use QSessionManager but i am not sure how to use it. Can someone give me a simple example with it? Oguz begin:vcard fn:Oguz Yarimtepe n: Yarimtepe;Oguz url:http://www.loppbacking.info version:2.1 end:vcard -- http://mail.python.org/mailman/listinfo/python-list
Re: Would this be called a bug in inspect ?
Stef Mientki wrote: print getmembers ( wx ) crashes but not always: >>> print getmembers (wx) [('ACCEL_ALT', 1), ('ACCEL_CMD', 2), ('ACCEL_CTRL', 2), ('ACCEL_NORMAL', 0), ('ACCEL_SHIFT', 4), ('ADJUST_MINSIZE', 0), ( I suspect that wx has an erratic bug, which their tests do not catch. So I would send this off to them. >>> print getmembers (wx) Traceback (most recent call last): File "", line 1, in File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 242, in __repr__ def __repr__(self): return 'wx.Colour' + str(self.Get(True)) File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 230, in Get return _gdi_.Colour_Get(*args, **kwargs) TypeError: in method 'Colour_Get', expected argument 1 of type 'wxColour *' -- http://mail.python.org/mailman/listinfo/python-list
Backup a directory
Hello, I'm looking for a script that creates a backup of a directory but keeps only one backup. I've tried using all the os modules commands but could not create one. Does any one has any such custom script or function? Thanks and regards, rajat -- http://mail.python.org/mailman/listinfo/python-list
Re: rlcompleter and wxPython, problems ...
Gabriel Genellina wrote: En Tue, 30 Sep 2008 16:06:07 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: Gabriel Genellina wrote: En Sun, 28 Sep 2008 19:25:30 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: I'm trying to implement autocompletion into my editor. But I find some weird behavior, or at least I don't have the faintest idea why this behavior occures, and even more important how to solve it In the example below I try to autocomplete " wx.s" , which in my humble opinion should at least produce "wx.stc" (and some others ). wx is a package. Modules within the package are not, by default, attributes of the package - unless they're imported in __init__.py or your code imports them. So the autocompleter is doing the right thing in what perspective ? the autocompleter is only meant to assist the program writer ;-) It's hard to write an autocompleter that does the right thing in all cases :) For a package, you have several sources for possibly valid attributes: - its dir() (that is, the package object's own attributes) - the __all__ attribute, when it exists - the list of modules inside the package directory or directories (given by its __path__ attribute) Sometimes __init__.py is empty - and enumerating the modules inside the directory is the right thing to do. Sometimes the author explicitely imports things in __init__.py, things that comprise the public interfase to the package. In that case I'd not like to see "private" modules appearing in the list. Combine with __all__, which might be defined or not. Mix all those, choose your own autocomplete algorithm, and see what happens... - wx.stc does not exist until it is explicitely imported. I guess I've to study the package. For the moment I'll implement a user editable list of additions. But with your remarks I tried __all__ And now I wonder why rlcompleter is not simply using "wx.__all__", it than does gets all the items ? __all__ isn't always defined. It's only used when you do "from xxx import *" AFAIK. thanks Gabriel, very valuable information for me, I'll bookmark this message for later use. cheers, Setf -- http://mail.python.org/mailman/listinfo/python-list
Re: rlcompleter and wxPython, problems ...
En Tue, 30 Sep 2008 16:06:07 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: Gabriel Genellina wrote: En Sun, 28 Sep 2008 19:25:30 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: I'm trying to implement autocompletion into my editor. But I find some weird behavior, or at least I don't have the faintest idea why this behavior occures, and even more important how to solve it In the example below I try to autocomplete " wx.s" , which in my humble opinion should at least produce "wx.stc" (and some others ). wx is a package. Modules within the package are not, by default, attributes of the package - unless they're imported in __init__.py or your code imports them. So the autocompleter is doing the right thing in what perspective ? the autocompleter is only meant to assist the program writer ;-) It's hard to write an autocompleter that does the right thing in all cases :) For a package, you have several sources for possibly valid attributes: - its dir() (that is, the package object's own attributes) - the __all__ attribute, when it exists - the list of modules inside the package directory or directories (given by its __path__ attribute) Sometimes __init__.py is empty - and enumerating the modules inside the directory is the right thing to do. Sometimes the author explicitely imports things in __init__.py, things that comprise the public interfase to the package. In that case I'd not like to see "private" modules appearing in the list. Combine with __all__, which might be defined or not. Mix all those, choose your own autocomplete algorithm, and see what happens... - wx.stc does not exist until it is explicitely imported. I guess I've to study the package. For the moment I'll implement a user editable list of additions. But with your remarks I tried __all__ And now I wonder why rlcompleter is not simply using "wx.__all__", it than does gets all the items ? __all__ isn't always defined. It's only used when you do "from xxx import *" AFAIK. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: Would this be called a bug in inspect ?
Gabriel Genellina wrote: En Tue, 30 Sep 2008 14:57:55 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: I'm not familiar with inspect, but I get an error (see below) in getmembers ( wx ) Of course this is bug in wx . Yes. But would you also call this a bug in inspect ? (inspect crashes and doesn't continue with th rest of the code, nor it returns the already gathered data) getmembers works fine; try m=getmembers(wx) and see. REALLY GREAT ! It fails when you attemp to print (or pprint) the returned list. But this is fully beyond my understanding: m = getmembers ( wx ) print m runs fine print getmembers ( wx ) crashes but not always: >>> print getmembers (wx) [('ACCEL_ALT', 1), ('ACCEL_CMD', 2), ('ACCEL_CTRL', 2), ('ACCEL_NORMAL', 0), ('ACCEL_SHIFT', 4), ('ADJUST_MINSIZE', 0), ( And to make it even weirder, now I can let your suggestion crash too >>> m=getmembers(wx) >>> print getmembers (wx) Traceback (most recent call last): File "", line 1, in File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 242, in __repr__ def __repr__(self): return 'wx.Colour' + str(self.Get(True)) File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 230, in Get return _gdi_.Colour_Get(*args, **kwargs) TypeError: in method 'Colour_Get', expected argument 1 of type 'wxColour *' >>> print m Traceback (most recent call last): File "", line 1, in File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 242, in __repr__ def __repr__(self): return 'wx.Colour' + str(self.Get(True)) File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 230, in Get return _gdi_.Colour_Get(*args, **kwargs) TypeError: in method 'Colour_Get', expected argument 1 of type 'wxColour *' ?? thanks, Stef -- http://mail.python.org/mailman/listinfo/python-list
Re: XMLRPC - C Client / Python Server
[EMAIL PROTECTED] wrote: > I have implemented a simple Python XMLRPC server and need to call it > from a C/C++ client. What is the simplest way to do this? I need to > pass numerical arrays from C/C++ to Python. Which do you need, C or C++? They are two different languages with different possibilities for libraries. As the other poster mentioned, xmlrpc-c is a good one for C, and also comes with bindings for C++ which I have used. Getting xmlrpc-c compiled can be a real challenge though. I recommend you use binary packages for your distribution of Linux. If you need it on Win32, then you'll have to spend a day or two figuring out how to build it on Windows. I eventually got the both the C and C++ client library built in Mingw with libcurl as the transport. But it was a real pain. -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
Blubaugh, David A. wrote: > Thank You!! > > I am still new to Python!! > > David Blubaugh As you've already noticed, plenty of folks here on the list are ready help you out with issues the crop up as you learn python. So keep on asking questions as you need assistance. In the future, please avoid using all-capital letters and superfluous exclamation marks in the subject line as this comes across in the parlance of nntp- and mailing- list etiquette as yelling. If you don't get any replies to your posts, please just be patient and the gurus will get to them eventually. I have found this list to be extremely good that way, and almost all my questions have been politely answered, even if it took a few days. I hope you continue to find your python learning experience to be fun and profitable. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Replacing cmd.exe with custom .py application
On Tue, 30 Sep 2008 19:30:55 + (UTC), Lie Ryan <[EMAIL PROTECTED]> wrote: On Tue, 30 Sep 2008 15:09:06 -0400, Ezra Taylor wrote: Is there something similar to /dev/null on Windows? I think it's called nul REM This is a batch file (.bat) echo "This won't show" > NUL I'm not sure how to use it in python though. Check out os.devnull. You can open it and write to it. Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Replacing cmd.exe with custom .py application
On Tue, 30 Sep 2008 15:09:06 -0400, Ezra Taylor wrote: > Is there something similar to /dev/null on Windows? I think it's called nul REM This is a batch file (.bat) echo "This won't show" > NUL I'm not sure how to use it in python though. -- http://mail.python.org/mailman/listinfo/python-list
Re: Would this be called a bug in inspect ?
En Tue, 30 Sep 2008 14:57:55 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: I'm not familiar with inspect, but I get an error (see below) in getmembers ( wx ) Of course this is bug in wx . Yes. But would you also call this a bug in inspect ? (inspect crashes and doesn't continue with th rest of the code, nor it returns the already gathered data) getmembers works fine; try m=getmembers(wx) and see. It fails when you attemp to print (or pprint) the returned list. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
Blubaugh, David A. wrote: To All, I have been attempting to execute the following program within the Python environment: Myprogram.exe, which means this is an executable file!! I would usually execute this program (with the appropriate arguments) by going to following directory within MS-DOS (Windows XP): C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 The executable would execute perfectly. Because you execute it in the necessary directory. However, when I would try to execute the following lines of source code within a python script file: import os os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") This does not execute it in the proper directory. os.getcwd() will tell you where you are -- mostly likely .../Pythonx.y. Try: os.chdir("C:/myprogramfolder/run") # / works fine, and without r prefix os.system("Myprogram.exe 1 1 acc 0") The executable file would start to execute until it would print an error stating that it cannot use a (.dat) file, which is located under the following directory: C:\myprogramfolder\run\inputs\io\control.dat I believe I may be missing something here that prevents the executable file working within python from utilizing this (.dat). The printed final error is the following: ERROR opening inputs/io/control.dat Does anyone know what that could be ?? That file does not exist in the Pythonx.y directory where the program starts ;-). tjr -- http://mail.python.org/mailman/listinfo/python-list
Re: What is not objects in Python?
En Tue, 30 Sep 2008 08:07:18 -0300, Steve Holden <[EMAIL PROTECTED]> escribió: Terry Reedy wrote: Steven D'Aprano wrote: Arghh! No!!! |x| should be abs(x), not len(x). Just ask mathematicians and physicists. It should be both, just as + is addition for numbers and concatenation for sequences. Or we could have just one built-in -- size() instead of abs() and len(). For non-sequence collections, size() would be better than len() anyway. And how are these "non-sequence collections" to be distinguished? And how does size() differ from len() in that case? Consider a tree, or a graph. The number of elements they have is not naturally described as their "length", the usual term is "size" instead. "Length" is adequate for one-dimensional structures only; even len(dict) is a bit controversial. Had Python used the more generic size and __size__ from the beginning, we'd be all happy now :) But it's too late to change things. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Replacing cmd.exe with custom .py application
Is there something similar to /dev/null on Windows? On Tue, Sep 30, 2008 at 2:13 PM, Ezra Taylor <[EMAIL PROTECTED]> wrote: > Joseph: > Check out subprocess. The subprocess module is on python > 2.4. Also, use subprocess.call("your command",shell=True) > > On Linux/Unix, the process is below > > import subprocess > > ret = > subprocess.call("dir",shell=True,stdout=open('/dev/null','w'),stderr=subprocess.STDOUT) > > print ret > > You should get a return value of 0. Which means that it was > successful. I'm still learning this myself, so some of these other > guys might have more input. > > > > > > On Tue, Sep 30, 2008 at 10:32 AM, A. Joseph <[EMAIL PROTECTED]> wrote: >> >> >> Instead of going to the command line all the time, I want to create a small >> customized cmd.exe of my own, how can I get the return value from >> os.system() because I was thinking I can do soothing with os.system(), In >> case my question is not clear, just like an IDE that plugged in another >> .exe application. >> >> >> >> Sorry for any mistake in my question. Just help me if you can >> >> ___ >> Tutor maillist - [EMAIL PROTECTED] >> http://mail.python.org/mailman/listinfo/tutor >> >> > > > > -- > Ezra Taylor > -- Ezra Taylor -- http://mail.python.org/mailman/listinfo/python-list
Change environment after setreuid
I have a program (which normally runs as root) which can start child processes as different users. Effectively, my program is a modified version of popen2's Popen3 class where the child process (after the fork) does: os.setregid (gid, gid) os.setreuid (uid, uid) session_pid = os.setsid () This all seems to work. However, I am running into a problem where the environment of the new process still carries values that were set before the setreuid() call. What would be the best way to go about modifying the environment without having to re-implement all the functionality of the 'su' command? I could use it (the 'su' command) to start the new process but I'd like to avoid external dependencies like that. Thank you -- Mitko Haralanov == The program isn't debugged until the last user is dead. -- http://mail.python.org/mailman/listinfo/python-list
Re: Comparing float and decimal
Mark Dickinson wrote: On Sep 30, 9:21 am, Terry Reedy <[EMAIL PROTECTED]> wrote: If no one beats me to it, I will probably file a bug report or two, but I am still thinking about what to say and to suggest. I can't see many good options here. Some possibilities: Thanks for responding. Agreeing on a fix would make it more likely to happen sooner ;-) (0) Do nothing besides documenting the problem somewhere (perhaps in a manual section entitled 'Infrequently Asked Questions', or 'Uncommon Python Pitfalls'). I guess the rule is simply that Decimals don't mix well with other numeric types besides integers: if you put both floats and Decimals into a set, or compare a Decimal with a Fraction, you're asking for trouble. I suppose the obvious place for such a note would be in the decimal documentation, since non-users of decimal are unlikely to encounter these problems. Documenting the problem properly would mean changing the set documentation to change at least the definitions of union (|), issubset (<=), issuperset (>=), and symmetric_difference (^) from their current math set based definitions to implementation based definitions that describe what they actually do instead of what they intend to do. I do not like this option. (1) 'Fix' the Decimal type to do numerical comparisons with other numeric types correctly, and fix up the Decimal hash appropriately. (1A) All that is needed for fix equality transitivity corruption and the consequent set/dictview problems is to correctly compare integral values. For this, Decimal hash seems fine already. For the int i I tried, hash(i) == hash(float(i)) == hash(Decimal(i)) == hash(Fraction(i)) == i. It is fine for transitivity that all fractional decimals are unequal to all fractional floats (and all fractions) since there is no integer (or fraction) that either is equal to, let alone both. This is what I would choose unless there is some 'hidden' problem. But it seem to me this should work: when a float and decimal are both integral (easy to determine) convert either to an int and use the current int-whichever comparison. (2) I wonder whether there's a way to make Decimals and floats incomparable, so that an (in)equality check between them always raises an exception, and any attempt to have both Decimals and floats in the same set (or as keys in the same dict) also gives an error. (Decimals and integers should still be allowed to mix happily, of course.) But I can't see how this could be done without adversely affecting set performance. I pretty strongly believe that equality checks should always work (at least in Python as delivered) just as boolean checks should (and do). Option (1) is certainly technically feasible, but I don't like it much: it means adding a whole load of code to the Decimal module that benefits few users but slows down hash computations for everyone. And then any new numeric type that wants to fit in with Python's rules had better worry about hashing equal to ints, floats, Fractions, complexes, *and* Decimals... I believe (1A) would be much easier both to implement and for new numeric types. Option (2) appeals to me, but I can't see how to implement it. So I guess that just leaves updating the docs. Other thoughts? (3) Further isolate decimals by making decimals also unequal to all ints. Like (1A), this would easily fix transitivity breakage, but I would consider the result less desirable. My ranking: 1A > 3 > 0 > 2. I might put 1 between 1A and 3, but I am not sure. Mark Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: rlcompleter and wxPython, problems ...
Gabriel Genellina wrote: En Sun, 28 Sep 2008 19:25:30 -0300, Stef Mientki <[EMAIL PROTECTED]> escribió: I'm trying to implement autocompletion into my editor. But I find some weird behavior, or at least I don't have the faintest idea why this behavior occures, and even more important how to solve it In the example below I try to autocomplete " wx.s" , which in my humble opinion should at least produce "wx.stc" (and some others ). wx is a package. Modules within the package are not, by default, attributes of the package - unless they're imported in __init__.py or your code imports them. So the autocompleter is doing the right thing in what perspective ? the autocompleter is only meant to assist the program writer ;-) - wx.stc does not exist until it is explicitely imported. I guess I've to study the package. For the moment I'll implement a user editable list of additions. But with your remarks I tried __all__ And now I wonder why rlcompleter is not simply using "wx.__all__", it than does gets all the items ? cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list
pylab without X11
I want to use pylab (matplotlib) on a machine without X11. I'm trying to generate onthefly graphics for an apache2 web service, so they do not have to be displayed on this machine ! When i do pylab.figure() I get the error TclError: couldn't connect to display ":0.0" I tried setting the DISPLAY environment variable to "", ":0.0" but I got the same error message. Any help is very much appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: r""
On Tue, 30 Sep 2008 10:50:01 -0700, Kyle Hayes wrote: >> Please describe the actual problem you're trying to solve. In what way >> do slashes need to be "fixed," and why? > > Well, I have decided to build a tool to help us sync files in UNC paths. > I am just building the modules and classes right now so I haven't > developed the frontend yet. I am assuming when the user provides a path > (either by typing it in, or pulling it in from a config file), the UNC > slashes are going to escape stuff in the string, so I want to double > them up. > > I understand if the best way is to convert all the slashes to double- > slashes. But the 'r' function seemed so handy and convenient. You don't need to. Python's string is never escaped in-memory, it is only escaped when repr(s) is called (the interpreter's implicit print uses repr () instead of str()). And that means all string coming and going to/from IO (file, GUI, etc) is stored as-is. However, strings that comes from source code or interpreter prompt (a.k.a. literal string) needs to be escaped. Analogy: When you're writing a string in the source code, you add double quotes (""), right? But do you think the quotes are stored in memory? No, it's just an escape character to differentiate a string from its surrounding. -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE doesn't run on OSX 10.3.9
[EMAIL PROTECTED] wrote: Just installed Python 2.5.2 on a PowerPC G4 running OSX 10.3.9 and when clicking on the IDLE icon in the MacPython 2.5 folder nothing happens, program doesn't execute... I've uninstalled, reinstalled over again... I friend of mine just installed the same 2.5.2 download from the Python.org website on OSX 10.4.11 and all went fine...but shouldn't it install on 10.3.9 as well? Anyone have any ideas? Thanks. -Tom Do you have Tcl/Tk installed? It doesn't come on 10.3.9 by default. -- Kevin Walzer Code by Kevin http://www.codebykevin.com -- http://mail.python.org/mailman/listinfo/python-list
RE: OS.SYSTEM ERROR !!!
Yes, I new it was a directory issue. I am new to Python. Thank You David Blubaugh -Original Message- From: Martin Walsh [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 1:42 PM To: python-list@python.org Subject: Re: OS.SYSTEM ERROR !!! Blubaugh, David A. wrote: > To All, > > I have been attempting to execute the following program within the > Python environment: > > However, when I would try to execute the following lines of source > code within a python script file: > > import os > > os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") > > > I believe I may be missing something here that prevents the executable > file working within python from utilizing this (.dat). The printed > final error is the following: > > ERROR opening inputs/io/control.dat > > Does anyone know what that could be ?? Based on your description, it seems pretty obvious (and easy to confirm) that Myprogram.exe needs to be run from its containing directory ("C:\myprogramfolder\run"). Try something like this... import os pwd = os.getcwd() os.chdir('c:/myprogramfolder/run') os.system("Myprogram.exe 1 1 acc 0") os.chdir(pwd) HTH, Marty This e-mail transmission contains information that is confidential and may be privileged. It is intended only for the addressee(s) named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated. -- http://mail.python.org/mailman/listinfo/python-list
RE: OS.SYSTEM ERROR !!!
Thank You!! I am still new to Python!! David Blubaugh -Original Message- From: Christian Heimes [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2008 2:08 PM To: python-list@python.org Subject: Re: OS.SYSTEM ERROR !!! Blubaugh, David A. wrote: > To All, > > > I have been attempting to execute the following program within the > Python environment: > > Myprogram.exe, which means this is an executable file!! > > I would usually execute this program (with the appropriate arguments) > by going to following directory within MS-DOS (Windows XP): > > C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 > > > The executable would execute perfectly. > > > However, when I would try to execute the following lines of source > code within a python script file: > > import os > > os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") Try this: import subprocess retval = subprocess.call( ['Myprogram.exe', '1', '1', 'acc', '0'], cwd='C:\myprogramfolder\run') Christian This e-mail transmission contains information that is confidential and may be privileged. It is intended only for the addressee(s) named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
Steven D'Aprano wrote: On Tue, 30 Sep 2008 22:19:57 +1000, Ben Finney wrote: I do, because a natural, beneficial act (modify the work and redistribute it) that has no technical reason to restrict, is artifically restricted. We agree that the restriction is artificial, and I think irrational (although I'd be interested in hearing the gnuplot developers' reasoning before making a final judgment). I believe it is a matter of preserving clarity of authorship, just as is the quoting mechanism we take for granted in posts like this. If I removed the quote marks above and silently edited what Ben and you wrote, I might upset someone and certainly could confuse readers. tjr -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
[EMAIL PROTECTED] wrote: I would add the following line right before your call to os.system: os.chdir(r'C:\myprogramfolder\run') I wouldn't. os.chdir() tends to introduce all sorts of trouble. It's a quick n'dirty hack for a small script but no solution for a large program or library. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Tuesday 30 September 2008 16:04:35 George Sakkis wrote: > What you're missing is that for Free Software (TM) zealots it's a > matter of philosophical principle, totally unrelated to how easy is to > overcome the restriction. There is not a "practicality beats purity" > clause in the FSF Bible. The gnuplot license is a free software according to FSF, what is the problem here after all? > George -- José Abílio -- http://mail.python.org/mailman/listinfo/python-list
Re: [Tutor] Replacing cmd.exe with custom .py application
Joseph: Check out subprocess. The subprocess module is on python 2.4. Also, use subprocess.call("your command",shell=True) On Linux/Unix, the process is below import subprocess ret = subprocess.call("dir",shell=True,stdout=open('/dev/null','w'),stderr=subprocess.STDOUT) print ret You should get a return value of 0. Which means that it was successful. I'm still learning this myself, so some of these other guys might have more input. On Tue, Sep 30, 2008 at 10:32 AM, A. Joseph <[EMAIL PROTECTED]> wrote: > > > Instead of going to the command line all the time, I want to create a small > customized cmd.exe of my own, how can I get the return value from > os.system() because I was thinking I can do soothing with os.system(), In > case my question is not clear, just like an IDE that plugged in another > .exe application. > > > > Sorry for any mistake in my question. Just help me if you can > > ___ > Tutor maillist - [EMAIL PROTECTED] > http://mail.python.org/mailman/listinfo/tutor > > -- Ezra Taylor -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
Blubaugh, David A. wrote: > To All, > > I have been attempting to execute the following program within the > Python environment: > > However, when I would try to execute the following lines of source code > within a python script file: > > import os > > os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") > > > I believe I may be missing something here that prevents the executable > file working within python from utilizing this (.dat). The printed > final error is the following: > > ERROR opening inputs/io/control.dat > > Does anyone know what that could be ?? Based on your description, it seems pretty obvious (and easy to confirm) that Myprogram.exe needs to be run from its containing directory ("C:\myprogramfolder\run"). Try something like this... import os pwd = os.getcwd() os.chdir('c:/myprogramfolder/run') os.system("Myprogram.exe 1 1 acc 0") os.chdir(pwd) HTH, Marty -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
Blubaugh, David A. wrote: To All, I have been attempting to execute the following program within the Python environment: Myprogram.exe, which means this is an executable file!! I would usually execute this program (with the appropriate arguments) by going to following directory within MS-DOS (Windows XP): C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 The executable would execute perfectly. However, when I would try to execute the following lines of source code within a python script file: import os os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") Try this: import subprocess retval = subprocess.call( ['Myprogram.exe', '1', '1', 'acc', '0'], cwd='C:\myprogramfolder\run') Christian -- http://mail.python.org/mailman/listinfo/python-list
IDLE doesn't run on OSX 10.3.9
Just installed Python 2.5.2 on a PowerPC G4 running OSX 10.3.9 and when clicking on the IDLE icon in the MacPython 2.5 folder nothing happens, program doesn't execute... I've uninstalled, reinstalled over again... I friend of mine just installed the same 2.5.2 download from the Python.org website on OSX 10.4.11 and all went fine...but shouldn't it install on 10.3.9 as well? Anyone have any ideas? Thanks. -Tom -- http://mail.python.org/mailman/listinfo/python-list
Re: r""
Kyle Hayes wrote: >> Please describe the actual problem you're trying to solve. In what way >> do slashes need to be "fixed," and why? > > Well, I have decided to build a tool to help us sync files in UNC > paths. I am just building the modules and classes right now so I > haven't developed the frontend yet. I am assuming when the user > provides a path (either by typing it in, or pulling it in from a > config file), the UNC slashes are going to escape stuff in the string, > so I want to double them up. That assumption is incorrect. While backslashes in string literals are escape characters that must be doubled up to convey literal backslashes, no such interpretation is made for backslashes that are read from a GUI text box or from a file. See for yourself: >>> some_string = raw_input("Enter a string: ") Enter a string: blah\blah\blah >>> print some_string blah\blah\blah Carry on and come back when you actually have a problem ;) -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Would this be called a bug in inspect ?
hello, I'm not familiar with inspect, but I get an error (see below) in getmembers ( wx ) Of course this is bug in wx . But would you also call this a bug in inspect ? (inspect crashes and doesn't continue with th rest of the code, nor it returns the already gathered data) thanks, Stef >>> import wx >>> wx.version() '2.8.7.1 (msw-unicode)' >>> from inspect import * >>> getmembers(wx) Traceback (most recent call last): File "", line 1, in File ")>)>>", line 517, in pphook File "P:\Python\Lib\pprint.py", line 55, in pprint printer.pprint(object) File "P:\Python\Lib\pprint.py", line 106, in pprint self._format(object, self._stream, 0, 0, {}, 0) File "P:\Python\Lib\pprint.py", line 129, in _format rep = self._repr(object, context, level - 1) File "P:\Python\Lib\pprint.py", line 195, in _repr self._depth, level) File "P:\Python\Lib\pprint.py", line 207, in format return _safe_repr(object, context, maxlevels, level) File "P:\Python\Lib\pprint.py", line 283, in _safe_repr orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level) File "P:\Python\Lib\pprint.py", line 283, in _safe_repr orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level) File "P:\Python\Lib\pprint.py", line 292, in _safe_repr rep = repr(object) File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 242, in __repr__ def __repr__(self): return 'wx.Colour' + str(self.Get(True)) File "P:\Python\lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py", line 230, in Get return _gdi_.Colour_Get(*args, **kwargs) TypeError: in method 'Colour_Get', expected argument 1 of type 'wxColour *' -- http://mail.python.org/mailman/listinfo/python-list
Problems with encoding/decoding locales
Hi there, I'm using a python script in conjunction with a JPype, to run java classes. So, here's the code: from jpype import * import os import random import math import sys input = open('foo.img','rb').read().decode('ISO-8859-1') square = java.encoding(input) output = java.decoding() fd = open('foo_decode.img','wb') fd.write(output.encode('ISO-8859-1')) fd.close() sys.exit(0) First of all, java.encoding and java.decoding are two methods that respectively take a java string as an argument and return a java String. JPype is the bridge between Java and Python, and converts automatically a str or unicode pythonstring into a Java String. So, input and output are two unicode strings. I were forced to use decode() and encode() methods by python, otherwise it refuses to read foo.img file. Here's the strange behaviour: when I write the output in the 'foo_decode.img', I don't reassemble the original file; I already tested the java encoding/decoding libraries with the same input file, and what the decoding process returns is the original file. I suspect that the discrepancy is due to encoding/decoding of ISO-8859-1: is that required? What do you think about? Thank you -- http://mail.python.org/mailman/listinfo/python-list
Re: r""
On Sep 30, 1:17 pm, Kyle Hayes <[EMAIL PROTECTED]> wrote: > Is there a way to use the 'r' in front of a variable instead of > directly in front of a string? Or do I need to use a function to get > all of the slashes automatically fixed? Is this what you're talking about? str = "foo/bar" re = Regexp.new(str) => /foo\/bar/ -- Mark. -- http://mail.python.org/mailman/listinfo/python-list
Re: r""
> Please describe the actual problem you're trying to solve. In what way > do slashes need to be "fixed," and why? Well, I have decided to build a tool to help us sync files in UNC paths. I am just building the modules and classes right now so I haven't developed the frontend yet. I am assuming when the user provides a path (either by typing it in, or pulling it in from a config file), the UNC slashes are going to escape stuff in the string, so I want to double them up. I understand if the best way is to convert all the slashes to double- slashes. But the 'r' function seemed so handy and convenient. I am very new to Python, but not at all to programming. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
On Sep 30, 1:21 pm, "Blubaugh, David A." <[EMAIL PROTECTED]> wrote: > I would usually execute this program (with the appropriate arguments) by > going to following directory within MS-DOS (Windows XP): > > C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 [snip] > import os > > os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") [snip] > ERROR opening inputs/io/control.dat [snip] I would add the following line right before your call to os.system: os.chdir(r'C:\myprogramfolder\run') If you have to change directories to run it properly in the Windows shell, then you need to do it in Python, too. HTH, Geoff G-T -- http://mail.python.org/mailman/listinfo/python-list
Re: OS.SYSTEM ERROR !!!
Blubaugh, David A. wrote: > To All, > > > I have been attempting to execute the following program within the > Python environment: > > Myprogram.exe, which means this is an executable file!! > > I would usually execute this program (with the appropriate arguments) by > going to following directory within MS-DOS (Windows XP): > > C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 > > > The executable would execute perfectly. > > > However, when I would try to execute the following lines of source code > within a python script file: > > import os > > os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") > > > The executable file would start to execute until it would print an error > stating that it cannot use a (.dat) file, which is located under the > following directory: > > > C:\myprogramfolder\run\inputs\io\control.dat > > > I believe I may be missing something here that prevents the executable > file working within python from utilizing this (.dat). The printed > final error is the following: > > ERROR opening inputs/io/control.dat > > Does anyone know what that could be ?? The program (myprogram.exe) is not looking for C:\myprogramfolder\run\inputs\io\control.dat, it's looking for inputs/io/control.dat relative to its current working directory. That will only work if the current working directory of the program is C:\myprogramfolder\run. Is it? -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
Re: r""
Kyle Hayes wrote: > Is there a way to use the 'r' in front of a variable instead of > directly in front of a string? Or do I need to use a function to get > all of the slashes automatically fixed? Please describe the actual problem you're trying to solve. In what way do slashes need to be "fixed," and why? -- Carsten Haese http://informixdb.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list
OS.SYSTEM ERROR !!!
To All, I have been attempting to execute the following program within the Python environment: Myprogram.exe, which means this is an executable file!! I would usually execute this program (with the appropriate arguments) by going to following directory within MS-DOS (Windows XP): C:\myprogramfolder\run> Myprogram.exe 1 1 acc 0 The executable would execute perfectly. However, when I would try to execute the following lines of source code within a python script file: import os os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0") The executable file would start to execute until it would print an error stating that it cannot use a (.dat) file, which is located under the following directory: C:\myprogramfolder\run\inputs\io\control.dat I believe I may be missing something here that prevents the executable file working within python from utilizing this (.dat). The printed final error is the following: ERROR opening inputs/io/control.dat Does anyone know what that could be ?? Thanks, David Blubaugh This e-mail transmission contains information that is confidential and may be privileged. It is intended only for the addressee(s) named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated. -- http://mail.python.org/mailman/listinfo/python-list
r""
Is there a way to use the 'r' in front of a variable instead of directly in front of a string? Or do I need to use a function to get all of the slashes automatically fixed? /thanks -Kyle -- http://mail.python.org/mailman/listinfo/python-list
Re: how to find out the version of a certain installed package
great! thanks for you fast response. Christophe On Tue, Sep 30, 2008 at 6:30 PM, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > On 2008-09-30 18:17, Christophe wrote: > > Hi, > > > > In a projecet I'm making using pycrypto, I need to find out the > > current installed version of pycrypto. After looking around, I found > > out that "pkg_resources.requires("pycrypto") will give me a string > > containing the version number, but is this the only way to do it or > > are there other ways? > > Most packages have a .__version__ attribute in their top-level > package dir which you can query. > > You do have to import the base package, though, in order to find > out. > > Thanks, > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Source (#1, Sep 30 2008) > >>> Python/Zope Consulting and Support ...http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ > > > Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! > > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 >D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On 2008-09-30, Ivan Reborin <[EMAIL PROTECTED]> wrote: > But as I said, got a job that't got to be done, so I'm trying > to figure out how to do array operations as easily as possible > in python, which are necessary for all my calculations. numpy -- Grant Edwards grante Yow! TONY RANDALL! Is YOUR at life a PATIO of FUN?? visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: XMLRPC - C Client / Python Server
On Tue, Sep 30, 2008 at 8:05 AM, <[EMAIL PROTECTED]> wrote: > I have implemented a simple Python XMLRPC server and need to call it > from a C/C++ client. What is the simplest way to do this? I need to > pass numerical arrays from C/C++ to Python. If you just googled for "xmlrpc c", you would've found http://xmlrpc-c.sourceforge.net/ , which appears to be the best (and possibly only) option for this. Also, this isn't really Python-related if you think about it. Regards, Chris -- Follow the path of the Iguana... http://rebertia.com > > Yours, Carl > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: how to find out the version of a certain installed package
On 2008-09-30 18:17, Christophe wrote: > Hi, > > In a projecet I'm making using pycrypto, I need to find out the > current installed version of pycrypto. After looking around, I found > out that "pkg_resources.requires("pycrypto") will give me a string > containing the version number, but is this the only way to do it or > are there other ways? Most packages have a .__version__ attribute in their top-level package dir which you can query. You do have to import the base package, though, in order to find out. Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Sep 30 2008) >>> Python/Zope Consulting and Support ...http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 -- http://mail.python.org/mailman/listinfo/python-list
how to find out the version of a certain installed package
Hi, In a projecet I'm making using pycrypto, I need to find out the current installed version of pycrypto. After looking around, I found out that "pkg_resources.requires("pycrypto") will give me a string containing the version number, but is this the only way to do it or are there other ways? thanks, Christophe -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On 30 Sep 2008 15:31:59 GMT, Peter Pearson <[EMAIL PROTECTED]> wrote: > >Since you're coming from the FORTRAN world (thank you for >that stroll down Memory Lane), you might be doing scientific >computations, and so might be interested in the SciPy >package (Google scipy), which gives you arrays and matrices. >Don't expect to be able to use it without learning some Python, >though. Actually, no (regarding memory lane :-). I'm helping a friend to translate some of my old routines to python so he can use them in his programs. I'm still using fortran84, and mean to continue doing so as long as something better doesn't come along. But as I said, got a job that't got to be done, so I'm trying to figure out how to do array operations as easily as possible in python, which are necessary for all my calculations. Best regards Ivan -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On Tue, 30 Sep 2008 10:57:19 -0500, Grant Edwards wrote: > On 2008-09-30, Peter Pearson <[EMAIL PROTECTED]> wrote: >> On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote: >>> >>> 1. Multi dimensional arrays - how do you load them in python For >>> example, if I had: >>> --- >>> 1 2 3 >>> 4 5 6 >>> 7 8 9 >>> >>> 10 11 12 >>> 13 14 15 >>> 16 17 18 >>> --- >>> with "i" being the row number, "j" the column number, and "k" the .. >>> uhmm, well, the "group" number, how would you load this ? >>> >>> If fortran90 you would just do: >>> >>> do 10 k=1,2 >>> do 20 i=1,3 >>> >>> read(*,*)(a(i,j,k),j=1,3) >>> >>> 20 continue >>> 10 continue >>> >>> How would the python equivalent go ? > > You would drag yourself out of the 1960s, install numpy, and then do > something like this: > >a = read_array(open("filename.dat","r")) In [64]: a = numpy.fromfile('test.txt', dtype=int, sep=' ') In [65]: a Out[65]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]) In [66]: a.reshape(2, 3, 3) Out[66]: array([[[ 1, 2, 3], [ 4, 5, 6], [ 7, 8, 9]], [[10, 11, 12], [13, 14, 15], [16, 17, 18]]]) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: How to add CC and BCC while sending mails using python
Hi, * cindy jones [2008-09-30 19:57]: > > Can someone tel me how to add cc's and bcc's while sending mails using > python Following (tested) snippet should help: -- 8< -- from smtplib import SMTP from email.mime.image import MIMEImage from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart to = '[EMAIL PROTECTED]' cc = '[EMAIL PROTECTED]' bcc = '[EMAIL PROTECTED]' msg = MIMEMultipart() msg['To'] = to msg['Cc'] = cc msg['From'] = '[EMAIL PROTECTED]' msg['Subject'] = 'Test' text = MIMEText('Das ist ein Test') text.add_header("Content-Disposition", "inline") msg.attach(text) s = SMTP('test.smtp.relay') s.sendmail(msg['From'], [to, cc, bcc], msg.as_string()) s.quit() -- >8 -- Regards, Bernhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On 2008-09-30, Peter Pearson <[EMAIL PROTECTED]> wrote: > On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote: >> >> 1. Multi dimensional arrays - how do you load them in python >> For example, if I had: >> --- >> 1 2 3 >> 4 5 6 >> 7 8 9 >> >> 10 11 12 >> 13 14 15 >> 16 17 18 >> --- >> with "i" being the row number, "j" the column number, and "k" the .. >> uhmm, well, the "group" number, how would you load this ? >> >> If fortran90 you would just do: >> >> do 10 k=1,2 >> do 20 i=1,3 >> >> read(*,*)(a(i,j,k),j=1,3) >> >> 20 continue >> 10 continue >> >> How would the python equivalent go ? You would drag yourself out of the 1960s, install numpy, and then do something like this: a = read_array(open("filename.dat","r")) > Since you're coming from the FORTRAN world (thank you for that > stroll down Memory Lane), you might be doing scientific > computations, and so might be interested in the SciPy package > (Google scipy), which gives you arrays and matrices. Don't > expect to be able to use it without learning some Python, > though. If not full-up scipy (which provides all sorts of scientific and numerical-analysis stuff), then at least numpy (which provides the basic array/matrix operations: http://numpy.scipy.org/ Though the software is free, the documentation isn't. You've got to buy the book if you want something to read. IMO, it's definitely worth it, and a good way to support the project even if you don't really need something to keep your bookends apart. Scientific Python is something else the OP might be interested in. Yes, Scientific Python is different than SciPy: http://dirac.cnrs-orleans.fr/plone/software/scientificpython/overview/ If you're a Windows user, I can recommend the Enthough Python distribution. It has all sorts of numerical and scientific "batteries included". http://www.enthought.com/products/epd.php It includes both scipy and scientific python as well as several options for data visualization (e.g. matplotlib, VTK). There's also an Enthought Python distro for Linux, but I've never tried it. I run Gentoo Linux, and there are standard ebuilds for pretty much all of the stuff in EPD. -- Grant Edwards grante Yow! I've read SEVEN at MILLION books!! visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On Tue, 30 Sep 2008 00:04:18 +0200, Ivan Rebori wrote: > > 1. Multi dimensional arrays - how do you load them in python > For example, if I had: > --- > 1 2 3 > 4 5 6 > 7 8 9 > > 10 11 12 > 13 14 15 > 16 17 18 > --- > with "i" being the row number, "j" the column number, and "k" the .. > uhmm, well, the "group" number, how would you load this ? > > If fortran90 you would just do: > > do 10 k=1,2 > do 20 i=1,3 > > read(*,*)(a(i,j,k),j=1,3) > > 20 continue > 10 continue > > How would the python equivalent go ? Since you're coming from the FORTRAN world (thank you for that stroll down Memory Lane), you might be doing scientific computations, and so might be interested in the SciPy package (Google scipy), which gives you arrays and matrices. Don't expect to be able to use it without learning some Python, though. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://mail.python.org/mailman/listinfo/python-list
Re: Shed Skin (restricted) Python-to-C++ compiler 0.0.29
On Sep 30, 6:19 am, "Mark Dufour" <[EMAIL PROTECTED]> wrote: > Hi all, > > I have just released Shed Skin 0.0.29, with the following changes. Not to sound negative, but what's with the 0.0.x version numbers ? Maybe it's just me, but seeing a zero major/minor version give me the impression of experimental/pre-alpha project, which (from my very limited knowledge) doesn't do justice to shedskin's current state. Regardless, congrats for this great effort, hope it gains more prominence in the future! George -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding subsets for a robust regression
Thank you everyone, for your input. The help is much appreciated. Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list
XMLRPC - C Client / Python Server
I have implemented a simple Python XMLRPC server and need to call it from a C/C++ client. What is the simplest way to do this? I need to pass numerical arrays from C/C++ to Python. Yours, Carl -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Sep 30, 9:43 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 30 Sep 2008 22:19:57 +1000, Ben Finney wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > >> On Tue, 30 Sep 2008 19:04:41 +1000, Ben Finney wrote: > >> > You're not free to modify gnuplot and redistribute the result. > > >> > That you're free to distribute patches is nice, but it's not enough > >> > to make the work free. The freedom to help people by giving them an > >> > *already-modified* gnuplot is restricted by the copyright holder. > > >> > It's an artificial restriction on redistribution of derived works, > >> > making them second-class for the prupose of getting them into > >> > people's hands. > > >> Yes it is. It seems a strange, unnecessary restriction. But is it > >> sufficient to make it non-free? I don't think so. > > > I do, because a natural, beneficial act (modify the work and > > redistribute it) that has no technical reason to restrict, is > > artifically restricted. > > We agree that the restriction is artificial, and I think irrational > (although I'd be interested in hearing the gnuplot developers' reasoning > before making a final judgment). > > But I just don't see the requirement that modified software be > distributed in form X (original source + diffs) versus form Y (modified > source in a tar ball) or form Z (an rpm) to be that big a deal. Not > enough to make it "non-free software". > > I simply don't think that having to run some variation on > > patch -i patchfile.patch > > is a requirement so onerous that it makes the gnuplot licence non-free. > Perhaps I'm just more tolerant of eccentricities than you :) What you're missing is that for Free Software (TM) zealots it's a matter of philosophical principle, totally unrelated to how easy is to overcome the restriction. There is not a "practicality beats purity" clause in the FSF Bible. George -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On Tue, 30 Sep 2008 15:42:58 +0200, Ivan Reborin wrote: > On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> > wrote: >>= >>from __future__ import with_statement from functools import partial >>from itertools import islice >>from pprint import pprint >> >> >>def read_group(lines, count): >>return [map(int, s.split()) for s in islice(lines, count)] >> >>def main(): >>with open('test.txt') as lines: >>lines = (line for line in lines if line.strip()) >>result = list(iter(partial(read_group, lines, 3), list())) >>pprint(result, width=30) >> >>if __name__ == '__main__': >>main() >>= > > I'm afraid I must admit I find the code above totally uncomprehesible (I > can't even see where the array here is mentioned - "result"?) and > inpractical for any kind of engineering practice I had in mind. Learn Python then to understand that code. ;-) There is no array. The data type is called "list" in Python, so `result` is a nested list. And in Python it quite unusual to build lists by creating them with the final size filled with place holder objects and then fill the real values in. Instead lists are typically created by appending values to existing lists, using list comprehension or the `list()` function with some iterable object. Typical Python code tries to minimize the use of index variables. Python is not Fortran (or C, or Pascal, …). > Does python, perchance, have some wrapper functions or something, which > would allow one to load an array in a more natural "technical" way ? > Like something mentioned above in my post (now deleted) ? > > Also, is there a way to change counter for arrays to go from 0 to 1 ? You can write your own sequence type but that would be odd because the rest of the language expects zero as the first index, so you will be constantly fighting the language by adding or subtracting 1 all the time at the "border" between your custom sequence type and the the rest of Python. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Replacing cmd.exe with custom .py application
Instead of going to the command line all the time, I want to create a small customized cmd.exe of my own, how can I get the return value from os.system() because I was thinking I can do soothing with os.system(), In case my question is not clear, just like an IDE that plugged in another .exe application. Sorry for any mistake in my question. Just help me if you can -- http://mail.python.org/mailman/listinfo/python-list
How to add CC and BCC while sending mails using python
Hello all, Can someone tel me how to add cc's and bcc's while sending mails using python Thank you all -- http://mail.python.org/mailman/listinfo/python-list
Re: Python arrays and sting formatting options
On 30 Sep 2008 07:07:52 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: Hello Marc, thanks for answering (on both subjects). I understand now the logic which lays behind what you were explaining in the other one. It cleared things quite a bit. >Well, I don't know if this qualifies as equivalent: > >= >from __future__ import with_statement >from functools import partial >from itertools import islice >from pprint import pprint > > >def read_group(lines, count): >return [map(int, s.split()) for s in islice(lines, count)] > >def main(): >result = list() >with open('test.txt') as lines: >lines = (line for line in lines if line.strip()) >result = list(iter(partial(read_group, lines, 3), list())) >pprint(result, width=30) >if __name__ == '__main__': >main() >= I'm afraid I must admit I find the code above totally uncomprehesible (I can't even see where the array here is mentioned - "result"?) and inpractical for any kind of engineering practice I had in mind. Does python, perchance, have some wrapper functions or something, which would allow one to load an array in a more natural "technical" way ? Like something mentioned above in my post (now deleted) ? Also, is there a way to change counter for arrays to go from 0 to 1 ? (first element being with the index 1) ? (probably not since that seems like a language implementation thing, but it doesn't hurt to ask) -- Ivan -- http://mail.python.org/mailman/listinfo/python-list
Re: Python is slow?
On Tue, 30 Sep 2008 22:19:57 +1000, Ben Finney wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > >> On Tue, 30 Sep 2008 19:04:41 +1000, Ben Finney wrote: >> > You're not free to modify gnuplot and redistribute the result. >> > >> > That you're free to distribute patches is nice, but it's not enough >> > to make the work free. The freedom to help people by giving them an >> > *already-modified* gnuplot is restricted by the copyright holder. >> > >> > It's an artificial restriction on redistribution of derived works, >> > making them second-class for the prupose of getting them into >> > people's hands. >> >> Yes it is. It seems a strange, unnecessary restriction. But is it >> sufficient to make it non-free? I don't think so. > > I do, because a natural, beneficial act (modify the work and > redistribute it) that has no technical reason to restrict, is > artifically restricted. We agree that the restriction is artificial, and I think irrational (although I'd be interested in hearing the gnuplot developers' reasoning before making a final judgment). But I just don't see the requirement that modified software be distributed in form X (original source + diffs) versus form Y (modified source in a tar ball) or form Z (an rpm) to be that big a deal. Not enough to make it "non-free software". I simply don't think that having to run some variation on patch -i patchfile.patch is a requirement so onerous that it makes the gnuplot licence non-free. Perhaps I'm just more tolerant of eccentricities than you :) -- Steven -- http://mail.python.org/mailman/listinfo/python-list
ElementTree Help With DTD
Afternoon All, I have used elementtree for a little while now parsing simple XML documents and found it pretty intuitive. Today is the first time I've used the library to create an XML file though. I have a simple script which looks like this: # Save the configuration to the XML file. # Create the root element, top = etree.Element("top") # Create the other elements in the tree. sub1 = etree.SubElement(top, "sub1") sub1.text = "other text" # Create the core element tree object. tree = etree.ElementTree(top) # Write the XML to the file system. tree.write("/path/to/my.xml") This works just fine, in as much that I get an XML file with the correct XML content within it, like so: other text However, I really need to validate this built XML against a DTD schema that I have, and also add the DTD reference to the top of the generated file, so other applications parsing it in can validate it properly, like so: other text As you can see, this also includes the proper XML definition for the file. Can anyone offer any pointers on how to have ElementTree add these additional definitions to the file it generates? And also validate itself against the DTD before writing to the FS? Many thanks guys, I really appreciate it. Heston -- http://mail.python.org/mailman/listinfo/python-list
Re: Python style: exceptions vs. sys.exit()
Steven D'Aprano a écrit : On Mon, 29 Sep 2008 18:27:22 +0200, Bruno Desthuilliers wrote: Lawrence D'Oliveiro a écrit : In message <[EMAIL PROTECTED]>, Ross Ridge wrote: You need either use trial and error to find out, or look at the source. So what's wrong with using the source as documentation? :) Don't know... Ok, having higher-level documentation (the big picture, and quick description of what and how for classes and functions) really helps. But when it comes to nitty-gritty details, source code is the best documentation ever, since it's always accurate and up to date. FWIW, I'm often surprised by people asking questions about some implementation detail of some open-source library or framework that are very easily answered just looking at the source code. Reading the source is 1/ the best way to really know how something is implemented and 2/ usually very instructive. Reading the source code is good, but it's not a panacea. Not what I implied. There are at least four things wrong with the advice to read the source code: My "advice to read the source code" was not meant as a *replacement* for documentation, but as a *complement* to it. What I meant is that you just can't document each and every detail of implementation. (1) It's not always available. (2) Even when the source is available, it is sometimes a legal trap to read it with respect to patents and copyright. E.g. some Microsoft so- called "open" licences (but not all) allow you to read the source, but if you do then everything you program in a related field from that point is legally contaminated and could be considered a derivative work of Microsoft's software. I obviously implied that source was freely available and you had the right to read it. Else it just makes no sense. (3) Source code not always understandable without significant effort. That's why reading the source can have a great educational value, isn't it ?-) Code can be obfuscated, either to hide the algorithm, same problem as closed-source software - not concerned by this advice. as an optimization, or simply because the coder is cleverer than you are. It might be in a language you don't understand (e.g. Python built-ins are written in C, not Python. I have to learn C to find out what exceptions sorted() can raise?). Every developer should have at least basic knowledge of C. MHO of course. That's why accurate documentation should be preferred in the first place. Indeed. Did I say otherwise ? Now not all code has accurate documentation, and then you're happy to be able to access and possibly understand the source code. I'm not talking about an ideal world here. (snip) Yes, documentation can fall behind the source code, but once the code is stable and the documentation has caught up and is accurate, there's no reason to re-invent the wheel by slugging through the source just to find out something already documented. Once again, that's not what I said. (4) Even when the source code is available, legally unencumbered, in a language you understand and not too complicated for you to grasp, there's the combinatorial explosion: you may need to read and understand an arbitrarily large and complex chain of software merely to know what a single function can do. Yes, this happens when hi-level documentation is lacking. At least you have a chance to gain some insight !-) E.g. you want to know what exceptions function spam() can raise: def spam(x): a = 1 b = 2 c = ham(x) return fried_eggs(a, b, c) Now you need to understand ham() and fried_eggs(), but they aren't documented either. So you turn to their source code, and each of them call two functions, each of which call another two functions, each of which call *another* two functions... And still you're a lucky guy if there's no callback, conditional import and / or polymorphic dispatch involved. Steve, I may not have been clear, but I didn't meant that code shouldn't be documented. I was : 1/ answering to the question "So what's wrong with using the source as documentation?", my own personal answer being that it's something I often do, whether because I want to find out some detail not covered by the available documentation, whatever this available documention is worth 2/ digressing about the fact that, to my suprise, few developpers seem to *first* have a look at the source code when either documentation is lacking or they'd like to know more about some implementation detail. But FWIW, it seems that few developpers even bother reading the documentation at all :( -- http://mail.python.org/mailman/listinfo/python-list