From zeitlin at seth.lpthe.jussieu.fr Fri Nov 3 12:12:39 2000 From: zeitlin at seth.lpthe.jussieu.fr (Vadim Zeitlin) Date: 3 Nov 2000 17:12:39 GMT Subject: autoconf macro to detect Python? Message-ID: Hello, sorry if this has been asked before, but DejaNews search didn't find anything and the autoconf archive seems to be unaccessible from here so I decided to post it here: My question is whether there exists a standard/official macro to use in configure.in script to check for Python installation, i.e. headers and libraries? Currently I have my own but it only works for 1.x and I thought that instead of updating it to handle 2.0 it might be better to reuse an existing one, if it exists, of course. Thanks, VZ -- GCS/GM d? H+ s++:-- p2 au--- a- w+ v C+++ UBLS+++ P- L++ N++ E--- W++++ M? V-- -po+ R++ G`` !tv b+++ D--- e++++ u++ h--- f+ r++ n- y? From garry at sage.att.com Thu Nov 2 14:28:03 2000 From: garry at sage.att.com (Garry Hodgson) Date: Thu, 2 Nov 2000 19:28:03 GMT Subject: Python scoping References: <8FD6F80F0suppamanxcollectoror@209.155.56.95> <39ff9af1.6455875@nntp.interaccess.com> Message-ID: <3A01C043.C1C1FB91@sage.att.com> "Thaddeus L. Olczyk" wrote: > I tend to agree and am very much confused about the python > community's attitude about this point. You get hit in several > different ways with indentation. [dire consequences omitted] oddly enough, in several years now, i haven't found any of these to be a problem. nor have the other folks i know who use python. > Forcing people to properly indent to get the indentation right ( or > hope their editor does, and sometimes it doesn't ) to get the right > block structure seems foolish. About the only reason that people can > provide is that it forces people to have a coherent coding style > indentation wise. i don't care about forcing other people to indent. i care that i needn't clutter my code with noise characters or noise keywords. > The biggest thing that the python community doesn't realise is how > much it hurts them to use indenting to determine the block structure. > I know at least five programmers who say they will never touch python > because of this one fact even though they consider it superior to > alternatives in every other way. their loss. maybe they'll mature a bit and revisit the issue when they're ready for it. > I also know of two managers ( from > programming ranks ) who say they wouldn't allow their programers > to use it. They say that any language that requires that of it's > proggrammers is probably to simplistic ( from some previous experience > I guess ). again, that is their loss. if they're making broad assumptions based on such a minor point, i'd say their judgement isn't very good to begin with. > Should there ever come around a programming language > similar to python but with braces or a begin/end, then python will be > gone. The volume of people who have been avoiding python ( along with > some who now use python ) will adapt the new language, and the > momentum will be sucked avay from python. there are any number of languages quite similar to python. most use the traditional noise for statement grouping. python is still here. -- Garry Hodgson Once in a while Senior Hacker you can get shown the light Software Innovation Services in the strangest of places AT&T Labs if you look at it right From th at alley.org Mon Nov 20 09:19:01 2000 From: th at alley.org (Trond Hanssen) Date: Mon, 20 Nov 2000 15:19:01 +0100 Subject: Approaching the problem... References: <8v1nr8$6d8$1@nnrp1.deja.com> <8v2upj0273h@news2.newsguy.com> Message-ID: * | [Reading News the "guerilla way"] * Alex Martelli | Once I'm convinced that a technical solution is appropriate, I would | start looking for "the simplest thing that can possibly work". I'm not up-to-date on everything that's new in the wonderful world of Gnus, but I wouldn't be terribly surprised if there is a "select method" (in Gnus parlance) for reading News from Deja. If somebody decided to do a version of RFC1149 for NNTP, I'm sure Gnus would support it about 15 minutes after publication. See for more info. Couldn't-fake-the-timbot-even-if-my-life-depended-on-it-ly yrs, -- From olivierS.dagenaisP at canadaA.comM Fri Nov 3 00:12:26 2000 From: olivierS.dagenaisP at canadaA.comM (Olivier Dagenais) Date: Fri, 03 Nov 2000 05:12:26 GMT Subject: reading passwords References: Message-ID: <_OrM5.423581$1h3.11559134@news20.bellglobal.com> The 'getpass' module has a 'getpass' function. Look it up, I dare you! Or-you-could-build-a-mind-reader-and-just-ask-the-user-to-think-of-their-pas sword-ly y'rs, -- ---------------------------------------------------------------------- Olivier A. Dagenais - Software Architect and Developer "Someone called 'Type your name here' is impersonating me on the internet and is posting exactly the same things I am posting!" "Michael P. Soulier" wrote in message news:slrn904civ.j1.michael.soulier at cr946650-a.rchrd.home.com... > Hey people. If I want to read a password from the user, I shouldn't use > raw_input, since it echos to the screen. Is there a function I can use that > will not do this, safe for entering passwords? > > Mike > > -- > Michael P. Soulier > "...the word HACK is used as a verb to indicate a massive amount > of nerd-like effort." -Harley Hahn, A Student's Guide to UNIX > PGP Public Key: http://www.storm.ca/~msoulier/personal.html From tismer at tismer.com Sat Nov 18 11:20:53 2000 From: tismer at tismer.com (Christian Tismer) Date: Sat, 18 Nov 2000 18:20:53 +0200 Subject: .readline() - VERY SLOW compared to PERL References: <8uthf2$pjh$04$1@news.t-online.com> <8utnqk02rlq@news1.newsguy.com> <8uu44b$4nc$04$1@news.t-online.com> Message-ID: <3A16AC65.90AAD0C6@tismer.com> Harald Schneider wrote: > > Thanks or your reply. .readlines() won't fit, since the data is VERY huge. > So .readline() is a must. > > The link on parmassus is definitive dead .... :-/ > > Harald > > > So, why not try using the simpler 'for line in f.readlines()' > > approach and see what that does to your performance. Of course you can use readlines. >From the docs:""" readlines ([sizehint]) Read until EOF using readline() and return a list containing the lines thus read. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (possibly after rounding up to an internal buffer size) are read. """ In other words, readlines(sizehint) gives you the opportunity to work through your file in larger chunks of lines, without reading everything at once. hope this helps - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com From hniksic at arsdigita.com Mon Nov 6 08:24:46 2000 From: hniksic at arsdigita.com (Hrvoje Niksic) Date: 06 Nov 2000 14:24:46 +0100 Subject: binary tree in python? References: <8u5ksq$kak$1@nnrp1.deja.com> Message-ID: ranga_r at my-deja.com writes: > i would like to know if there is any reference/documentation/code > available on implementing a binary tree in python. Here is a nice binary tree implementation by Tim Peters. You can save it to a file named `bintree.py' and do things like: import bintree tree = bintree.BinaryTree() tree.insert('foo') tree.insert('bar') tree.insert('baz') tree.insert('ahoy there!') print tree.inorder() ['ahoy there!', 'bar', 'baz', 'foo'] # bintree.py class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right class BinaryTree: def __init__(self): self.root = None def insert(self, val): root = self.root lastdir = None while root: lastroot = root if val <= root.val: lastdir = 'left' root = root.left else: lastdir = 'right' root = root.right new = Node(val) if lastdir is None: self.root = new elif lastdir == 'left': lastroot.left = new else: lastroot.right = new def inorder(self): result = [] self.__helper(self.root, result) return result def __helper(self, root, result): if root is not None: self.__helper(root.left, result) result.append(root.val) self.__helper(root.right, result) From grey at despair.rpglink.com Mon Nov 13 14:29:11 2000 From: grey at despair.rpglink.com (Steve Lamb) Date: Mon, 13 Nov 2000 19:29:11 -0000 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <87snowl5f0.fsf@fangorn.stofanet.dk> Message-ID: On Mon, 13 Nov 2000 18:40:10 GMT, Ben Wolfson wrote: >If you're coming from a language with even a trace of cases, "who" and >"whom" probably aren't that difficult. If y'all always get "it's" and "its" >right, well then. I always get it's (contraction) and its (posessive) correct yet haven't a clue of who and whom. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. -------------------------------+--------------------------------------------- From joseKILL at THECAPSshangosoft.com Thu Nov 9 10:28:52 2000 From: joseKILL at THECAPSshangosoft.com (Jose Correia) Date: Thu, 9 Nov 2000 07:28:52 -0800 Subject: How to kill a thread from another thread ? References: <3A0A6715.35C19F47@ina.fr> Message-ID: <8uefrp$erng$1@newssvr06-en0.news.prodigy.com> You can also do this with an Event trigger (each thread periodically checks and shuts itself down) or with a common Queue (an item in it acting as a trigger). HTH, Jose "Richard Gruet" wrote in message news:3A0A6715.35C19F47 at ina.fr... > Hi Pythoners, > > Does someone know how to kill a Python thread from another Python thread (in the > same process) ? > In both thread and threading modules, there is functions to launch such threads, > but no way to kill/terminate them. On WIN32, the WIN32 function > TerminateThread() is missing in the Win32 extensions' win32 api module. > > Thanks for any help, > > Richard Gruet > From aleaxit at yahoo.com Tue Nov 7 15:00:05 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 7 Nov 2000 21:00:05 +0100 Subject: gmp module References: <8u5tua$rie$1@nnrp1.deja.com> <8u63v3025qg@news2.newsguy.com> <8u96p801sfa@news1.newsguy.com> <3dbsvrpvey.fsf@kronos.cnri.reston.va.us> Message-ID: <8u9n4i02gam@news2.newsguy.com> "Andrew Kuchling" wrote in message news:3dbsvrpvey.fsf at kronos.cnri.reston.va.us... > "Alex Martelli" writes: > > ExtensionClass (a part of Zope, but also released > > separately) is, I think, what could help doing this. > > But, in general, I don't think it's possible (or, > > surely, not easy), while py_cpp does make it easy. > > I don't think ExtensionClass fully supports numeric behaviour, partly > due to limitations in ExtensionClass and partly due to architectural > issues in Python. For example, ExtensionClasses don't support > __radd__ & related methods. Good point, thanks. > The old GMP module could be dropped on top of Objects/longobject.c to > make Python use GMP for all longs. This worked for 1.4 and 1.5.2, but > breaks in 2.0 because there are more C-level conversion functions, > mostly for C's "long long" type, in 2.0, which obviously aren't Yep, I struggled with that a bit (since gmpy is based on your old GMP module, upgraded for GMP 3 and Python 2), then decided to give it up (as far as gmpy is concerned) -- gmpy has no ability to be substituted for longobject.c > implemented yet. Eventually I'll get around to checking if GMP 3.x > adds interfaces that support long long. I wonder if it would be I haven't seen any in GMP 3.0. > practical to require GMP for Python and just use its fancy and fast > implementation of long integers instead of Python's simple and > not-so-fast implementation. Only if the Python team were willing to undertake the task of making GMP build on every architecture supporting Python (at least for the integer functions), since clearly the GMP team has no interest in that. GMP does not build 'out of the box' on Windows with MSVC++, for example (not exactly an inconsequential platform), and looking around for fixes for that I found about a hundred requests and pleas for help for it, and only one (1) guy (in Japan) who managed to build GMP 3.0 on Windows/MSVC++ (and I can't read his Japanese instructions on how to repeat this -- he also points to a Belgian page which doesn't seem to exist any more -- but fortunately he does have a binary GMP.LIB on his site that I was able to use for gmpy purposes, although I think the perfect-power checking function in particular is broken). It might be less trouble to provide _either_ GMP use _or_ the built-in fall-back as a configuration option... Alex From jh at web.de Wed Nov 1 11:18:18 2000 From: jh at web.de (Jürgen Hermann) Date: Wed, 1 Nov 2000 17:18:18 +0100 Subject: [ANN] MoinMoin Release 0.4 Message-ID: <8tpfoh$a9n$05$1@news.t-online.com> A WikiWikiWeb is a collaborative hypertext environment, with an emphasis on easy access to and modification of information. MoinMoin is a Python WikiClone that allows you to easily set up your own wiki, only requiring a Web server and a Python installation. Sorry for the short release cycle, but I've been a busy bee and added some major new features: table markup, section headlines, some new macros, and finally a set of help pages describing all current features. This is the last release of MoinMoin before major refactoring takes place. So don't expect a new one within at least a month. Homepage: http://moin.sourceforge.net/ Download: http://download.sourceforge.net/moin/ New features: * Table markup "||a||b||c||" * Headlines "= H1 =", "== H2 ==", and so on up to H5 * [[PageCount]] macro * Added [[Icon(image)]] macro and macro arguments * [[PageList(title-regex)]] macro * New help system (set of help pages describing all features) Bugfixes: * Create complete URL for "Clear message" link * Inline code spans needed cgi.escape * Better fix for Python 1.6 "re" problems * Fix for uppercase extensions in inline images ("foo.JPG") * Fixed colspan in RecentChanges * HR size is now limited to 8 * "}" ends an URL pattern (fixes URLs right at the end of code displays) From magnus.heino at rivermen.se Wed Nov 8 02:43:05 2000 From: magnus.heino at rivermen.se (Magnus Heino) Date: Wed, 8 Nov 2000 07:43:05 +0000 Subject: imputil References: <8u8erj$9cc$1@merlin.rembrandtstr.bocholt.de> Message-ID: <8uaslj$461$1@merlin.rembrandtstr.bocholt.de> > this might work: Almost. It seems as if the descriptions that I have found about it, including yours below, and the version of imputil distributed with 2.0 differ a bit. > 3. call the "install" method to add it to the import chain: > > >>> importer.install() > This is where I had to do it different, and where imputil seems to have changed. >>> imputil.ImportManager().install() >>> sys.path.insert(0, ServiceImporter(self._connection.root())) >>> sys.path.insert(0, imputil.BuiltinImporter()) /Magnus From fiona at sitegnome.com Thu Nov 9 06:35:18 2000 From: fiona at sitegnome.com (Fiona Czuczman) Date: Thu, 09 Nov 2000 11:35:18 GMT Subject: FAQ? References: <3A0A1317.330A3C90@fibrespeed.net> Message-ID: <3A0A8DED.D0815271@sitegnome.com> Hi Michael, > Looking for a FAQ ... especially if it has good "starting with Python" > website links. http://python.faqts.com cheers, Fiona From jim at interet.com Mon Nov 20 08:36:43 2000 From: jim at interet.com (James C. Ahlstrom) Date: Mon, 20 Nov 2000 08:36:43 -0500 Subject: python executable path name References: Message-ID: <3A1928EB.50814DB@interet.com> Marc Pawlowsky wrote: > > Is there a method in pure python to find the full path of python itself? > For example c:\python20\python.exe. > > Thanks for the help. import sys print sys.executable JimA From ngps at madcap.dyndns.org Fri Nov 17 08:57:23 2000 From: ngps at madcap.dyndns.org (Ng Pheng Siong) Date: 17 Nov 2000 13:57:23 GMT Subject: M2Crypto question References: <3A147067.C106082D@lbl.gov> Message-ID: <8v3dg3$21c$1@coco.singnet.com.sg> According to : > Does anyone know if it's possible to generate a new RSA key pair > programatically? I see a gen_key function in DSA.py to generate a DSA > key pair, but I can't seem to locate similar functionality for RSA keys. /usr/local/home/ngps:$ python1 Python 1.5.2 (#2, Mar 12 2000, 12:38:38) [GCC 2.95.2 19991024 (release)] on freebsd4 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import os >>> os.system('openssl genrsa > xxx.pem') warning, not much extra random data, consider using the -rand option Generating RSA private key, 512 bit long modulus ..............................++++++++++++ .................................++++++++++++ e is 65537 (0x10001) 0 >>> print open('xxx.pem').read() -----BEGIN RSA PRIVATE KEY----- MIIBOwIBAAJBAJobLsVZRgV6R4+HEYSKYxXb3lKc/wwAYSTf8FjrI4OuQNF41vQi iRzcLAilLYe0Ayhk2/HTNU3c/hRNdmglxwcCAwEAAQJASPtImiOeOqffTgS8chWL uWVoE53QV6GyX+FCFQo+xnQ6kr/Ta4JaC984fMQEcgb9ggDfI2EYGyTdaZoP9D/C yQIhAMaf6G8YW3p06c6iz35/gLaRmOhDCdyXbeVfMmrx98ibAiEAxp8t/I39kK3b xzsWmHCWFWzNR1emgIZa911CGHM0VAUCIQCUMLo6KPIXayMGCHLG7loZ3Ic4wsuY yWI0v9Hd+KnmAQIhAMXT597DogmHUP7X+IJuqN3AF5n2UC11JId6iImHvVftAiAM a6wz3azZ38Uf2xz1qChFSmrTYqNhh3arozocZIHD1g== -----END RSA PRIVATE KEY----- ;-) IIRC, M2Crypto's first release had rsa_genkey(). I took it out while I was trying to get rid of the global PyObject pointers used to hold callbacks. I'll probably put rsa_genkey() back in the next release. For now, os.system() is it. Cheers. -- Ng Pheng Siong * http://www.post1.com/home/ngps From tjreedy at udel.edu Tue Nov 14 10:50:36 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Tue, 14 Nov 2000 10:50:36 -0500 Subject: Wits end relief References: <3A0957DF.A9D1AD86@holdenweb.com> <3fmO5.4980$JM4.136649@news2.mia> <3A0AC92E.C38BBA7@holdenweb.com> <8ulmgj0257v@news2.newsguy.com> <8umbna02n7l@news2.newsguy.com> <4lGP5.1125$035.30955@news2.mia> Message-ID: <8urmvo$f74$1@news.udel.edu> > At A python command line prompt >>> How do I save a few lines I have written > to a file? Without using textpad or any other text editor. I want to save it > from python's command line >>>. You can select and copy stuff to the clipboard using the two leftmost of the three clipboard buttons in the upper left part of the console panel toolbar. The normal ^C does not work. From aahz at panix.com Thu Nov 9 10:42:42 2000 From: aahz at panix.com (Aahz Maruch) Date: 9 Nov 2000 07:42:42 -0800 Subject: How to kill a thread from another thread ? References: <3A0A6715.35C19F47@ina.fr> Message-ID: <8uegli$bjf$1@panix6.panix.com> In article <3A0A6715.35C19F47 at ina.fr>, Richard Gruet wrote: > >Does someone know how to kill a Python thread from another Python >thread (in the same process) ? You don't. You need to set up each of your threads so that they look for some kind of signal to kill themselves (which means returning). It has been argued that the ability to kill threads is necessary for server applications, but I haven't seen any powerful arguments in favor of that. -- --- Aahz (Copyright 2000 by aahz at pobox.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "Every flame is sacred, every flame is great." --Orc From aleaxit at yahoo.com Fri Nov 3 07:48:37 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Fri, 3 Nov 2000 13:48:37 +0100 Subject: import question References: <8tu5th$qj$1@nnrp1.deja.com> Message-ID: <8tucgb01f43@news2.newsguy.com> wrote in message news:8tu5th$qj$1 at nnrp1.deja.com... > Hi, > > how can I dynamically import modules in function > a() , and then call them by name in function b() > instead of using the module object? > > what I want to do is something like this: > > def a(): > module = __import__ ('foo') > > def b(): > x = eval ('foo.bar ()') For example: def a(): exec 'import foo' in globals() def b(): x = eval('foo.bar()') Alex From fredrik at effbot.org Sat Nov 18 07:20:58 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Sat, 18 Nov 2000 12:20:58 GMT Subject: The origin of Python? References: <8v4cu6$k5u$1@news.nuri.net> Message-ID: Gareth McCaughan wrote: > There was nothing very special about the name; they > considered lots of others and that was the best they > found. I recently saw (but have completely forgotten > where, alas) a list of names they considered and rejected. http://www.amk.ca/quotations/python-quotes.html "1 2 3 / It's Them! / Arthur Megapode's Flying Circus / The Horrible Earnest Megapode / The Panic Show / The Plastic Mac Show / Ow! It's Colin Plint! / Vaseline Review / Vaseline Parade / The Keen Show / Brian's Flying Circus / The Year of the Stoat / Cynthia Fellatio's Flying Circus / Owl Stretching Time / The Whizzo Easishow! (Guaranteed to last 1/2 hour! Money back if not!) http://www.comedyzone.beeb.com/comedy/bestof/features/montypython/python_history.html also mentions Gwen Dibley's Flying Circus, Bob Python's Flying Circus, and Norman Python's Flying Circus. From pricerbumanto at my-deja.com Mon Nov 20 12:42:11 2000 From: pricerbumanto at my-deja.com (pricerbumanto at my-deja.com) Date: Mon, 20 Nov 2000 17:42:11 GMT Subject: P*rl in Latin, whither Python? References: <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <87snowl5f0.fsf@fangorn.stofanet.dk> <3A16E158.A8DB692@engcorp.com> <3A176E90.CC66D305@engcorp.com> <3A18227E.9D5DE5A6@engcorp.com> <3A188F76.C1B170EE@engcorp.com> Message-ID: <8vbnph$lav$1@nnrp1.deja.com> In article , kc5tja at armored.net wrote: > On Sun, 19 Nov 2000 21:41:58 -0500, Peter Hansen wrote: > >(Note, "humour" deliberately with the Canadian spelling... :-) > > Actually, that's not Canadian spelling -- it's British spelling. :) What? It's _both_ (also Jamaican, etc.). See . George Sent via Deja.com http://www.deja.com/ Before you buy. From arturo_perez at wanadoo.es Sun Nov 12 13:33:56 2000 From: arturo_perez at wanadoo.es (Arturo Pérez Mulas) Date: Sun, 12 Nov 2000 18:33:56 GMT Subject: Python as a Scripting Language for Game Development? References: Message-ID: Hi there! Yes, have a look at "Blade" from Rebel Act Studios... the demo itself is astonishing, and you can find in the directory tree the python scripts! "Carey Murray" escribi? en el mensaje news:nOiP5.47177$1C6.2146087 at news20.bellglobal.com... > Many game developers use some sort of scripting system for controlling game > events, or for giving non-programmers access to the game engine during > development. Has anybody used Python for this? Any info would be helpful. > > Thanks > > Carey > > From aleaxit at yahoo.com Wed Nov 1 15:36:07 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Wed, 1 Nov 2000 21:36:07 +0100 Subject: __getitem__ AttributeError References: <39FD86B3.E13ABF1E@savaco.com> <8tk1qh05aa@news1.newsguy.com> <3A0066C5.527FB5D9@valcke.com> Message-ID: <8tpuvc026sq@news2.newsguy.com> "Jeroen Valcke" wrote in message news:3A0066C5.527FB5D9 at valcke.com... > > Alex Martelli wrote: > > > and class Slidelist does not define a __getitem__ method, > > so its instances cannot be indexed with [] nor iterated on [snip] > > class Slidelist: [snip] > > def __getitem__(self, index): [snip] > Yep, this seems to resolve the problem. Thanks You're welcome. > I'm a bit clueless though, how can I know when to define this class? Is > this overloading? Yes, defining the __getitem__ method of a class is in some sense 'overloading' -- it's an indirect way Python offers you to overload the foo[something] syntax ('indexing') when foo is an instance of your class. (And as a nice side effect, this also analogously overloads 'for x in foo', 'if x in foo' ...). You should give a class a __getitem__ method if you want its instances to be usable as "indexable containers of items", and in particular (with integer indices from 0 to N-1...) as "sequences" (on which 'for' can iterate). It's your design decision, whether you DO want instances of a given class of yours to be usable this way. Alex From arturo_perez at wanadoo.es Tue Nov 14 13:36:58 2000 From: arturo_perez at wanadoo.es (Arturo Pérez Mulas) Date: Tue, 14 Nov 2000 18:36:58 GMT Subject: Unicode - Pythonwin and Access Message-ID: Hello all, I had installed Python 1.52, and recently downloaded and instaled version 2.0 and the win32 extensions under WinNT 4.0. I am Spanish, so my WinNT system is configured as such (using Latin-1 character set, I guess), and I used acute and tilde letters in my texts and comments; now when I open a python script in Pythonwin all these characters appear broken (as scape codes or different characters). a) Can anyone help me with this, please?. I guess this is an unicode problem, does anyone know an easy tutorial or resource on very basic unicode and unicode/python. Also, I am accessing Access DBs through the DAO extensions in Winpython. For some reason, I am getting my request to the database as unicode strings, rather than normal strings. I am completely lost here, also. Any hint? Thank you, Arturo. From MarkH at ActiveState.com Wed Nov 8 03:46:40 2000 From: MarkH at ActiveState.com (Mark Hammond) Date: Wed, 08 Nov 2000 08:46:40 GMT Subject: KeyboardInterrupt in ASP References: <8ub1vn$2bd$1@nnrp1.deja.com> Message-ID: <3A091178.5020000@ActiveState.com> jj at void.si wrote: > I am able to reproduce KeyboardInterrupt in ASP page. > On a IIS I have two ASP scripts to build html output using ADO queries. > On a client I have c++ application with embedded IE (IWebBrowser2). That is great! However, is it possible for you to come up with something so _I_ can reproduce? I am afraid I don't have access to either your ASP sample code or C++ sample code. I really need something that I can setup and debug here. Mark. From michael.husmann at teleatlas.com Tue Nov 7 01:43:40 2000 From: michael.husmann at teleatlas.com (Michael Husmann) Date: Tue, 07 Nov 2000 07:43:40 +0100 Subject: idle6.0 german umlauts (ascii > 128 Exception) References: <8u71mh$4pg$02$1@news.t-online.com> Message-ID: <3A07A49C.E5D06EC@teleatlas.com> I have the same problem using idle 0.6 under Solaris with Tcl/Tk 8.3. Idle0.6 under Windows works correctly. Michael "Walter.Zettel" wrote: > This is not acceptable for me. > > Python is able to handle umlauts: > > C:\home>bash > ~ $python > Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32 > Type "copyright", "credits" or "license" for more information. > >>> > >>> a='?' > >>> print a > ? > >>> > > From jsabatke at execpc.com Sat Nov 4 20:06:25 2000 From: jsabatke at execpc.com (Jim Sabatke) Date: Sat, 04 Nov 2000 19:06:25 -0600 Subject: XBase for Python? Message-ID: <3a04a514$0$99052$726baab@news.execpc.com> Is there a package that will read/write XBase, or similar, files? I don't want to use a full featured RDBMS for simple programs. -- Jim Sabatke SuSE 6.3 Linux Kernel - 2.2.13 http://www.execpc.com/~jsabatke A cat is more intelligent than people believe, and can be taught any crime. -- Mark Twain From hove at phys.ntnu.no Wed Nov 8 06:10:45 2000 From: hove at phys.ntnu.no (Joakim Hove) Date: 08 Nov 2000 12:10:45 +0100 Subject: Run an external program from Python? Message-ID: Hello, I am writing a small python program to automate the compilation of another (fortran) program. In this process I need my python program to call the "make" program. In Perl I would do simply: system("make PROG=Run"); And the Perl program would wait around till the system call was finished. Is there an equivalent system call in Python. [I have checked the exec* familiy of commands, but they only seem to run python code - which is not what I want in this case.] Best regards, Joakim Hove -- === Joakim Hove www.phys.ntnu.no/~hove/ ====================== # Institutt for fysikk (735) 93637 / E3-166 | Sk?yensgate 10D # # N - 7491 Trondheim hove at phys.ntnu.no | N - 7030 Trondheim # ================================================ 73 93 31 68 ======== From JackTiger at sohu.com Thu Nov 2 21:59:43 2000 From: JackTiger at sohu.com (Jack Tiger) Date: Fri, 3 Nov 2000 10:59:43 +0800 Subject: syntax error?why? Message-ID: <8tt9hb$1rrf$1@news.cz.js.cn> admin(8181): File "../Mailman/Cgi/oz_sub.py", line 71 results = results + "Can not subscribe itself!
" ^ SyntaxError: invalid syntax From wtanksle at dolphin.openprojects.net Thu Nov 2 12:38:06 2000 From: wtanksle at dolphin.openprojects.net (William Tanksley) Date: Thu, 02 Nov 2000 17:38:06 GMT Subject: multi-line statements References: <8ts6ql$f9s$1@bmerhc5e.ca.nortel.com> Message-ID: On 2 Nov 2000 17:04:21 GMT, Michael P. Soulier wrote: > Hey guys. I personally like to wrap my lines at 80 columns, and I've >noticed that I can do that in Python via \, but that's a little ugly. Out of >curiousity, is there a better way to write multi-line statements? Sure. If you end a line in the middle of a parenthesis, bracket, or triplequote, the expression won't end until the line containing the closing element. So, x = (3 + 1) is valid. > Mike -- -William "Billy" Tanksley From dale at out-think.NOSPAMco.uk Wed Nov 1 12:09:34 2000 From: dale at out-think.NOSPAMco.uk (Dale Strickland-Clark) Date: Wed, 01 Nov 2000 17:09:34 +0000 Subject: Method or function? References: Message-ID: "Rainer Deyke" wrote: >"Rainer Deyke" wrote in message >news:lVEL5.145180$g6.66741516 at news2.rdc2.tx.home.com... >> id applies to all objects, including methods. Do you really want >> 1.id().id().id() to be legal Python? > >I meant 1.id.id.id(), i.e. the id of the id method of the id method of 1. Thanks for the replies which I've noted but I'm note sure I entirely agree with. I can't believe that this hasn't already been discussed in depth elsewhere but, when I get time, I might post a more detailed argument. -- Dale Strickland-Clark Out-Think Ltd Business Technology Consultants From avv at quasar.ipa.nw.ru Mon Nov 6 00:16:07 2000 From: avv at quasar.ipa.nw.ru (Alexander V. Voinov) Date: Sun, 05 Nov 2000 21:16:07 -0800 Subject: PyTix homepage? References: <3a04b93d.4433905@24.0.228.33> Message-ID: <3A063E97.51801FC1@quasar.ipa.nw.ru> Hi Mike, You may take a look here. ftp://starship.python.net/pub/crew/avv/PyTix It worked for me, when I touched PyTix, together with Tk, Tkinter & friends last time. But my feeling is that PyTix has had no development since that last time... With my best regards Alexander Mike Clarkson wrote: > > Is there a home page for PyTix? I see support for Tix in python 2.0 > in Modules/Setup and tkappinit.c, but I see no Tix.py. > > I want to bring Tix.py up to date for the new 8.1.0 release of Tix on > http://tix.sourceforge.net. Should I just fix the PyTix-1.12 in the > ftp directory of ftp.python.org or is there a better one already up to > date? The changes are minor, and could be easily integrated with the > phython 2.0 source distribution. > > Many thanks in advance, > > Mike. From sholden at holdenweb.com Mon Nov 6 11:11:18 2000 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 06 Nov 2000 11:11:18 -0500 Subject: How can I tell when a string is in fact a number? References: <4a8zqyqxqv.fsf@kern.srcf.societies.cam.ac.uk> <8u45fo015ql@news1.newsguy.com> <4an1fde6as.fsf@kern.srcf.societies.cam.ac.uk> <4aem0pe3rn.fsf@kern.srcf.societies.cam.ac.uk> <8u6aiu02bs8@news2.newsguy.com> Message-ID: <3A06D826.96D15C70@holdenweb.com> Alex Martelli wrote: > > "Gaute B Strokkenes" wrote in message > news:4aem0pe3rn.fsf at kern.srcf.societies.cam.ac.uk... > > Gaute B Strokkenes writes: > > > > > After looking at the docs for a while, I came up with the following: > > > > > > def isanum(str): > > > import re > > > return re.match(r'^[0-9]', str) != None > > > > > > Which works beautifully. > > > > Whoopsie. What I meant was: > > > > def isanum(str): > > import re > > return re.search(r'[^0-9]', str) == None > > Heh -- it's easy to make typos, isn't it? I made one myself, > which is why my original RE didn't work (forgot the $ at the > end). > [snip] And the length of the exposition (which I remembered to snip this time) is a beautiful support of the assertion that you are better off not using regular expressions if you can find another way to do the job! Always-get-them-wrong-three-times-before-I-get-them-right'ly y'rs - steve -- Helping people meet their information needs with training and technology. 703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/ From ljohnson at resgen.com Thu Nov 16 10:51:42 2000 From: ljohnson at resgen.com (Lyle Johnson) Date: Thu, 16 Nov 2000 09:51:42 -0600 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> <8v0uv4$jh$1@panix3.panix.com> Message-ID: > Haven't used Ruby, but IIRC, it's only available for Windoze. From that > standpoint alone, no way will Ruby overtake Python. Bonk! Wrong answer. To quote the FAQ, it is developed under Linux but runs under Unix, DOS, Windows, MacOS, BeOS, Amiga, Acorn Risc OS (???) and OS/2. I've just started looking at Ruby, mainly because my curiosity got the better of me. So far I'm underwhelmed. I can see how it might appeal to Perl users but not Python users. I'll try to present my finding to the newsgroup after I've had more time to give it a fair shake. From jgraves3 at austin.rr.com Sun Nov 19 15:28:02 2000 From: jgraves3 at austin.rr.com (jay graves) Date: Sun, 19 Nov 2000 20:28:02 GMT Subject: Reading the bitrate of an mp3 References: <3A1804E7.DD0D15A@rhk.dk> Message-ID: <3a18375a.96565439@news-server.austin.rr.com> On Sun, 19 Nov 2000 17:50:48 +0100, Lars Hoeyrup Jensen wrote: >I'm looking for a Python module that enables me to read the bitrate and length >in minutes/seconds from _any_ mp3 file, no matter if it has an ID3 tag or not. >Does such a module exist? I know you can get it for Perl but I have only been >able to find this for Python: > >http://csl.cse.ucsc.edu/~ben/python/id3.html > >and it doesn't seem to give you the bitrate or length of the file. > >Any help would be greatly appreciated, > >Lars H. Jensen > I haven't tried this but it claims to do what you want. http://sourceforge.net/snippet/detail.php?type=snippet&id=100043 Jay From amez at swipnet.se Sat Nov 4 21:12:39 2000 From: amez at swipnet.se (Anders Eriksson) Date: Sun, 05 Nov 2000 02:12:39 GMT Subject: XBase for Python? References: <3a04a514$0$99052$726baab@news.execpc.com> Message-ID: <9fg90ts5a1g1vneb47bkhm9j448me5gn3p@4ax.com> On Sat, 04 Nov 2000 19:06:25 -0600, Jim Sabatke wrote: >Is there a package that will read/write XBase, or similar, files? I >don't want to use a full featured RDBMS for simple programs. Not any I know or. There is a module for reading xBase (Search the vault of Parnassus ) I would recommend Metakit! A small but efficient database. Read all about it at: http://www.equi4.com/metakit/python.html // Anders From python9999 at my-deja.com Tue Nov 7 06:53:41 2000 From: python9999 at my-deja.com (python9999 at my-deja.com) Date: Tue, 07 Nov 2000 11:53:41 GMT Subject: GLOBAL variables in python Message-ID: <8u8qg4$7ps$1@nnrp1.deja.com> i have wriiten a small application in which i need to use the variable which is local to one of the functions in a class , but i am not able to access the variable. class myclass: def entry(): entry1=GtkEntry(10) entry2=GtkEntry(10) ...... a= myclass() def get(): name=a.entry.entry1.get_text() return name here i am getting a error like name=a.entry.entry1.get_text() attribute error entry1 can any one suggest solution for this problem.. and i also have a doubt whether v have any GLOBAL variables in python?? thanks for any help.. regards satish Sent via Deja.com http://www.deja.com/ Before you buy. From ranga_r at my-deja.com Sun Nov 5 23:20:31 2000 From: ranga_r at my-deja.com (ranga_r at my-deja.com) Date: Mon, 06 Nov 2000 04:20:31 GMT Subject: binary tree in python ? Message-ID: <8u5bib$dk8$1@nnrp1.deja.com> hello, i'd like to know if there is some reference documentation or even source code available about implementing binary trees in python. thanks. regards -- ranga Sent via Deja.com http://www.deja.com/ Before you buy. From max at alcyone.com Mon Nov 20 23:34:35 2000 From: max at alcyone.com (Erik Max Francis) Date: Mon, 20 Nov 2000 20:34:35 -0800 Subject: What is Python? References: <3A17EED5.6E038529@engcorp.com> <0HZR5.15312$%j3.124375@news6.giganews.com> <3A18B6A5.2EFC0C46@alcyone.com> <00fh1tgaludcggor2rigl2d4uuh2dpni5t@4ax.com> Message-ID: <3A19FB5B.435054A1@alcyone.com> Rainer Deyke wrote: > Totally unrelated rhetorical question: When one says "It is raining", > to > what is the "it" refering? It's a placeholder; it doesn't refer to anything specific. In several languages, this kind of construct isn't allowed. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ The only way to get rid of a temptation is to yield to it. \__/ Oscar Wilde Interstelen / http://www.interstelen.com/ A multiplayer, strategic, turn-based Web game on an interstellar scale. From chrism at digicool.com Fri Nov 3 08:32:50 2000 From: chrism at digicool.com (Chris McDonough) Date: Fri, 3 Nov 2000 08:32:50 -0500 Subject: Where to find Bobo? References: <3A02A998.27547CF0@ilt.fhg.de> Message-ID: <8tudu0$4l6$1@bob.news.rcn.net> Bobo doesn't exist on its own any more... it's the "ZPublisher" piece of Zope (http://www.zope.org). HTH, Chris "Wester" wrote in message news:3A02A998.27547CF0 at ilt.fhg.de... > Hi, > > I'm looking for Bobo maintaned by Digital Creations. The URL > http://www.digicool.com/releases/bobo/ > does'nt work. Can anybody tell me where to find Bobo? > > Thanks > > Rolf > From briansweetapp at my-deja.com Sun Nov 19 13:27:33 2000 From: briansweetapp at my-deja.com (briansweetapp at my-deja.com) Date: Sun, 19 Nov 2000 18:27:33 GMT Subject: Library Improvements Message-ID: <8v962g$mv2$1@nnrp1.deja.com> Hi, What is the process for suggesting/adding improvements to the various python libraries? Right now I am interested in adding some code that I wrote to enhance the functionality of urllib. Specifically, I changed the library to accept lists of tuples, in addition to dictionaries, for CGI parameters. I think that this is important because a fair number of forms have duplicate names for form elements (usually for checkboxes) and a few are order sensitive. -- Brian Quinlan brian at sweetapp.com Sent via Deja.com http://www.deja.com/ Before you buy. From grey at despair.rpglink.com Mon Nov 13 18:52:54 2000 From: grey at despair.rpglink.com (Steve Lamb) Date: Mon, 13 Nov 2000 23:52:54 -0000 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <874s1dm5yh.fsf@fangorn.stofanet.dk> <87wve7afwb.fsf@fangorn.stofanet.dk> <8upr452314b@news2.newsguy.com> Message-ID: On Mon, 13 Nov 2000 23:44:50 +0100, Alex Martelli wrote: >The parallels with programming in Python are striking, aren't >they? With normal human herd-instinct, we're all here trying to >gain new users (and there are positive network effects as we >do -- books, more tools, ...) -- but, being the only firm to >use Python in a given niche while your competitors struggle >on with lesser languages is *BIG*... "eat their lunch" time!-) Heh. Now if only you could convince the powers that be in my company of that. I'm script boy and after a few weeks of Python coding I'd much prefer to do my work in Python than in Perl. Problem is that they have rightfully pointed out one thing. While all my coworkers agree that Python would be a good thing they are all working in C and when it comes time for me to move on and they need to replace me finding skilled Perl programmers is far easier than finding skilled Python programmers. Of course my Python experience being so limited I imagine I could spend the next 2 years on the same projects. 6 months learning Python, 6 months to rework everything once I've learned it. Another 6-12 months to rerework it the way I /really/ want it. :) -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. -------------------------------+--------------------------------------------- From greg at cosc.canterbury.ac.nz Mon Nov 20 19:52:21 2000 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Tue, 21 Nov 2000 13:52:21 +1300 Subject: What is Python? References: <3A17EED5.6E038529@engcorp.com> <0HZR5.15312$%j3.124375@news6.giganews.com> <0deS5.92$v3.1071@uchinews> Message-ID: <3A19C745.1D0BE419@cosc.canterbury.ac.nz> Ben Wolfson wrote: > > Separable prefixes in German may not really count as prepositions Indeed, and I think the situation is similar in English. It seems to me that, e.g. "cut up" is not the verb "cut" plus the preposition "up", but a single multi-word verb whose meaning is distinct from "cut" on its own. How would you rearrange the sentence "What do you want to cut up" to avoid having "up" at the end? "Up what do you want to cut" doesn't quite work, somehow... -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand To get my email address, please visit my web page: http://www.cosc.canterbury.ac.nz/~greg From paulp at ActiveState.com Sun Nov 5 13:23:48 2000 From: paulp at ActiveState.com (Paul Prescod) Date: Sun, 5 Nov 2000 10:23:48 -0800 (PST) Subject: statically nested scopes In-Reply-To: Message-ID: On Sat, 4 Nov 2000, Robin Becker wrote: > How can this work when different paths define different > variables. You're probing a dark corner of Python, but I don't think that statically nested scopes makes it any worse than it is. > ie > > G=0 > def A(): > for i in range(3): > if i>=2: > G=i*i > def B(): > return G+2 > print B() I claim the answer would be the same as if you remove the nested function altogether: G=0 def A(): for i in range(3): if i>=2: G=i*i print G A() It is all figured out statically, not dynamically so G is either always a local or always a global -- in this case always a local because it is assigned to. Paul Prescod From max at alcyone.com Sun Nov 12 21:00:13 2000 From: max at alcyone.com (Erik Max Francis) Date: Sun, 12 Nov 2000 18:00:13 -0800 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> Message-ID: <3A0F4B2D.7D01476B@alcyone.com> Steve Lamb wrote: > Esperanto, OTOH, does not. > I can count to 999,999 but that is only because I haven't learned the > Esperanto word for million yet. It's `miliono.' > English: 11 = Eleven. The English words for 1-10 don't prepare you > for > "Eleven". Nor Twelve or Thirteen. Not all natural languages are like that. Counting in Japanese is very straightforward, for instance. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ Life is a predicament which precedes death. \__/ Henry James Official Buh rules / http://www.alcyone.com/max/projects/cards/buh/ The official rules to the betting card game, Buh. From skip at mojam.com Thu Nov 9 08:08:31 2000 From: skip at mojam.com (Skip Montanaro) Date: Thu, 9 Nov 2000 07:08:31 -0600 (CST) Subject: myip.org - dns client In-Reply-To: References: Message-ID: <14858.41423.94212.345087@beluga.mojam.com> Anders> There are some clients at the myip.org site, but they are Anders> written in perl and my computer is a perl free zone! I'll probably make a mistake transcribing the perl code (and since I don't use myip.org I can't really test it anyway), but here's a first cut that should get you close. import urllib, os, re # modify to suit your environment and myIP account info interface = "ppp0" userid = "myiploginname" pwd = "myippassword" hostname = "spamneggs.myip.org" recordtype = "A" # end of modification section ipdata = os.popen("ifconfig " + interface) ipaddress = None for line in ipdata.readlines(): mat = re.search(r"addr:(\d+\.\d+\.\d+\.\d+)") if mat is not None: ipaddress = mat.group(1) break ipdata.close() if ipaddress is None: raise ValueError, "couldn't read my IP address!" f = urllib.urlopen("http://www.myip.org/cgi-bin/Update.py?" "id=%(userid)s&pwd=%(pwd)s&hostname=%(hostname)s&" "ip=%(ipaddress)s&recordtype=%(recordtype)s") print f.read() -- Skip Montanaro (skip at mojam.com) Support the Mojam.com Affiliates Program: http://www.mojam.com/affl/ (847)971-7098 From olivierS.dagenaisP at canadaA.comM Fri Nov 3 08:25:56 2000 From: olivierS.dagenaisP at canadaA.comM (Olivier Dagenais) Date: Fri, 03 Nov 2000 13:25:56 GMT Subject: Need advice: serving data using http/web-server to clients ( not only browsers ) References: Message-ID: I'm implementing something similar on the back-end, using a threaded FastCGI instance, so that I can synchronize the accesses to a database. I'm using Gadfly as a database engine, so it's portable. The difference is that I'm returning data that only my client will use and maybe I should be using XML but I've come up with my own little format because I knew how to do that quickly and I needed some security features... It sounds like your project is further ahead than mine, although it would be interesting to compare ideas and maybe merge efforts...??? -- ---------------------------------------------------------------------- Olivier A. Dagenais - Software Architect and Developer "Someone called 'Type your name here' is impersonating me on the internet and is posting exactly the same things I am posting!" "Thomas Weholt" wrote in message news:LwxM5.1936$mx.44638 at news1.oke.nextra.no... > Hi, > > I want to serve data from a database using the HTTP-protocol and a > web-server. The data can be in several different formats, html, xml, cvs, > plain text or binary, compressed etc. The client is mostly browsers but a > specific client is written in python that processes the data from the > web-server further and gives the user the ability to manipulate it in > several ways ( generate other views etc. ) is also in production. > > So I need to be able to serve html/xml to browsers and other formats too if > the client requests it. I've defined a request-protocol using the HTTP > post-command and params in the body-part of the request are used to query > the database and athenticate the user etc. > > Sometimes the client will upload a binary file, using the client or browser, > to the server too. Also using the post-command. > > So far I've used Medusa/Zope to extend the default web-server to fit my > needs, but I'm having a hard time getting it stable for the most simple > tasks and I cannot get the uploading of binary files to the server to work. > The performance is also not as good as Apache either. I'm a really huge fan > of Zope and use it for all my other web-tasks, but it seems slow. For this > specific task I need very low response-time and I don't need much of the > fancier stuff in Zope. > > My project is very simple ( the complexity lies outside the web-server > "scope" ) ; I have a method that takes parts of the data in the > request-header as parameter, also any uploaded files. It returns the data to > the browser. I need to be able to set the content-type ( text/plain, > text/html, application/octet-stream etc.) of the response data, use > compression ( gzip, zlib ), authenticate users and receive data from the > browser/client. So all I need is to call my method with the required params, > which should be available in the header, or collected then sent to the > method, and return data. I prefer to the user authentication in my method > manually, not use anything in Apache etc. > > I need to serve different platforms and environments ( linux, windows, > netscape, IE, lynx etc. ). > > My main requirements are : > 1. simplicity ( in the web-server, only a few lines of code should be > needed, possibly some to decode the header-data, then just a call to my > method ) > 2. performance ( the web-server/python-solution must have as little as > possible overhead, ie. I can suffer some code complexity to gain > performance, but keep number req. 1 in mind ) > 3. stability ( the actual server must be able to cope with high workloads > without failing. My implementation in Medusa/Zope crashes terribly under > very low workloads, *but* that's probably my fault, not Medusa/Zope. Still I > cannot get it to work right. ) > 4. compatibility ( all normal browsers and the version 1.1 of HTTP must be > supported, I need compression of data to the browser and uploading of large > binary files ( 1kb -10mb ???) ) > > Can anybody point me in the right direction? Apache with : FastCGI, > mod_snake, mod_python, pros and cons of different solutions, or just ideas > about my project, how I could do things better. > > Thanks, > Thomas Weholt > > From tim_one at email.msn.com Tue Nov 7 03:57:52 2000 From: tim_one at email.msn.com (Tim Peters) Date: Tue, 7 Nov 2000 03:57:52 -0500 Subject: Where is time.strptime()? In-Reply-To: Message-ID: [Tim] > ... > IIRC, supplying strptime everywhere is already a feature request in > PEP42. That will happen if and when someone contributes unencumbered > code+docs+tests to implement it. [Gareth McCaughan] > The copyright notice on the version of strptime in FreeBSD > says: > > * Copyright (c) 1994 Powerdog Industries. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > * 1. Redistributions of source code must retain the above copyright > * notice, this list of conditions and the following disclaimer. > * 2. Redistributions in binary form must reproduce the above copyright > * notice, this list of conditions and the following disclaimer > * in the documentation and/or other materials provided with the > * distribution. > * 3. All advertising materials mentioning features or use of this > * software must display the following acknowledgement: > * This product includes software developed by Powerdog Industries. > * 4. The name of Powerdog Industries may not be used to endorse or > * promote products derived from this software without specific prior > * written permission. > > followed by the usual all-caps-to-make-sure-no-one-reads-it > disclaimer of warranty. > > That looks sufficiently unencumbered to me. (Note that #3 > is not quite the usual-but-now-discarded BSD advertising > clause.) Am I missing something? + Where are the docs? + Where's the test suite? + Does this compile and run correctly on all Python platforms? + Is this particular version of strptime "the correct" one (strptime isn't available everywhere *now* because it's not part of ANSI C, so some platforms don't supply it -- while those that do apparently don't always agree on its input->output behavior)? + Clause 3 renders this license incompatible with the GPL (the Regents of the U of CA have no authority to revoke such clauses in licenses other than their own). + Is there a patch on SourceForge that addresses all of the above? There are a lot of hoops to jump thru before code can be added to the std Python distribution. A raw piece of code is usually the least of it, but is about the only part programmers volunteer without severe arm-twisting <0.6 wink>. it-will-be-added-when-someone-cares-enough-to-twist-their-own- arm-ly y'rs - tim From mfletch at tpresence.com Tue Nov 21 01:26:31 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Tue, 21 Nov 2000 01:26:31 -0500 Subject: How do I exchange the values of A and B Message-ID: a = 2 b = 3 a,b = b,a And that's Python :o) . HTH, Mike -----Original Message----- From: Peter Hansen [mailto:peter at engcorp.com] Sent: Monday, November 20, 2000 11:56 PM To: python-list at python.org Subject: Re: How do I exchange the values of A and B Charlie Kilmer wrote: > > How do I exchange the values > int A = x; > int B= y; > > here x and y are the values > > how do exchange the values so that > int A = y; > int B = x; Umm, in what language? 'Cause that ain't Python... -- http://www.python.org/mailman/listinfo/python-list From rcgottlieb at ieee.org Fri Nov 10 01:25:42 2000 From: rcgottlieb at ieee.org (Robert & Corinne Gottlieb) Date: Fri, 10 Nov 2000 06:25:42 GMT Subject: IDLE on Mac Python 2.0 Message-ID: Hi all, Has anyone gotten IDLE to run on Python 2.0 on a Mac? If so, could you please tell me how to do this. I tried creating an applet out of the idle.pyw and it dies on me. I can't copy the backtrace or I'd post it here. Thanks, Robert Gottlieb rcgottlieb at ieee.org From tjreedy at udel.edu Sat Nov 4 21:04:11 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Sat, 4 Nov 2000 21:04:11 -0500 Subject: python compiler?? References: <3A04051A.B1A8517B@cyberway.com.sg> Message-ID: <8u2f1i$505$1@news.udel.edu> > Is there a python compiler somewhere?? Yes: the standard Python 'interpreter' compiles Python source code to Python Virtual Machine PyCode before interpreting/executing it. Yes: JPython/Jython compiles Python source code to Java Virtual Machine JCode (name?) for execution by that 'machine'. No: there have been efforts to translate Python to C for compilation to native machine code but they have not yet been successful, that I know of, for reasons discussed in many previous postings. There are other answers, but I suspect that the above is the one you were looking for. Terry J. Reedy From michael.soulier at home.com Fri Nov 3 07:53:47 2000 From: michael.soulier at home.com (Michael P. Soulier) Date: Fri, 03 Nov 2000 12:53:47 GMT Subject: reading passwords References: <_OrM5.423581$1h3.11559134@news20.bellglobal.com> Message-ID: In article <_OrM5.423581$1h3.11559134 at news20.bellglobal.com>, Olivier Dagenais wrote: >The 'getpass' module has a 'getpass' function. Look it up, I dare you! Ok, I will! ;-) >Or-you-could-build-a-mind-reader-and-just-ask-the-user-to-think-of-their-pas >sword-ly y'rs, I think I'll wait for someone else to write that one. ;-) Thanks, Mike -- Michael P. Soulier "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to UNIX PGP Public Key: http://www.storm.ca/~msoulier/personal.html From gsc at ultra.net.au Mon Nov 6 23:46:53 2000 From: gsc at ultra.net.au (grant) Date: Tue, 7 Nov 2000 14:46:53 +1000 Subject: CODING and CROSS PLATFORM Message-ID: <3a078743@mega.ultra.net.au> I have been using computers for 10 years : MAC->WINDOWS->now LINUX I am only now beginning to see the light. Also I beleive Python is the replacement for Visual Basic which was my main language. I am very interested in the CROSS PLATFORM abilities of Python and am about to start a big project with PYTHON What is in your opinion the best way to develope high performance front ends LIKE Visual Basic Forms/compiled which is then EASILY cross platform compiled to use in windows and also in Linux windows. I am very interested in the best Linux GUI that complies with windows in terms of Objects like Listboxs / Buttons / Picturebox's. I want to use python as a scripting tool for a highly functional database creation application. 1st question is what are the best compilers to create fast backend PYTHON objects in for windows/linux. 2nd Question is what are the best tools/compilers to create windows and GUI front end objects so I don't have to RECODE for both platforms. I was wondering is there a C++ toolkits/libraries that are helpful in getting the GUI objects ported easily. I was also wondering where I can get good examples of python code as I have been spoilt for to long by the huge VB community. From ericm at ajubasolutions.com Fri Nov 3 15:01:51 2000 From: ericm at ajubasolutions.com (Eric Melski) Date: Fri, 3 Nov 2000 12:01:51 -0800 Subject: tkFileDialog, but no tkDirectoryDialog? In-Reply-To: References: <8tpom0$boc$1@nnrp1.deja.com> Message-ID: On Thu, 2 Nov 2000, Fredrik Lundh wrote: > Kevin wrote: > > Just a side note: I believe that the tk_choosedirectory command is only > > valid in TK 8.4 and above... correct? > > it's documented in the 8.3 docs (and iirc, it's even > available in 8.2 -- but not on all platforms). tk_chooseDirectory has been available on Windows platforms since 8.1, but was undocumented because it was not available on all platforms. It was added for the other platforms in 8.3, and documented at that time. Eric Melski The Other Tcl Guy ericm at ajubasolutions.com Ajuba Solutions From tismer at tismer.com Wed Nov 8 14:29:19 2000 From: tismer at tismer.com (Christian Tismer) Date: Wed, 08 Nov 2000 21:29:19 +0200 Subject: Q: pyhton based lex, yacc tools References: <3A099C2E.426B722E@iit.demokritos.gr> Message-ID: <3A09A98F.E2E7101E@tismer.com> Vassilis Virvilis wrote: > > Halo everybody, > > Since I am rather new to the python world I would like to ask: > > Is there available any python tool which corresponds to a lex scanner > and/or a yacc parser? If not why? Yes, there is, while not so obviously... Get the FNORB distribution. Without having to use this Python ORB, you do get a BISON module, useable from Python! ciao - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com From jkraska1 at san.rr.com Sat Nov 11 14:54:52 2000 From: jkraska1 at san.rr.com (Courageous) Date: Sat, 11 Nov 2000 19:54:52 GMT Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0DA05A.7A5DCDE5@alcyone.com> Message-ID: > x = x + 1 > x=x+1 # does the same thing As an aside, in retrospect, I wish this weren't true. It would have been nice to be able to define variables like-this, or like-this? or *like-this*. C// From syver.enstad at sensewave.com Sat Nov 4 14:44:25 2000 From: syver.enstad at sensewave.com (Syver Enstad) Date: Sat, 4 Nov 2000 20:44:25 +0100 Subject: Using COM constants on under IIS ASP. References: <8t6nkm0k6l@news1.newsguy.com> <8tfiip$ham$1@troll.powertech.no> <39FB8B19.9080001@ActiveState.com> Message-ID: <8u29ia$u5c$1@troll.powertech.no> "Mark Hammond" wrote in message news:39FB8B19.9080001 at ActiveState.com... > Syver Enstad wrote: > > >> As long as you've run makepy on the type-library of the object you're > >> creating, all constants defined in that library will be available as > >> attributes of win32com.client.constants when objects defined in that > >> library are created. > > > > Thanks it worked, I should've tried it sooner. > > > > I thought it wouldn't work because I interpreted the Hammond/Robinson book > > as saying that the constants were not available until the object was created > > by win32com.client.Dispatch and that is never called in my asp file, just > > Server.CreateObject. I guess my interpretation is wrong... > > Your interpretation is correct. It is just that the Active Scripting > implementation calls win32com.client.Dispatch() internally! > > Mark. Thank you Mark. Always nice to why things work! I'm trying out Python for ASP at work for the moment. Much nicer than JScript because you have the great Python library and inheritance too. From Gareth.McCaughan at pobox.com Thu Nov 16 19:02:05 2000 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: Fri, 17 Nov 2000 00:02:05 +0000 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> <8v0uv4$jh$1@panix3.panix.com> Message-ID: Lyle Johnson wrote: > Bonk! Wrong answer. To quote the FAQ, it is developed under Linux but runs > under Unix, DOS, Windows, MacOS, BeOS, Amiga, Acorn Risc OS (???) and OS/2. "Acorn RISC OS" is the operating system used by a range of ARM-based desktop machines made by Acorn Computers Ltd (who no longer exist, having been bought). The ARM processor was developed by Acorn (the "A" in the name originally stood for "Acorn", not "Advanced"), and when it first appeared it was terribly impressive. RISC OS is a rather quirky operating system-cum-GUI. The OS itself has some neat features but is on the whole pretty lame. The GUI is excellent. There are some startlingly good applications. Be all that as it may, the platform is clearly doomed. It's been a tiny minority for ages, except in schools in the UK (where it's fast disappearing now). -- Gareth McCaughan Gareth.McCaughan at pobox.com sig under construc From jose at KILL-THIS.shangosoft.com Tue Nov 14 12:14:14 2000 From: jose at KILL-THIS.shangosoft.com (Jose Correia) Date: Tue, 14 Nov 2000 09:14:14 -0800 Subject: Cross-Platform Database Access References: <3A11115D.41B43BCA@qvlinc.com> Message-ID: <8urru0$2f1k$1@newssvr06-en0.news.prodigy.com> Not sure if there is a seperate module, but you can install a PostgreSQL ODBC driver on Windows which will give you access to your db on Linux from any application (incl Python) that uses ODBC. HTH, Jose "Coy Krill" wrote in message news:3A11115D.41B43BCA at qvlinc.com... > I've got a check program that we use to write our AP and payroll checks > while our company is in bankruptcy that started as a quick "I can do > that" project and is now growing to need a database (currently just uses > a shelve for the check register and a pickle for configuration data). I > develop on Linux and the database I'd like to use is the PostgreSQL > database on one of our Linux workgroup servers but my user base is using > Windows. Is there a PostgreSQL module that works on Windows and Linux > or is there a port of the Windows ODBC module to Linux? > > Coy Krill > > From kopfarzt at my-deja.com Fri Nov 3 06:01:07 2000 From: kopfarzt at my-deja.com (kopfarzt at my-deja.com) Date: Fri, 03 Nov 2000 11:01:07 GMT Subject: import question Message-ID: <8tu5th$qj$1@nnrp1.deja.com> Hi, how can I dynamically import modules in function a() , and then call them by name in function b() instead of using the module object? what I want to do is something like this: def a(): module = __import__ ('foo') def b(): x = eval ('foo.bar ()') I always get a NameError: foo (I am using Python 1.5.2) Thanks in advance for any replies! Peter Sent via Deja.com http://www.deja.com/ Before you buy. From gerhard_haering at yahoo.com Wed Nov 1 21:15:38 2000 From: gerhard_haering at yahoo.com (Gerhard =?iso-8859-1?Q?H=E4ring?=) Date: Wed, 01 Nov 2000 18:15:38 -0800 Subject: Linking to python debug library Python20_d.lib? References: Message-ID: <3A00CE4A.29404292@yahoo.com> Robert Brotherus wrote: > > The required file python20_d.lib is not found anywhere in the python2.0 > distribution. Where could I get it? The debug files are in a seperate download at http://www.pythonlabs.com/products/python2.0/download_python2.0.html named BeOpen-Python-2.0-Debug.zip Gerhard From nickatvideosystemdotcodotuk Tue Nov 21 07:55:27 2000 From: nickatvideosystemdotcodotuk (Nick Trout) Date: Tue, 21 Nov 2000 12:55:27 -0000 Subject: How do I exchange the values of A and B References: <3A19CD9E.D625A57E@juniata.dgsys.com> Message-ID: <3a1a70f3@news.xtml.co.uk> x,y = y,x "Charlie Kilmer" wrote in message news:3A19CD9E.D625A57E at juniata.dgsys.com... > How do I exchange the values > int A = x; > int B= y; > > here x and y are the values > > how do exchange the values so that > int A = y; > int B = x; > > --without using a temp to make it happen. > > please cc my email at ckilmer at juniata.dgsys.com > > Thanks, > > Charles Kilmer > Mclean VA > > > > > > > > > > From cpl.cna at zaz.com.br Fri Nov 10 11:50:09 2000 From: cpl.cna at zaz.com.br (CPL) Date: Fri, 10 Nov 2000 14:50:09 -0200 Subject: RAD for Python??? Message-ID: <3a0c47ea@news.terra.com.br> What? What it do? From moshez at math.huji.ac.il Wed Nov 1 10:09:59 2000 From: moshez at math.huji.ac.il (Moshe Zadka) Date: Wed, 1 Nov 2000 17:09:59 +0200 (IST) Subject: Rounding Bug in Python 2.0! - ugh In-Reply-To: Message-ID: On 1 Nov 2000, Pete Forman wrote: > It would be nice if Python would make use of dtoa() rather than stock > sprintf() to display floating-point numbers. There are variants of > dtoa in netlib and libg++. netlib and libg++ aren't always available. Python is meant to be portable... And anyway, the problem isn't necessarily one of display: you have to ways to display floats: str -- inaccurate but readable repr -- (more) accurate but unreadable -- Moshe Zadka -- 95855124 http://advogato.org/person/moshez From grey at despair.rpglink.com Sun Nov 12 18:53:12 2000 From: grey at despair.rpglink.com (Steve Lamb) Date: Sun, 12 Nov 2000 23:53:12 -0000 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <974070178.345720@clam-ext> Message-ID: On Mon, 13 Nov 2000 12:02:58 +1300, Mark Hadfield wrote: >People in glace houses shouldn't throw stones. Shouldn't that be glacer? :P -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. -------------------------------+--------------------------------------------- From darius at bofh.net.au Mon Nov 13 06:12:55 2000 From: darius at bofh.net.au (KevinL) Date: Mon, 13 Nov 2000 22:12:55 +1100 Subject: Date manipulation and Java 'interface' equivalents (OT) In-Reply-To: Your message of "Mon, 13 Nov 2000 04:07:12 CDT." <3a0fada4_2@corp.newsfeeds.com> Message-ID: <200011131112.WAA16007@wobbly.bofh.net.au> >>> "Joshua Muskovitz" wrote > > Or realising that there's a duh-switch at all. So much of learning how > > to programme well is flipping duh-switches. Isn't there something to > > be done about that, do you reckon? I think I can say without > > overstating it that it's not entirely unimportant. > > I don't think so -- learning to be a good, solid, sane coder seems to me to > be a very experiential process. Having someone tell you up front to "watch > out for duh-switch X" doesn't seem to work well. You have to screw it up a > few times before it sinks in. But one thing I've learned over the years is Recommendation for a book: "The Pragmatic Programmer" http://www.amazon.com/exec/obidos/ASIN/020161622X My SO has been reading it - she's just starting out in IT, has qualifications but no experience - and she's been quoting a lot of that good, solid, sane stuff people seem to pick up over the years. I'm hoping she finishes it quickly so I can have a read ;) KL From syver at NOSPAMcyberwatcher.com Mon Nov 6 12:03:25 2000 From: syver at NOSPAMcyberwatcher.com (Syver Enstad) Date: Mon, 6 Nov 2000 18:03:25 +0100 Subject: Iterating over the data items in a dict. References: <4ak8ahfbet.fsf@kern.srcf.societies.cam.ac.uk> Message-ID: "Gaute B Strokkenes" wrote in message news:4ak8ahfbet.fsf at kern.srcf.societies.cam.ac.uk... > > I would like to iterate over the data items, not the keys, in a dict. I think you can do it like this: for key, value in dict.items: # do stuff From phd at phd.russ.ru Mon Nov 6 06:44:10 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Mon, 6 Nov 2000 14:44:10 +0300 (MSK) Subject: Async DNS? In-Reply-To: <3a0618bd.33632529@24.0.228.33> Message-ID: On Mon, 6 Nov 2000, Mike Clarkson wrote: > Does anyone have asynchronous DNS lookup for Python? http://dustman.net/andy/python/adns-python Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From thomas at xs4all.net Fri Nov 17 03:26:04 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Fri, 17 Nov 2000 09:26:04 +0100 Subject: python2.0 and redhat 7.0 (new issue) In-Reply-To: <5.0.0.25.0.20001117001656.00c199f0@pop-server>; from jkraska1@san.rr.com on Fri, Nov 17, 2000 at 12:24:23AM -0800 References: <20001115001334.D1463@dman.rh.rit.edu> <8usnme+b63b@eGroups.com> <20001115001334.D1463@dman.rh.rit.edu> <20001116160141.T27208@xs4all.nl> <5.0.0.25.0.20001117001656.00c199f0@pop-server> Message-ID: <20001117092604.G12776@xs4all.nl> On Fri, Nov 17, 2000 at 12:24:23AM -0800, Courageous wrote: > % man openpty > The documentation should, if written correctly, include a > synopsis, one part of which would indicate which library to > link with. Yes. Unfortunately, on Linux, our beloved GNU project has forsaken 'man' in favor of 'info', and there are no manpages for openpty or forkpty. You have to 'info libc' and then '/openpty'. None of your other find/grep solutions would find it, unless you start gunzipping all the .gz files in the info directories ;) > Of course, lastly, if there is no man page for openpty, hunt > down the author and give him or her a good spanking (preferably > a "her," much more fun that way). "Yes! And after that, you must give us all a good spanking!" "And after that, oral sex!" The-Holy-Grail-was-on-last-night-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From just at letterror.com Thu Nov 16 11:53:14 2000 From: just at letterror.com (Just van Rossum) Date: Thu, 16 Nov 2000 17:53:14 +0100 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> <8v0uv4$jh$1@panix3.panix.com> Message-ID: <3A1410C4.915F6029@letterror.com> Lyle Johnson wrote: > I've just started looking at Ruby, mainly because my curiosity got the > better of me. So far I'm underwhelmed. I can see how it might appeal to Perl > users but not Python users. I'll try to present my finding to the newsgroup > after I've had more time to give it a fair shake. One odd thing I came across: while in Ruby apparently everything is an instance (no difference between types and classes) I read somewhere that functions and methods are _not_ first class citizens. Just From slim.shady at 01019freenet.de Sat Nov 11 10:30:14 2000 From: slim.shady at 01019freenet.de (Philipp von dem Bussche-Hünnefeld) Date: Sat, 11 Nov 2000 16:30:14 +0100 Subject: Zope question Message-ID: <8ujo82$1u2vm$1@ID-46829.news.dfncis.de> Hey folks, I?d like to use Zope, which is based on Python for my new project, an information portal. Unfortunately I do not have an own Webserver so I have to put my html-docs on a server of a host here in germany. Now my question is, if I am able to run Zope by installing just the necessary files in my home directory or if I have to ask my provider to install the paket for me. thanx for help, Philipp. From etsang at my-deja.com Wed Nov 1 14:08:13 2000 From: etsang at my-deja.com (First Name Last Name) Date: Wed, 1 Nov 2000 11:08:13 -0800 Subject: function with a lot of parameters --maintainability issue Message-ID: <200011011908.LAA27572@mail24.bigmailbox.com> An embedded and charset-unspecified text was scrubbed... Name: not available URL: From sholden at holdenweb.com Mon Nov 6 08:39:13 2000 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 06 Nov 2000 08:39:13 -0500 Subject: PythonWin IDE sucks! References: Message-ID: <3A06B481.82B78E2@holdenweb.com> Simon Brunning wrote: > > > From: Pete Shinners [SMTP:pete at visionart.com] > > > > you absolute moron!! > > I came here for an argument! Would you like the five-minute argument or the ten-minute argument? > Oh. Oh. I'm sorry. This is abuse. > But surely you can see from the exclamation mark that it's [an attempt at] humo[u]r?! regards Steve -- Helping people meet their information needs with training and technology. 703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/ From jcw at equi4.com Tue Nov 7 15:00:32 2000 From: jcw at equi4.com (Jean-Claude Wippler) Date: Tue, 07 Nov 2000 12:00:32 -0800 Subject: python compiler?? References: <3A04051A.B1A8517B@cyberway.com.sg> <8u2f1i$505$1@news.udel.edu> <3A07CCC0.52105127@cyberway.com.sg> <8u8t7v018mc@news1.newsguy.com> Message-ID: In article <8u8t7v018mc at news1.newsguy.com>, "Alex Martelli" wrote: > "Maurice Ling" wrote in message > news:3A07CCC0.52105127 at cyberway.com.sg... > > Well, what I'm really interested in is, is there any python compiler > > that can compile python codes into standalone executables? > > See http://www.mcmillan-inc.com/install1.html -- he offers tools > to do that (which are *NOT* "python compilers") and points to a > few alternatives (which might conceivably be seen as "compilers" > in some sense -- at least, Python2C might be seen that way). [...] > Note that only in the Windows version does he build > _truly_ totally self-contained executables -- "it's not > culturally appropriate" (and is technically harder, it > seems) to do that for Linux. I'm not sure I understand > this (but then, my Linux knowledge dates mostly from > 0.99 days -- I have heard executable/object formats have > indeed been changed drastically since those days). But > it's an issue of C-written DLL's (.so's, in Linux), not > of any Python code -- apparently it's hard/inappropriate > to package up an executable together with all the DLL's > it needs. Actually, very few do that in Windows, either -- > at the very least, kernel32.dll, etc, are _never_ packaged > together with the .exe (or else the latter would run on > just ONE possible Windows configuration...), so, there is > really no such thing as "a truly, fully stand-alone exe". > > But if it's OK for the C-written DLL's to remain "outside" > (to be unpackaged side-by-side with the almost-standalone > EXE, e.g. in the same directory), and you're only worried > about Python-code (and its compiled forms), then Gordon's > installer is probably the best available solution today. I agree. There is more to it than that, though. Maybe one day, Python will add a little callback layer ("stubs") like Tcl does, then one could go further as this recent Tcl-specific announcement by yours truly illustrates: http://www.deja.com/%5BST_rn=ps%5D/getdoc.xp?AN=689526692&fmt=text This has been done for Windows, Linux, Solaris, FreeBSD, Mac, and a few others, so far. This approach is not tied to Tcl or MetaKit, it could be done with Python and ZIP archives, for example. -jcw From twlichty at execulink.com Mon Nov 20 23:58:21 2000 From: twlichty at execulink.com (Todd Lichty) Date: Mon, 20 Nov 2000 20:58:21 -0800 Subject: Pmw - Sizing EntryField widget Message-ID: <5DkS5.70027$Z2.922682@nnrp1.uunet.ca> Is there a way to set the size of a Pmw Entryfield widget? I tried using hull_size but the width is always the same. Here is my call: self.DOB = Pmw.EntryField(master, labelpos='w', label_text='', validate ={...}, hull_width=5) I tried using width instead of hull_width but it raised an exception. Thanks, Todd From shindich at my-deja.com Sun Nov 12 06:07:32 2000 From: shindich at my-deja.com (shindich at my-deja.com) Date: Sun, 12 Nov 2000 11:07:32 GMT Subject: Weak References Message-ID: <8ultlh$l2r$1@nnrp1.deja.com> Ever wanted to have weak references in Python? Pre-alpha release of PyWeakReference project is now available on Source Forge (http://sourceforge.net/projects/pyweakreference/) Documentation is coming soon... (some docs are available in the Doc subdirectory of the zip file) Sent via Deja.com http://www.deja.com/ Before you buy. From glandrum at my-deja.com Tue Nov 21 10:06:42 2000 From: glandrum at my-deja.com (Greg Landrum) Date: Tue, 21 Nov 2000 15:06:42 GMT Subject: VC++-Extension in Debug-Mode References: <8vdh9k$509$1@nnrp1.deja.com> Message-ID: <8ve31s$iom$1@nnrp1.deja.com> In article <8vdh9k$509$1 at nnrp1.deja.com>, sentinel101 at my-deja.com wrote: > I've problems with an extension written in VC++ and compiled & linked in > Debug mode. I got the debug libs from the BeOpen-Website and everything > seemed to work fine until I imported the module. > > The standard Python interpreter just crashed immediately after displaying the > message "Fatal Python error: Interpreter not initialized (version > mismatch?)". The debug version of Python simply says "ImportError: No module > named XXX". The crash seems to happen in Python20_d.dll (modsupport.c), > probably in function Py_InitModule4TraceRefs. Can I circumvent this by > undefining Py_TRACE_REFS which I found in modsupport.h ? Any idea ? > The simplest explanation for this is that you have forgotten to append an _d to the name of your debug extension dll, i.e. your mod.dll should be called mod_d.dll when you build in Debug mode. Under Windows, you have to do this. When you are running the debug version of python, it can't find mod_d.dll so you get an error. When you are running the "normal" version of python, which uses python20.dll, you get mod.dll imported, but it comes along with python20_d.dll. The net result of having different versions of the same dll imported is unhappiness. The real fun starts if you use a number of other extension modules and you need to make sure that you have up-to-date, accessible versions of all of them in both Release and Debug forms. Welcome to Windows Debug Hell (TM). -greg Sent via Deja.com http://www.deja.com/ Before you buy. From aleaxit at yahoo.com Sun Nov 12 15:23:47 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 12 Nov 2000 21:23:47 +0100 Subject: Databases supported by Python References: <8umjn8$3ol$1@nnrp1.deja.com> Message-ID: <8umubg0633@news2.newsguy.com> wrote in message news:8umjn8$3ol$1 at nnrp1.deja.com... > Hi all, > > I'm just starting to use Python and I need to > know if Python supports MS-SQL server or > Microsoft's Access. I couldn't find any records > of these DataBases in Python documentation. With either mxODBC (a module you can download separately), or ADO (part of Microsoft's UDA pack, which you can download from the MS site at need; but it normally comes with all of MS's data products) to which you connect via COM of course (COM is supported as part of the win32all add-on package, which is also built-into the ActiveState distribution if you prefer that). My preference is for ADO (with the newest Jet, it works far better than ODBC, for example). No doubt other solutions also exist (e.g, COM-based, you could use the old RDO objects -- but there is no reason to, ADO is really better). This is not mentioned in the Python docs because it's not part of the standard Python distribution; the support is obtained through a choice of excellent add-on packages. Alex From djc at object-craft.com.au Tue Nov 7 20:06:16 2000 From: djc at object-craft.com.au (Dave Cole) Date: 08 Nov 2000 12:06:16 +1100 Subject: History question about for .. else Message-ID: I just used the else clause on a for loop for the first time and my business partner does not like it. We launched into a discussion about the construct. for value in list: if condition: # do something break else: # do something else My partner is of the opinion that the syntax is ugly, and he would avoid it if at all possible. I argued that it is a zero-cost detection of "falling of the end of the loop" as it prevents you having to use an additional condition variable and subsequent test. I would be interested in knowing the history behind the introduction of the else clause on the for loop. - Dave -- http://www.object-craft.com.au From peter at engcorp.com Mon Nov 13 22:34:50 2000 From: peter at engcorp.com (Peter Hansen) Date: Mon, 13 Nov 2000 22:34:50 -0500 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <874s1dm5yh.fsf@fangorn.stofanet.dk> <87wve7afwb.fsf@fangorn.stofanet.dk> <8upr452314b@news2.newsguy.com> Message-ID: <3A10B2DA.D326F87C@engcorp.com> Alex Martelli wrote: > > "Martin Christensen" wrote: > > 1) Esperanto is a nice idea, and it would be great if everybody spoke > > it. > > 2) Not many people speak Esperanto, so it's not immediately useful. > > 3) Because it is not immediately useful, I will not learn it. > > Right! This tends to be the dilemma of innovations, if they play > in a field where 'network-effects' (in the economics sense) > dominate. Many new technologies, such as CDROMs and DVDs, > meet it at their outset. And, you know what? The non-early- > Human languages, like many other technologies centered on > communication, are iffier that way. Maybe a Swiss-Sweden > combine, for example, would have a competitive advantage > if using Esperanto -- but none, AFAIK, has yet bet a huge > multinational firm on it (Asea/Brown-Boveri, just such a Never heard of these concepts before, but they seem to explain a lot of things. Such as why, back in 1887 and for twenty to thirty years after, Esperanto grew so quickly in popularity. It demonstrated network effects because of strong interest in international travel and brotherhood, and as the world opened up and the educated population of Europe had the opportunity, Esperanto provided an obvious way for many of them to experience a new world order. These days, especially with the current dominance of English in technology, business, and other international affairs, that role for Esperanto has disappeared except in small niche areas and a few special cases. On the other hand, it has survived this long and continues to grow largely because of the strong "competitive" advantages it provides (assuming that is the strict opposite of network effects). For some people it fills the role of a hobby (and mostly a cheap one!), while for others it provides benefits related to the learning of languages. Some people study it (those amateur linguists) for its own merits, while others continue to use it exclusively for travel (via the Pasporta Servo which allows Esperantists to travel the world via a network of other Esperantists). There are subcultures of almost every kind in the Esperanto community. (I suppose I'm not sure whether you call some of these things competitive advantages, or some kind of localized network effects, but one way or the other, it survives and slowly grows.) -- Peter Hansen From j_gergic at yahoo.com Thu Nov 9 04:48:21 2000 From: j_gergic at yahoo.com (Jaroslav Gergic) Date: Thu, 09 Nov 2000 10:48:21 +0100 Subject: http client with proxy example ? References: <3A08A481.A61E2728@nowhere.com> Message-ID: <3A0A72E5.D1F1A855@yahoo.com> Kevin Bailey wrote: > > Hi, > > Could someone point me to or provide a simple example of > pulling down a webpage using a proxy webserver in Python ? > I can not help "in Python" but basically, there is simple difference between HTTP request and HTTP-proxy request: HTTP: you want to get http://some-host/some-file.html open socket to "some-host" port 80 (default) and issue: >>>BEGIN_SAMPLE:<<< GET /some-file.html HTTP/1.0 Host: some-host >>>END SAMPLE<<< (do not forget an extra cr+lf after Host header) HTTP-proxy: you want to get http://some-host/some-file.html using proxy: some-proxy:8080 (8080 is typical but can differ) open socket to "some-proxy" port 8080 and issue: (connect to PROXY instead of target server!) >>>BEGIN_SAMPLE:<<< GET http://some-host/some-file.html HTTP/1.0 Host: some-host >>>END SAMPLE<<< Summary: the only difference is in GET header line, in case of HTTP-proxy request you MUST issue fully qualified URL. Regards Jaroslav Gergic P.S.: You can try the examples above using Telnet ;) From aleaxit at yahoo.com Mon Nov 13 11:06:28 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Mon, 13 Nov 2000 17:06:28 +0100 Subject: Style: global configuration data References: <8umc4u$i28$1@news1.xs4all.nl> <8uokpo$d7d$1@news1.xs4all.nl> <8uovrq$4ou$1@news1.xs4all.nl> Message-ID: <8up3i7027qd@news2.newsguy.com> "Boudewijn Rempt" wrote in message news:8uovrq$4ou$1 at news1.xs4all.nl... [snip] > the warning in Internet Programming with Python (p. 173 - ... does not > create a shared variable between the modules ...). But I see that they > talk about what you say below: > > > PS: You dont want to do > > from config import setting > > setting = 2 > > ... because it won't work. Right, it won't: because 'setting' is an entry into the dictionary of "this" module here. Rebinding it to something else does not affect any _other_ possible bindings to the same object. > Curiously enough, in the more complicated example below 'from config > import Config' does work... Probably a silly oversight on my part, > but I can't see the real difference: > --------- config.py ---------- > class Config: > foo=10 [snip] > from config import Config [snip] > Config.foo="A" Here, what's being re-bound is entry 'foo' in the dictionary of (class) object Config. If several modules are bound to that same class object, they'll all see whatever the current bindings *in ITS dictionary* are. Maybe it would help get the right mental model if you saw from config import Config as a useful shorthand for: locals()['Config'] = __import__('config').__dict__['Config'] Clearly (I hope), given that different modules (and functions) see different directories returned by 'locals()', what they do to the entries of those directories matter not to one another. OK so far...? (You can't usefully bind things to locals()' entries inside a function, but, 'conceptually', that is what's going on, more or less...). Now, Config.foo="A" may similarly be seen as shorthand for: Config.__dict__['foo'] = "A" Clearly, if different places all see the object that is here denoted by 'Config', changes to its one-and-only dictionary are also going to be equally seen by all those 'places'... Alex From tim_one at email.msn.com Wed Nov 8 16:14:39 2000 From: tim_one at email.msn.com (Tim Peters) Date: Wed, 8 Nov 2000 16:14:39 -0500 Subject: Where is time.strptime()? In-Reply-To: Message-ID: [Tim] >> + Does [this implementation of strptime] compile and run correctly >> on all Python platforms? [Hrvoje Niksic] > Why is this necessary? I thought it would be used only on platforms > that don't have a native strptime(). See below. > + Is this particular version of strptime "the correct" one (strptime > isn't available everywhere *now* because it's not part of ANSI C, so > some platforms don't supply it -- while those that do apparently > don't always agree on its input->output behavior)? > I don't think any one of them is "correct", as even the standards > conflict on what should be done. But still, even an average one will > beat having none. Says you, and that's fine, but others won't agree. Adding support for non-ANSI C functions is always a battle for this reason; you can't avoid the fight by delcaring that *you* don't care. That's what PEPs are for. I personally have no interest in strptime, so don't wait for me to "do something"! If nobody in the community cares enough to do the work, so it goes. >> + Clause 3 renders this license incompatible with the GPL (the >> Regents of the U of CA have no authority to revoke such clauses in >> licenses other than their own). > I think the advertising clause has been removed from all BSD software > some time ago. The copyright notice might be out of date. So who's going to straighten that out? I'm not interested. Is anyone else interested *enough*? nobody-yet-has-been-ly y'rs - tim From paulb at infercor.no Fri Nov 10 05:18:07 2000 From: paulb at infercor.no (Paul Boddie) Date: Fri, 10 Nov 2000 11:18:07 +0100 Subject: Q: python and mySQL on linux References: Message-ID: <3A0BCB5F.A64A50A2@infercor.no> hwan-jo yu wrote: > > Hi, > > It seems that mxODBC is running only on windows environment since ODBC > is for windows. Not true! See: http://www.paul.boddie.net/Python/mxODBC.html > Is there any way to use MySQL with python on Linux ? That's almost a different question entirely. <0.4 wink> I never managed to get it working properly on Solaris, but perhaps you might be more fortunate. Regards, Paul From vasvir at iit.demokritos.gr Wed Nov 8 13:25:27 2000 From: vasvir at iit.demokritos.gr (Vassilis Virvilis) Date: Wed, 08 Nov 2000 20:25:27 +0200 Subject: parsing windows resource scripts References: <3A087199.CF2782DB@seebelow.org> Message-ID: <3A099A97.DBB03CC1@iit.demokritos.gr> Grant Griffin wrote: > > - Does anybody know where I can find a grammar that describes Windows > resource scripts? (I have a reference book for this but not a > "grammar".) > If you take a look into the WINE project http://www.winehq.com they implement something called wrc which is a resource compiler actually. I assume that having the grammar defined in a yacc file it is sufficient for you. .Bill From ransen_spam_me_not_ at nemo.it Thu Nov 2 02:07:50 2000 From: ransen_spam_me_not_ at nemo.it (Owen F. Ransen) Date: Thu, 02 Nov 2000 07:07:50 GMT Subject: Python 1.5 v 2 (to be embedded in garphics app) References: <3a000991.53776@news.newsguy.com> <8tpddl$qf4$1@panix6.panix.com> Message-ID: <3a0112a5.9032463@news.newsguy.com> On 1 Nov 2000 07:38:29 -0800, aahz at panix.com (Aahz Maruch) wrote: >In article <3a000991.53776 at news.newsguy.com>, >Owen F. Ransen wrote: >> >>How different is Python 2 from Python 1.5? >> >>I have a Dr Dobbs Python Resource CD (1999), is >>that way out of date? > >2.0 is considerably different from 1.5.2; it's even more different from >1.5. But I think what you're really asking is whether what you learn >for 1.5.2 will be obsolete when you switch to 2.0. IMO, the answer is >"not much". Just about everything in 1.5.2 works the same, and there >are only a few new features in 2.0 that obsolete idioms that you learn >for 1.5.2. Many thanks for the reply. You interpreted my muddy question properly! Owen -- Owen F. Ransen http://www.ransen.com/ Home of Gliftic & Repligator Image Generators From parkw at better.net Thu Nov 16 22:21:26 2000 From: parkw at better.net (William Park) Date: Thu, 16 Nov 2000 22:21:26 -0500 Subject: Junior Developer Wanted....... In-Reply-To: <3A148083.AB830F99@pop.dnvr.uswest.net>; from alesniak@uswest.net on Thu, Nov 16, 2000 at 05:49:07PM -0700 References: <3A148083.AB830F99@pop.dnvr.uswest.net> Message-ID: <20001116222126.A1053@better.net> On Thu, Nov 16, 2000 at 05:49:07PM -0700, alesniak at uswest.net wrote: > Service Magic, Golden, CO > > We are searching for an open-minded, Junior Developer to > join the Service Magic > development team. Qualifications: 1 to 2 years of > programming experience required in one or more of the > following: Zope, Python, C/C++, OO programming. Web > application experience and proven proficiency in UNIX. > Salary: Commensurate on experience. Benefits: Full Medical, > Dental, Vision, 401K, Options. > > Service Magic revolutionizes the way people buy and sell > local services. Using the technology of the Internet, > Service Magic focuses on the need to create a better > connection between homeowners and local service > professionals. Our service is a quick, cost-competitive > environment with a service guarantee. Currently, Service > Magic has Home Service Providers in 35 major markets, 485 > categories of services. > > Send Resume to alesniak at servicemagic.com! Interesting... 1. Are you a "placement" company for home renovations? Or, are you running a "jobsite" for subcontractors? 2. How is better than Yellow Pages? ---William Park, Open Geometry Consulting From chega_ at yahoo.com Fri Nov 3 01:41:29 2000 From: chega_ at yahoo.com (Vadim Chugunov) Date: Fri, 03 Nov 2000 06:41:29 GMT Subject: Problems extending Python 2.0 with FREE BORLAND C 5.5 References: <3a004a2c.4678958@news.cis.dfn.de> Message-ID: "Matthias Fischer" wrote in message news:3a004a2c.4678958 at news.cis.dfn.de... > I'm working on a date-class for Python 2.0 with the FREE BORLAND C/C++ > Compiler 5.5 using the extension template from : Gordon Williams > Everything works fine exept the print function which crashes. > > static int Date_print(Dateobject *self, FILE *fp ,int flags) > { > fprintf(fp,"%02ld.%02ld.%04ld",self->day,self->month,self->year); > > return 0 ; > } > Without using the FILE pointer everything is OK. But I think it would > be better to use FPRINTF in case of PRINTF. > > Is there something special about using these functions in Python 2.0 ? > Or does my DLL not have the rights to use the FILE-Pointer ? Borland C defines FILE structure differently than MS VC. I am afraid your choices are limited to the following: a) Not use functions that take FILE* argument. b) Create an import lib for msvcrt.dll and force linker to use fprintf() from that lib instead of Borland's clib. Vadim From sholden at holdenweb.com Wed Nov 8 15:34:54 2000 From: sholden at holdenweb.com (Steve Holden) Date: Wed, 08 Nov 2000 15:34:54 -0500 Subject: Q: pyhton based lex, yacc tools References: <3A099C2E.426B722E@iit.demokritos.gr> Message-ID: <3A09B8EE.9A70D0F5@holdenweb.com> Vassilis Virvilis wrote: > > Halo everybody, > > Since I am rather new to the python world I would like to ask: > > Is there available any python tool which corresponds to a lex scanner > and/or a yacc parser? If not why? > Well, there are a few tools which will deal with the same sort of task, but as far as I know (and this is not a major interest area for me), nothing directly to compare. > Does the community behind this newsgroup think that they are useless? Is > it so much better to hand code things? or do I really miss something? It > looks to me that having the expressive power of python and the re module > the scanner should be at least a perfectly doable task. > Nice things have been said about both lex and yacc in the past. When you know more about it than me you will be able to wrap lex and yacc output up using SWIG, and use them directly inside Python programs. So I suppose one answer is they don't *need* to be rewritten in Python ... A list of parsing systems is available at http://starship.python.net/crew/amk/python/string.html#parsing but sadly everybody's favorite website seems to be temporarily indisposed (again), so it may take a while to be able to get at that. There's also a parsing package available as part of the Gadfly database system, see http://www.chordate.com/kwParsing/index.html You might also be interested in (watch it, the URL will wrap): http://www.foretec.com/python/workshops/1998-11/proceedings/papers/aycock-little/aycock-little.html > Please comment... > A sarcastic reply, which we Yorkshirepersons are known to be predisposed to, would run along the lines of "I found these references by searching the Deja.com comp.lang.python archive, which is what the community behind this newsgroup tend to do before asking questions". But that would only be because I'm typing this in my new house, with no furniture, and my knees hurt! My favorite surmise, however, is that the group collectively knew you'd come along and want to do the job! I'm sure you could recruit some support for such an enterprise from the readership. > .Bill regards Steve -- Helping people meet their information needs with training and technology. 703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/ From syver.enstad at sensewave.com Sat Nov 11 12:23:52 2000 From: syver.enstad at sensewave.com (Syver Enstad) Date: Sat, 11 Nov 2000 18:23:52 +0100 Subject: Confused. References: <8ubfv8$nth$1@plutonium.compulink.co.uk> <8ujmg5$t3j$1@troll.powertech.no> <8ujqao029t5@news1.newsguy.com> Message-ID: <8ujvgv$ne$1@troll.powertech.no> "Alex Martelli" wrote in message news:8ujqao029t5 at news1.newsguy.com... > gbreed's alternative suggestion was: > > > > import pywintypes, time > > > comtime = pywintypes.Time(time.time()) What you're trying to say is that the constructor of Time, converts from time.time() format to a PyTime object, and you use float on the PyTime to get the variant_date or whatever the COM date type is called. Right?. But there is still no function to convert from comtime to ctime format is there? An interesting bug by the way: >>> import pywintypes, time >>> ctime = time.time() >>> comtime = pywintypes.Time(ctime) I'll think I'll stick to the time module or I'll have to go to work tomorrow ;-) >>> time.ctime(ctime) 'Sat Nov 11 17:59:33 2000' >>> comtime.Format('%#c') 'Sunday, November 11, 2000 17:59:33' From grey at despair.rpglink.com Mon Nov 13 23:39:02 2000 From: grey at despair.rpglink.com (Steve Lamb) Date: Tue, 14 Nov 2000 04:39:02 -0000 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <874s1dm5yh.fsf@fangorn.stofanet.dk> <87wve7afwb.fsf@fangorn.stofanet.dk> <8upr452314b@news2.newsguy.com> <3A10AF52.77173B53@engcorp.com> Message-ID: On Mon, 13 Nov 2000 22:19:46 -0500, Peter Hansen wrote: >I've had, let's see, a total of eleven programmers, several of them >quite junior, learn Python over the last ten months. In that time, not >a single one of them took longer than one week to be agle to write >something useful in the language. Oh, I've already written something productive in Python. Ported a dice server from Perl to Python in about a week with some help from here on the finer details. I still dabble with it from time to time. OTOH I also know that if I get into Python coding I'll come back to it in 6 months and see about a dozen ways to do things better. For what I want to do at work I doubt I'd be able to get to that level in under a year because I need to understand the concept as well as implementation. -- Steve C. Lamb | I'm your priest, I'm your shrink, I'm your ICQ: 5107343 | main connection to the switchboard of souls. -------------------------------+--------------------------------------------- From hniksic at arsdigita.com Mon Nov 6 10:52:24 2000 From: hniksic at arsdigita.com (Hrvoje Niksic) Date: 06 Nov 2000 16:52:24 +0100 Subject: SomeClassInstance.[attributename] References: <8u6dq7$73l$1@nnrp1.deja.com> Message-ID: tattoom at my-deja.com writes: > Hello,Please excuse my ignorance...Python does provide a built-in function to > check for the existence of an object's attribute: hasattr(object, name)What > puzzles me to no end, is the fact one straight (IMHO) corollary to the above > functionality doesn't seem to exist (at least I can't find it :-).Namely, the > possibility to access an instance's attribute in a 'parameterized' (is that a > correct word?) way..e.g. Assume that Foo is an instance of some > class:theAttribute = 'fubar'if hasattr(Foo, theAttribute): fubar = > Foo.[theAttribute]# Where Foo.[theAttribute] would yield Foo.fubarYou get my > point. Is there a way in Python (as elegant and straightforward as this one) > to achieve the above? getattr(foo, attribute) (Corollary to hasattr, right?) From glpb at eis.bris.ac.uk Thu Nov 9 09:11:11 2000 From: glpb at eis.bris.ac.uk (P Browning) Date: Thu, 9 Nov 2000 14:11:11 GMT Subject: What is Zope? References: <3a0aa629.80764406@nntp.interaccess.com> Message-ID: Thaddeus L. Olczyk (olczyk at interaccess.com) wrote: : Heard much talk about it, gather it's some kind of Web server, : but I haven't really found a good description of what exactly it is. : You could try http://www.ariadne.ac.uk/issue25/zope/ Health warning: it was written Nov 99 and alot has changed since. I'd give you a URL to a page on www.zope.org of similar articles but my bit of the UK is cut off from the other side of the Atlantic right now. Paul -- -- The Library, Tyndall Avenue, Univ. of Bristol, Bristol, BS8 1TJ, UK E-mail: Paul.Browning at bristol.ac.uk URL: http://www.bris.ac.uk/ From MarkH at ActiveState.com Fri Nov 10 22:40:42 2000 From: MarkH at ActiveState.com (Mark Hammond) Date: Sat, 11 Nov 2000 03:40:42 GMT Subject: win32gui.FindWindow problems References: <8uhij7$kl6$1@news.kodak.com> Message-ID: <3A0CBE48.1090500@ActiveState.com> Dale Strickland-Clark wrote: > I can't make it work either. It's not clear from the docs how to specify a NULL for the first arg - > which is what I think you need. I tried 0 and None but both crash Python. None as the first param is indeed passing NULL to the API - the API is what is crashing with that NULL :-( Indeed the API documentation does not state NULL is OK. >>> win32gui.FindWindow("ConsoleWindowClass", "Command Prompt") 131402 The class name can be determined from spy++. Mark. From chalu at egenius.com Fri Nov 24 15:52:30 2000 From: chalu at egenius.com (Chalu Kim) Date: Fri, 24 Nov 2000 15:52:30 -0500 Subject: [Zope] Python and EJB (J2EE) References: Message-ID: <3A1ED50E.CEB1D2F@egenius.com> Good topic. I was hoping someone would come around to this. Perhaps, there should be a thread of discussion on this. I dont' know what is there to compare. EJB has been around awhile and J2EE is yet another jargon to throw people off. Here is what we have experienced; 1. Anything that needs to be done on J2EE takes twice as long and of course, costs more. 2. Of "Java" programmers (there are many, 2M strong as a Java wannabe proclaims), only handful of programmers can really do anything. 3. Corporations are still very much enamored with Sun and Java with an idea "Sun is big and we can't go wrong with it. Zope and Python, I am clueless." 4. My close friend specifies Java language and he won't have anything to do with Java application. There is a theory that in Amercia, we make most of our money with hypes as if it is a bad thing when things work. Nevertherless, I think there needs to be a study of point-by-point comparison between EJB and Zope. Don't look at it from Zope/Python POV but from Java the Hut POV. Python folks don't really know what resuable codes and libraries they all have and their developments have been organic. I admit I don't know this for sure. I am being a devil's advocate. Some hot developers throw some stuff and we marvel at them. I think for Zope/Python to become enterprise, it needs to have quite a few things and I like to know if its community is ready for the mundane. Here are some topics; 1. Message queue 2. implementation of protocols such as SOAP, BXXP 3. better documentations for different levels of readership (decision maker, developer, systems architect, etc) 4. promotions, workshops and training 5. learning to play golf and smoke cigar... :-) Hung Jung Lu wrote: > > Python and EJB (J2EE) > ===================== > > Searching through comp.lang.python newsgroup archive > (python-list at python.org) and the zope at zope.org mailing list, I have not been > able to find much about EJB (Enterprise Java Bean) and Python/Zope > comparisons. (J2EE is Java Two Enterprise Edition, basically another jargon > for any architecture based on EJBs.) > > I believe this field deserves to be explored a little bit more. If Python is > going to be more used in the corporate environment, it has to be made > stronger. This message is kind of unorganized, but I would like to have > comments/feedback from other people. > > The following message shows that I am not the only one interested: > > >ruben 11/08/2000 in comp.lang.python: > > > >Coming from a Java background and recently using Python for application > >development, I have a question. Is there an equivalent to Enterprise > >JavaBeans in Python? If so, please point me to some resources!!! > > Similarly Joe Grace has posted an explanation on J2EE in > the Zope mailing list: > > http://zope.nipltd.com/public/lists/zope-archive.nsf/0dec1f578f18f116802568ab003585d2/86cffddc1a8a73b980256865006d44a2?OpenDocument > > I am starting to look into Java EJB, and I must say that despite all the > hype, it is totally horrible. I can understand the goals of EJB, but I > wonder whether something simpler and cleaner might be better. EJBs, > especially entity beans, have largely failed and have disappointed many Java > developers, or so it seems from the comments I have received from other > people. > > First off: what is an EJB? There are plenty of books out there, there are > plenty of websites out there, but you'll probably be hard-pressed to find > someone that has actually worked with EJBs. I've never liked the names "Java > Beans" and "Enterprise Java Beans". These are marketing names. We need some > more generic names. "Java Beans" are an attempt by Sun to implement > component programmming. That is, the idea is to have component classes on a > single machine (virtual machine in the case of Java) that can be shared/used > by different programs. In this sense, "Java Beans" are much like DLLs, Unix > shared libraries, Python modules, or Microsoft's COM, ActiveX stuff. "Java > Beans" are designed to be shared within one single machine. "Enterprise Java > Beans" are much more complex than "Java Beans", and they are aimed at > distributed computing: EJBs are designed as classes/components to be shared > by multiple machines. In this sense, they are more like CORBA, or > Microsoft's DCOM. Therefore: > > (1) Java Beans <--- local components, run on the same machine > (2) Enterprise Java Beans <--- distributed components, distributed > computing, multiple machines, potentially located in different geographic > locations. These components often have instance pools running in multiple > threads, and often are transactional. > > ------------- > > What about Python? Or Zope? Simple distributed computing is not too hard to > implement. CGIs in fact are a way of distributed computing. Python does have > DCOM (Mark Hammond) and CORBA. But I don't think DCOM/CORBA are the way to > go. In Python/Zope world, I guess Fredrik Lundh's XML-RPC is the closest > starting point for distributed computing, and eventually for something > similar to EJB container. (See http://www.zope.org/Members/Amos/XML-RPC for > XML-RPC in Zope and http://www.pythonware.com/products/xmlrpc/ for XML-RPC > in Python.) There is also (See SOAP > http://static.userland.com/xmlRpcCom/soap/SOAPv11.htm ), which is an > extended version of XML-RPC. > > For more information on XML-RPC, visit http://www.xmlrpc.com/ . > > Zope can be used as equivalent to EJB container. But Zope is a general > webserver with a lot of features that a simple server don't need. > > ------------- > > EJBs are there because of a few good reasons: > > (1) Multi-threaded, workload distribution, instance pooling > (2) Security > (3) Transactional > (4) Managed persistence (for "entity beans" in the EJB jargon) > > These are all important requirements for the corporate world. Can Python do > all these things? The answer right now is no. There is nothing really > equivalent to EJB in the Python world. > > ------------- > > Security: Python is great for rapid development. The > reflection/introspection power of Python is wonderful. I particularly like > the absence of the "private" keyword. In C++ and Java, corporate security is > implemented at the language level, which makes these language quite > annoying, in my opinion. That being said, corporates DO need security > mechanisms. If Python were to be used in corporate environment, there MUST > be a security interface layer. We don't want any employee to be able to peek > into the president's salary, for instance. That is, absolute data hiding at > a higher level is necessary. As Java/C++ have shown, data hiding at the > language level not only is an illusion, but ties up programmers hands too > much. So, it's best to leave the language itself free, and implement the > data hiding with a higher-level mecahnism. Distributed computing is good for > that. For Python, that also means that in remote procedure calls, only data > should be passed, not objects. We want a better separation of data from > code. Fredrik Lundh's XML-RPC seems to do well in this separation. > > Incidentally, this means that in the corporate world, primitive types > (numbers and strings, basically) are still going to be primitive types for > the foreseeable future. Therefore, a language like Ruby that treats > primitive types like objects actually are in disadvantage, I think. > > ------------- > > Can we develop Python into something equivalent to EJB? I don't know, but > that'll be so nice. :) Also, I'd like to see it happen without repeating the > mistakes of CORBA/EJB: they were too ambitious, too complicated. Simple > things (like the basic HTML) actually can gain much wider acceptance. > > ------------- > > If Python were to become used in the corporate environment, something must > be done to make it work in distributed computing. > > (1) XML-RPC is a good starting point. I think it's very important to keep > things simple. > > (2) Data/Code separation: I think it's important to have something that > extracts the primitive data members for passing them in the remote call > argument, like Fredrik Lundh's xmlrpclib module. > > (3) Utilities to help mapping objects into database persistence. > > (4) Distributed transaction: two-phase commit is crucial. The distributed > final "commit" action must be achieved in matter of milliseconds or even > microseconds. There seem to be some standard ways of two-phase commit used > by databases out there (XA?). So, if we want some distributed computing that > is fully transactional, the standard two-phase commit scheme must be > implemented. > > ------------- > > I guess what I am aiming at is an open-source Python Distributed Components > Server, which would be equivalent to an EJB Container. > > I guess anyone with experience in corporte programming environment would > agree that distributed components is the way to go, and that XML-RPC is the > way to go. Right now the overhead is heavy (it takes from milliseconds to > fraction of a second for the XML-RPC overhead), but with some performance > boosting in the XML part (using C, I guess), it may not be too bad. If the > overhead is small, people might even use distributed architecture for single > machine solutions. > > Allie Rogers from Triple Point Technology (http://www.tpt.com/) has an > article in www.xml-rpc.com ( > http://www.xmlrpc.com/discuss/msgReader$1073?mode=day ) that validate my > points: xml-rpc can replace and is replacing DCOM, J2EE/EJB and CORBA. But > it seems that he'd like to move into SOAP instead of the simpler XML-RPC. (I > can't say much because I don't know anything about SOAP.) > > ------------- > > Anyway, I am rambling. I just think that we as a community ought to push for > a light-weight open-source Python Distributed Components Server... maybe > even more than one version of servers, but at least one. This is the key to > opening the corporate door to Python applications. And forgive me for my > exaggeration, this might also provide the key to outdate all other languages > like Java, Perl, etc, and put Python in its deserved place. :) > > Any feedback/comment/direction/pointers will be appreciated. > > regards, > > Hung Jung > > _____________________________________________________________________________________ > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com > > _______________________________________________ > Zope maillist - Zope at zope.org > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) From mfletch at tpresence.com Sun Nov 5 22:28:22 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Sun, 5 Nov 2000 22:28:22 -0500 Subject: Geometry puzzler Message-ID: 1) Polygon "inside" test (assumes convex polygons) >From point, measure angle between each pair of points in the shell, summing total. Result which equals 360 degrees is a hit (i.e. the point is within the convex shell) 1b) Polygon "inside" test (arbitrary polygons) Take line from point to infiniti ( horizontal/vertical is the easiest), count the number of times the line intersects the lines of the polygon, odd == hit, even == miss. See Graphics Gems for a better (more authoritative and useful) description of the above and intersection testing for lines. HTH, Mike -----Original Message----- From: Paul Winkler [mailto:slinkp23 at yahoo.com] Sent: Sunday, November 05, 2000 9:56 PM To: python-list at python.org Subject: Geometry puzzler ... There are two basic but important things I can't figure out how to do: 1) Given any polygon, how can I test whether an arbitrary point lies inside that polygon? 2) Given two line segments, how can I find the coordinates of their intersection, if there is one? (easy for right angles, but I will often NOT have right angles.) ... From ohr at saol.com Fri Nov 3 01:54:50 2000 From: ohr at saol.com (gary) Date: Fri, 3 Nov 2000 08:54:50 +0200 Subject: jobs Message-ID: <8ttpcv$t3t$30@ctb-nnrp2.saix.net> JOBS JOBS JOBS EARN BIG BUCKS WORKING OVERSEAS WE HAVE 1000s OF VACANCIES IN THE IT INDUSTRY E MAIL A CONCISE CV TO ohr at saol.com From thomas at xs4all.net Wed Nov 8 05:04:03 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Wed, 8 Nov 2000 11:04:03 +0100 Subject: embedding on IRIX In-Reply-To: <3A0753BB.37A49596@wetafx.co.nz>; from mikem@wetafx.co.nz on Tue, Nov 07, 2000 at 01:58:35PM +1300 References: <3A0753BB.37A49596@wetafx.co.nz> Message-ID: <20001108110403.J27208@xs4all.nl> On Tue, Nov 07, 2000 at 01:58:35PM +1300, Mike Morasky wrote: > I'm attempting to embed python2.0 into a program on IRIX 6.5 and am getting > the following errors: > ld32: ERROR 33 : Unresolved text symbol "__eprintf" -- 1st referenced by > /local1/usr/local/lib/libpython2.0.a(longobject.o). > ld32: ERROR 33 : Unresolved text symbol "pthread_detach" -- 1st referenced > by /local1/usr/local/lib/libpython2.0.a(thread.o). > ld32: ERROR 33 : Unresolved text symbol "dbopen" -- 1st referenced by > /local1/usr/local/lib/libpython2.0.a(bsddbmodule.o). > Anyone know why? You need to use the same linker flags as Python did, to build the 'python' binary. From the looks of it, you need -ldb (or whatever bsddb is called on your system) and -lpthread (or -lthread or something similar.) I'm not sure where __eprintf() comes from, though. You might also want to think about compiling the libraries as shared modules, rather than all into libpython2.0.a -- that would remove the necessity for at least -ldb ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From mfletch at tpresence.com Fri Nov 10 14:03:53 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Fri, 10 Nov 2000 14:03:53 -0500 Subject: new-b: Hide command window in wx? Message-ID: 1) If you use PySimpleApp, then the GUI wxPython command output window is not created. 2) If you are talking about the standard Windows command prompt, rename your main script to myscript.pyw (.pyw being the key), this will use pythonw.exe instead of python.exe, so you don't get the command prompt window. Idle uses the same mechanism, incidentally. HTH, Mike -----Original Message----- From: 1_quest_man at my-deja.com [mailto:1_quest_man at my-deja.com] Sent: Friday, November 10, 2000 1:01 PM To: python-list at python.org Subject: new-b: Hide command window in wx? I am writting a little utility using wxPython. I can't seem to find a way to start the app without an adjacent command window. Even the demo has it, so I fear that it is not possible. Is this true. If so would it be possible to have the command window minimize itself while the main app window runs normal. (Ah! now you know I'm in Win shhh...:). Any way, I see that the Python IDLE is written with TKinter and it doesn't show an adjacent command window. Should I look into Tk instead for something like this? Thanks for any advice. Ruben PS. I hope this is not a double post. Sent via Deja.com http://www.deja.com/ Before you buy. -- http://www.python.org/mailman/listinfo/python-list From fredrik at effbot.org Sun Nov 12 15:47:24 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Sun, 12 Nov 2000 20:47:24 GMT Subject: Catching class exceptions References: <3a0eff92.329147114@news.demon.co.uk> Message-ID: Simon Foster wrote: > AttributeError: GetoptError > >>> > > What am I doing wrong? Is there a special syntax for class errors? Is > the documentation for the getopt module out of date? works for me... maybe PythonWin is picking up an old version of getopt.py? try printing getopt.__file__ just after you've imported it, to make sure you're using the 2.0 version of the file... From tdelaney at avaya.com Fri Nov 17 00:56:04 2000 From: tdelaney at avaya.com (Delaney, Timothy) Date: Fri, 17 Nov 2000 16:56:04 +1100 Subject: Delegates Message-ID: Bah - left a bit of excess code in, and sent it under the wrong subject :( This is better ;) Just a snippet of something I put together today to allow delegates. This may not be the best method, but it appears to work OK. The parameters to the delegate.__init__ method can be anything which can contain attributes. Normally these would be class instances, but they could be modules, etc. The list of delegates is checked against in the order they are defined. The first matching attribute is returned. It also handles the case that multiple classes in the heirarchy use delegates. In this case it is important that the delegate.__init__ method is the *first* __init__ method called, to maintain the behaviour that the subclasses overrides take precedence over the base class. class delegate: """""" def __init__(self, *delegates): """""" if self.__dict__.has_key('_delegate__delegates'): self.__delegates.extend(list(delegates)) else: self.__delegates = list(delegates) def __getattr__(self, name): """""" if self.__dict__.has_key('_delegate__delegates'): for d in self.__delegates: try: attr = getattr(d, name) return attr except AttributeError: pass raise AttributeError(name) def addDelegate (self, delegate): """""" if self.__dict__.has_key('_delegate__delegates'): self.__delegates.append(delegate) else: self.__delegates = [delegate] if __name__ == '__main__': class A: """""" i = 1 class B: """""" j = 2 class C: """""" k = 3 class D (delegate): """""" l = 4 def __init__(self): """""" delegate.__init__(self, B(), C()) class E (delegate, C, D): """""" m = 5 def __init__(self): """""" delegate.__init__(self, A(), C()) D.__init__(self) e = E() print e.m print e.l print e.k print e.j print e.i print e.n Tim Delaney Avaya Australia +61 2 9532 9079 From aleaxit at yahoo.com Thu Nov 2 05:17:54 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Thu, 2 Nov 2000 11:17:54 +0100 Subject: How do you create constants? References: <8tm64b01lda@news1.newsguy.com> Message-ID: <8trfa601esh@news1.newsguy.com> "Quinn Dunkan" wrote in message news:slrn901u6m.m0t.quinn at retch.ugcs.caltech.edu... > On Tue, 31 Oct 2000 11:10:25 +0100, Alex Martelli wrote: > >"Mikael Olofsson" wrote in message > >news:XFMail.001031081500.mikael at isy.liu.se... > >> Can someone tell me why anyone would need true constants? > > > >To give a "readable name", emphasizing their meaning, > >to what one could otherwise express in code as (e.g.) a > >number. > > You didn't answer his question. I believe his question was "Can't you just > bind a name and then not rebind it? If it's easy to just not rebind names, > why do we need a special language construct?" His question was the one we're quoting. If he meant to ask different questions, he can probably phrase them himself, rather than requiring an interpreter:-). The questions you're expressing are rather in the nature of _objections_ to the answer I did give (to the literal question he had posed). > You answer sounded like: "So you can bind a name, and not worry about it > getting accidentally clobbered." This is the gist of it, yes. The usefulness of constants is being able to use names rather than literals without introducing any exposures. > The real question is "what do you mean by 'accidentally clobber'?" I believe > he was looking for ways you accidentally type 'math.pi = 3'. I'm interested > in those ways, too, since I can't think of any. But maybe they're there on > certain kinds of projects. If you're willing to use a structured-name (of the foo.bar kind) rather than a bare-name (just an identifier), you can indeed feel rather safe that it won't get accidentally re-bound (as long as you establish and enforce a convention that no module re-binds fields in another module). Accidental re-binding risk mostly affects bare-names. With a structured-name, you can also make _sure_ it will not be accidentally re-bound (by using as the left part a UserDict which enforces "no rebinding of keys without 'proper procedure'). The risk is on the top-part, the leftmost bare-name in the structured-name, basically. Accordingly, the risk is highest for modules designed to be used with "from foo import *" (e.g., wxPython), and modules that inject 'built-ins' (e.g., mxTools). Alex From 320015312021-0001 at t-online.de Thu Nov 23 13:53:59 2000 From: 320015312021-0001 at t-online.de (Robert Roebling) Date: Thu, 23 Nov 2000 19:53:59 +0100 Subject: ANN: wxDesigner 1.3 commercial RAD tool Message-ID: Hello, wxDesigner is a dialog editor and RAD tool for the wxWindows C++ library and its Python wrapper wxPython. It allows its users to visually create dialogs using a simple point and click interface as well as add new classes, handlers and getters to these dialogs. The output produced by wxDesigner can be either of C++ code, Python code or XML, making co-development with wxWindows and wxPython much easier than before. New in version 1.3 is a simple AppWizard to quickly create new projects, support for gettext translation, support for fonts, colours and disabling of controls as well as for using derived (custom) window classes within wxDesigner. wxDesigner is available for Windows and Linux - if there is any interest in versions for other Unix-variants, please let me know. A singler-user licence costs $69, the student version $19, owners of a wxDesigner 1.X licence can upgrade at no cost. More information is available from: http://www.roebling.de For more information about wxWindows and wxPython, visit the respective sites at: http://www.wxwindows.org http://www.wxpython.org Regards, Robert Roebling -- Robert Roebling, MD From michael.soulier at home.com Thu Nov 2 22:34:51 2000 From: michael.soulier at home.com (Michael P. Soulier) Date: Fri, 03 Nov 2000 03:34:51 GMT Subject: reading passwords Message-ID: Hey people. If I want to read a password from the user, I shouldn't use raw_input, since it echos to the screen. Is there a function I can use that will not do this, safe for entering passwords? Mike -- Michael P. Soulier "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to UNIX PGP Public Key: http://www.storm.ca/~msoulier/personal.html From py-list at zadka.site.co.il Tue Nov 7 08:49:20 2000 From: py-list at zadka.site.co.il (Moshe Zadka) Date: Tue, 07 Nov 2000 15:49:20 +0200 Subject: Iterating over the data items in a dict. In-Reply-To: Message from Gaute B Strokkenes of "06 Nov 2000 14:00:26 GMT." <4ak8ahfbet.fsf@kern.srcf.societies.cam.ac.uk> References: <4ak8ahfbet.fsf@kern.srcf.societies.cam.ac.uk> Message-ID: > > I would like to iterate over the data items, not the keys, in a dict. > The closest I can get is: > > for n in mydict.keys(): > i = mydict[n] > do_something_useful(i) > > However, this seems a bit awkward. See the .values() and .items() methods in the documentation. -- Moshe Zadka This is a signature anti-virus. Please stop the spread of signature viruses! From temrich at medien.tecmath.de Wed Nov 15 09:23:59 2000 From: temrich at medien.tecmath.de (Tim Emrich) Date: Wed, 15 Nov 2000 15:23:59 +0100 Subject: python with omniorb Message-ID: <3A129C7F.38CEC7E9@medien.tecmath.de> hihihi, i try to use omniorb3 with python1.52, but i can't find the package _omnipy!? can someone help? thanks Tim From andorxor at gmx.de Thu Nov 9 14:23:19 2000 From: andorxor at gmx.de (Stephan Tolksdorf) Date: Thu, 9 Nov 2000 20:23:19 +0100 Subject: Recursion of function defined within another function Message-ID: <18838853087.20001109202319@email.com> Hello, Why does the following program raises this error: ---Error--- Traceback (most recent call last): File "D:\projects\python\xrtt\test.py", line 9, in ? print Recur() File "D:\projects\python\xrtt\test.py", line 7, in Recur return inner(0) File "D:\projects\python\xrtt\test.py", line 4, in inner if i < 100: return inner(i) NameError: There is no variable named 'inner' ---Source--- def Recur(): def inner(i): i = i + 1 if i < 100: return inner(i) else: return i return inner(0) print Recur() --- Best regards, Stephan Tolksdorf From skip at mojam.com Wed Nov 1 20:48:16 2000 From: skip at mojam.com (Skip Montanaro) Date: Wed, 1 Nov 2000 19:48:16 -0600 (CST) Subject: Emacs mode for Python In-Reply-To: <8tq9bo$r74$1@nnrp1.deja.com> References: <8tq9bo$r74$1@nnrp1.deja.com> Message-ID: <14848.51168.569107.6755@beluga.mojam.com> fritz> Maybe the first question I should ask is: Does anyone here use fritz> emacs with python? Yeah, a couple of us do... ;-) fritz> What text editor (in a text window) is friendliest to python? Dunno. I was an emacs bigot long before I discovered Python, so there was no time wasted hunting around for a good editor. Look at Misc/python-mode.el for a Python mode for Emacs/XEmacs. I have the following stuff in my (XEmacs) ~/.emacs file: (add-hook 'python-mode-hook 'turn-on-font-lock) (setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist)) and have python-mode.elc on my load-path. -- Skip Montanaro (skip at mojam.com) http://www.mojam.com/ http://www.musi-cal.com/ From DOUGS at oceanic.com Thu Nov 16 17:31:39 2000 From: DOUGS at oceanic.com (Doug Stanfield) Date: Thu, 16 Nov 2000 12:31:39 -1000 Subject: help with ncurses - if anyone can give me a simple ncurses pr ogram Message-ID: <8457258D741DD411BD3D0050DA62365907A426@huina.oceanic.com> A great place to start is: http://python.org/doc/howto/curses/curses.html -Doug- > -----Original Message----- > From: Hanna [mailto:juliaj79 at hotmail.com] > Sent: Thursday, November 16, 2000 5:57 AM > To: python-list at python.org > Subject: help with ncurses - if anyone can give me a simple ncurses > program > > > Hi I am fairly new to python. I am supposed to create screens > with ncurses, > and I have consulted documentations, but I need some very > simple examples to > find out more about structure. I am not sure how to go about > it. Can anybody > who can program in ncurses send me example programs? > > Thanks > > > -- > http://www.python.org/mailman/listinfo/python-list > From hungjunglu at hotmail.com Sat Nov 25 15:30:29 2000 From: hungjunglu at hotmail.com (Hung Jung Lu) Date: Sat, 25 Nov 2000 12:30:29 -0800 Subject: [Zope] Python and EJB (J2EE) Message-ID: >From: Ender >... Thanks for the comments. I'll reply other points in a few more days. >as for distributed technologies, while xml-rpc is useful and simple its >not useful (IMO) for enterprise programming, its too basic. This maybe true. However, HTML is also basic and simple, but exactly because of its simplicity, it became widely accepted and used. On the opposite end is CORBA: because it's so complicated, there is no vendor out there that can possibly implement all its features. Trading powerful features for a wider acceptance at times does work. SOAP is showing symptoms of becoming complicated. And that's a bad sign. See Fredrik Lundh's implementation comment for Python SOAP at http://www.pythonware.com/products/soap/profile.htm >Profile >Posted Jun 08, 2000 > >SOAP 1.1 is a highly modular and rather complicated standard. Supporting >every little nook and cranny is huge task, and since the specification is >still a moving target, we've decided to do this implementation step by >step. OK. Even the guru describes SOAP as "rather complicated", what then for the novices? I personally went through the SOAP protocol spec today and I had to agree it's "rather complicated". SOAP is going down the path of CORBA all over again. It's becoming COAP (Complicated Object Access Protocol). If not because Microsoft is behind it, I'd dump SOAP right away. Due to its simplicity, I'd say XML-RPC is here to stay, SOAP or no SOAP. It's unfortunate that the twin brothers have to fare good-bye, but at the same time I am glad that XML-RPC split off to remain simple. Future servers will have to handle both: more work, but that's fate. More on the other points later. regards, Hung Jung _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com From pete at visionart.com Wed Nov 1 13:38:33 2000 From: pete at visionart.com (Pete Shinners) Date: Wed, 1 Nov 2000 10:38:33 -0800 Subject: Problems extending Python 2.0 with FREE BORLAND C 5.5 References: <3a004a2c.4678958@news.cis.dfn.de> Message-ID: <8tpnte$rc7$1@la-mail4.digilink.net> "Matthias Fischer" wrote > Without using the FILE pointer everything is OK. But I think it would > be better to use FPRINTF in case of PRINTF. hello matthias. this sort of problem can be common when using msvc also. under visualc, you get problems like this with FILE pointers when mixing runtime libraries. not too framiliar with the borland compiler, but mixing code between borland and msvc (and/or mixing runtime libraries) would be my first guess at the problem. From bob at imperia.org.uk Tue Nov 21 19:49:15 2000 From: bob at imperia.org.uk (Robert Keith) Date: Wed, 22 Nov 2000 00:49:15 +0000 Subject: How well does Python embedd in Java? Message-ID: Is is possible to call python modules from a Java program? I really like Java yet can see that python will have many advantages over a pure Java implementation of my project, I think it's regular expresion modules quite useful, and Java just does not seem to handle REGEX very well. Any comments would be appreciated. I have seen references to JPython, can anyone point me to an FAQ. thanx Bob From junaftnoon at nospamplzyahoo.com Wed Nov 8 06:55:43 2000 From: junaftnoon at nospamplzyahoo.com (June Kim) Date: Wed, 8 Nov 2000 20:55:43 +0900 Subject: some questions concerning UNICODE conversion in Python Message-ID: <8ubf0m$8oi$1@news.nuri.net> What's the difference btw these two and what are the semantics? >>> u'blah blah blah ' .... >>> unicode('blah blah blah ') Thanks in advance. From Eugene.Leitl at lrz.uni-muenchen.de Tue Nov 7 03:01:00 2000 From: Eugene.Leitl at lrz.uni-muenchen.de (Eugene Leitl) Date: Tue, 7 Nov 2000 09:01:00 +0100 (MET) Subject: Python Project Idea In-Reply-To: <8u7gp5$86n$1@verence.demon.co.uk> Message-ID: On 7 Nov 2000, Paul Wright wrote: > A Pythonic shell (in the Unix sense) and a GUI shell allowing you > to tie Python to desktop objects easily both sound like good ideas. I > think there's already a Perl based command line shell, though I've not > used it. If you gut Windows that badly, why on Earth not go all the way, and use one of the free Unices? They usually have Python stuck in all the right places, and by default. From slim at maya.com Wed Nov 15 14:44:26 2000 From: slim at maya.com (Seung Chan Lim) Date: Wed, 15 Nov 2000 14:44:26 -0500 Subject: jpython jar creation error References: <20001115142234.A14536@dman.rh.rit.edu> Message-ID: <005201c04f3c$76383100$95fe46c0@maya.com> D:\Program Files\JPython-1.1\Tools\jpythonc2>java org.python.util.jpython jpytho nc.py --jar mybell.jar --core --deep MyBellRinger.py . . . Building archive: mybell.jar Tracking java dependencies: org.python.modules.jarray Traceback (innermost last): File "jpythonc.py", line 5, in ? File "D:\Program Files\JPython-1.1\Tools\jpythonc2\main.py", line 291, in ma File "D:\Program Files\JPython-1.1\Tools\jpythonc2\main.py", line 284, in wr eResults File "D:\Program Files\JPython-1.1\Tools\jpythonc2\jar.py", line 86, in dump File "D:\Program Files\JPython-1.1\Tools\jpythonc2\jar.py", line 80, in dump les File "D:\Program Files\JPython-1.1\Tools\jpythonc2\jar.py", line 94, in addO Class AttributeError: java package 'org.python.modules' has no attribute '__path__' I get the above error... any ideas why??? From jasonic at nomadicsltd.com Mon Nov 20 10:22:19 2000 From: jasonic at nomadicsltd.com (Jason Cunliffe) Date: Mon, 20 Nov 2000 10:22:19 -0500 Subject: The origin of Python? References: <8v4cu6$k5u$1@news.nuri.net> <8v4glp$f0s$1@nnrp1.deja.com> <8v4ic2$olr$1@news.nuri.net> <8v4k36$p2l$1@slb6.atl.mindspring.net> <3A160250.772AAE8C@san.rr.com> Message-ID: 'Monty Python' emerged at a period in England when there had been a lot of nostalgic fashion appropriation of Victoriana and Edwardian period style. The name 'Monty' evoked several things.. most famous of them being the World War II hero General Montgomery who fought against the Germans/Italian occupation in North Africa. He was thus well known to schoolboys as comic book hero and was also found in propagandist epic movies of the 1960s and beyond. Monty was already an funny old fashioned name by 1960s in Britain. It was then already a jokey colonial sounding, British army sort of a name. For example see the brilliant film 'Withnail and I', which features an Uncle Monty in it. Much of Monty Python's innovative fast collage graphic animations were also based on cut-ups from Victorian and Edwardian postcards, memorabilia. There was a lot of this floating around in England in the 1960s. Antique markets were full of it. Popular poster graphics used it. Clothing used it and it was cheap and plentiful. The First World war itself produced a huge amount of jingoistic romantic propaganda.. one of the mass hallucinations which persuaded every young man in 1914 to go off to war, inspired by 'heroic' imagery. Thinking they would be home in few weeks, they all donned uniforms and marched off to the sound of brass bands music. They all died of course in the trenches in horrible endless quagmire. There was a famous musical called 'Oh What a Lovely War' later made into a film which captured this well also. The most famous poster of the era was also a fashionable clothing store on the King's Road in Chelsea named: "I was Lord Kitchener's Valet". Lord Kitcheners was a famous WW1 general. 'Monty Python' fitted perfectly against all this. It had just the right ring and the graphics gave it just the right spin. It was the first time anyone had seen that on mainstream TV. The First World war in England was particularly characterized by the silly ass officer class. They were real. Incredibly privileged left-overs from the aristocracy. Most of them died also. By the 60s, the mentality was by then a lingering ghost of a faded glory of British empire, with Vietnam etc, the quaint old whiskered general image from WW1 cam to represent the end of a madness - but at a safe distance. I lived next door to exactly an image of someone who might have been named 'Monty Python'. A retired army colonel who had spent most of his life in the army administration world of British India. We lived in Brighton, by the sea. Every morning he would appear, rain or shine. like clockwork at 8am to march down to the sea for his morning swim. He always wore nothing but his hat, goggles, shorts and sandals, his back straight as a board. The English weather is famous for being lousy, and the English Channel is very cold most of the year. He never faltered, never flinched, always maintaining stiff upper lip. The Victorian adn Edwardians were big promoters and especially Music Hall or Vaudeville characters would assemble names like Monty Python. So 'Monty Python's Flying Circus' was a sound familiar and plausible enough to its audience but clearly on the edge of some funny/ridiculous. It was one of the first TV comedy shows to play with surrealism. One of its best well known effects was that after the show ended, and regular TV programming continued, Monty Python seemed to contaminate every thing else.. 'Serious' TV appeared hilarious etc. Not hard to do, but they did it brilliantly. Cleese and Co. had all typical the BBC accents and mannerism down perfectly. One was not certain on occasion for a few seconds/minutes when the Python show had really ended, or whether they were pretending. The 'circus' part was also a large fantasy an public image which was being played out regularly. The Beatles had released 'Sergeant Pepper Lonely Hearts Club Band' and then a film and album 'Magical Mystery Tour'. 'Monty Python' rode on the tails of this, but added the more complex surreal anti-logic comedy and featured much tighter writing and direct satire of existing media, while the Beatles were just plain self-indulgent. Even the bad boy Rolling Stones played around with circus imagery and staged some TV shows.. Of course Python humor is brilliant and timeless. But it also had special edge and cultural context when it was written , and the name was a key part of this. - Jason From rlboloNOSPAM at libero.it Sun Nov 12 12:00:59 2000 From: rlboloNOSPAM at libero.it (Super Bolo) Date: Sun, 12 Nov 2000 17:00:59 GMT Subject: UCP (Universal Computer Protocol) References: Message-ID: Post Scriptum: i've found this doc www.d2privat.de/download/d2privat/ucp.pdf Lorenzo From vic at k-creations.com Mon Nov 6 15:17:59 2000 From: vic at k-creations.com (Vic Kelson) Date: Mon, 06 Nov 2000 15:17:59 -0500 Subject: isnan? isinf? Message-ID: <3A0711F7.99AB03B8@k-creations.com> Greetings, Is there a function in Python to check for NaN or Inf after a floating-point calculation? I know of the Numeric extension from Starship, but I need a test for a single floating-point value. THANKS, Vic. From hamish_lawson at yahoo.co.uk Sat Nov 4 13:42:21 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Sat, 04 Nov 2000 18:42:21 GMT Subject: Excel file format References: Message-ID: <8u1lad$nhb$1@nnrp1.deja.com> vonWedel at lfpt.rwth-aachen.de wrote: > I want to transform data into Excel files using Python You may be interested in looking at the Perl module Spreadsheet::WriteExcel for ideas, available at http://www.cpan.org/modules/by-module/Spreadsheet/Spreadsheet- WriteExcel-0.22.tar.gz According to its description: This module can be used to write numbers and text in the native Excel binary file format. Multiple worksheets can be added to a workbook. Formatting can be applied to cells. The Excel file produced by this module is compatible with Excel 5, 95, 97 and 2000. The module will work on the majority of Windows, UNIX and Macintosh platforms. Generated files are also compatible with the Linux/UNIX spreadsheet applications Star Office, Gnumeric and XESS. The generated files are not compatible with MS Access. Hope this helps, Hamish Lawson Sent via Deja.com http://www.deja.com/ Before you buy. From aleaxit at yahoo.com Mon Nov 6 06:11:19 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Mon, 6 Nov 2000 12:11:19 +0100 Subject: gmp module References: <8u5tua$rie$1@nnrp1.deja.com> Message-ID: <8u63v3025qg@news2.newsguy.com> "mary" wrote in message news:8u5tua$rie$1 at nnrp1.deja.com... > Hi, > is someone working on a python gmp module. Yes! I am. > The gmpmodule and mpz modules are too old and > are no longer maintained. Yep. That's why I started working on a new module (starting from gmpmodule sources), in particular in order to supply to PySymbolic speedy numerical support. Intended name 'gmpy'. http://gmpy.sourceforge.net has been granted, but I haven't uploaded anything to it yet (haven't had time to work on it over the last two weeks). The .C sources I currently have offer pre-alpha level support for mpz and mpf entities only (no mpq's yet). They do build on Windows, thanks to a binary GMP.LIB I've found on the net that supports Visual C++; I can only develop on Windows at this time, unfortunately. But Pearu Peterson, PySymbolic's author, kindly supplied the small fixes to make it work for him on his Unix machine, too. There is one known bug (perhaps with the GMP.LIB I'm using?) with the test-for-perfect-power function -- I don't know if it shows up on Unix, too. There are some design issues, such as -- should gmpy objects be immutable (for conceptual compatibility with builtin numbers) or mutable (for efficiency)? Should the whole module be built with C (for maximum portability and minimal binary-size) or C++ (e.g. py_cpp) for max programmer-productivity and to gain nice extras such as being able to inherit from the objects the module exports...? I intend to open discussion-lists on the sourceforge site, but feedback on this group is also welcome (most particularly since I _haven't_ yet set up the site in question...:-). Alex From hamish_lawson at yahoo.co.uk Tue Nov 7 04:25:54 2000 From: hamish_lawson at yahoo.co.uk (Hamish Lawson) Date: Tue, 07 Nov 2000 09:25:54 GMT Subject: what happened to sys.prefix in 2.0? References: Message-ID: <8u8hqu$1v7$1@nnrp1.deja.com> I have also encountered some strangeness with sys.prefix, at least under Windows. I have Python installed on Windows in C:\Python. I copied python.exe to in C:\usr\bin for CGI scripts running under Apache (Apache for Windows uses the script's #! line). If I enter 'python' at the command line I get the executable in C:\Python and sys.prefix gives me 'C:\\Python'. However if I run C:\usr\bin\python, sys.prefix gives me ''. Hamish Lawson Sent via Deja.com http://www.deja.com/ Before you buy. From brendhanhorne at bellsouth.net Tue Nov 7 17:23:35 2000 From: brendhanhorne at bellsouth.net (Brendhan Horne) Date: Tue, 7 Nov 2000 17:23:35 -0500 Subject: Accessing Hello World References: Message-ID: That didn't do it. >>>hello.py error >>>python hello.py Thanks, Brendhan error So from the command line prompt it won't open Hello, World ! What the heck am I doing wrong here.? -- Thanks, Brendhan From aleaxit at yahoo.com Tue Nov 7 10:40:17 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 7 Nov 2000 16:40:17 +0100 Subject: How can I tell when a string is in fact a number? References: <4a8zqyqxqv.fsf@kern.srcf.societies.cam.ac.uk> <8u45fo015ql@news1.newsguy.com> <4an1fde6as.fsf@kern.srcf.societies.cam.ac.uk> <4aem0pe3rn.fsf@kern.srcf.societies.cam.ac.uk> <8u6aiu02bs8@news2.newsguy.com> <3a0707bc_3@corp.newsfeeds.com> Message-ID: <8u97pd01ukh@news1.newsguy.com> "Joshua Muskovitz" wrote in message news:3a0707bc_3 at corp.newsfeeds.com... > Thanks for all the timing benchmarks. This is effectively the only response > I've seen to my "why bother with re at all?" question, when I posted a much > more readable solution which only used filter and lambda. Also, thanks for I guess it's an issue of "readable to WHO?"-). re.match(r'[0-9]*$', str) or the equivalent re.match(r'\d*$', str) are quite readable if one understands even the basics of RE -- any old-time user of VI, for example (but most good/powerful editors today give you a modicum of RE's -- hey, even Microsoft Visual Studio on Windows does!-). OTOH, lambda and reduce (there was no use of filter in the solution you had posted) are somewhat more mysterious to many users - even the fact that, say: x and y in string.digits parses as x and (y in string.digits) and not as (x and y) in string.digits may cause head-scratching in some quarters:-). Btw, I don't think there _was_ any presented solution using filter, though it IS in fact a pretty natural approach...: def isanum(str): return not filter(lambda x: not x in string.digits, str) > summarizing all of the intersting ways of solving this. The map solution > never would have occurred to me. Python just gets better and better! You're welcome!-) Although some would object to characterizing the fact that "there's more than one way to do it" as a good thing (there's another scripting-language-starting-with-P that seems to have cornered _that_ niche of the market, I guess:-). Alex From andyheath at linuxstart.com Wed Nov 1 12:59:56 2000 From: andyheath at linuxstart.com (Andy Heath) Date: Wed, 1 Nov 2000 12:59:56 -0500 Subject: How do you create constants? Message-ID: <200011011759.eA1HxuQ20413@tbird.iworld.com> An embedded and charset-unspecified text was scrubbed... Name: not available URL: From aahz at panix.com Sun Nov 5 10:44:30 2000 From: aahz at panix.com (Aahz Maruch) Date: 5 Nov 2000 07:44:30 -0800 Subject: Python threads References: <3A04A638.A106A55F@tin.it> Message-ID: <8u3v8u$6uq$1@panix3.panix.com> In article <3A04A638.A106A55F at tin.it>, ADSL wrote: > >Now the matter. I've hadn't understand the way python manages threads. >I'm looking for a decent tutorial the threading module, or at least >some piece of code on the subject, any hint? I'm going to finish writing a tutorial Real Soon Now. In the meantime, try this sketch at http://starship.python.net/crew/aahz/ -- --- Aahz (Copyright 2000 by aahz at pobox.com) Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/ Hugs and backrubs -- I break Rule 6 "I have the heart of a child. I keep it in a jar on my desk." --Robert Bloch From jhvanandel at my-deja.com Mon Nov 6 11:14:48 2000 From: jhvanandel at my-deja.com (jhvanandel at my-deja.com) Date: Mon, 06 Nov 2000 16:14:48 GMT Subject: Overview over graphics packages References: <8touul$cob@news.Informatik.Uni-Oldenburg.DE> <87hf5rj4y7.fsf@lisboa.ifm.uni-kiel.de> Message-ID: <8u6ldf$e05$1@nnrp1.deja.com> You may also want to consider gnome-python (http://www.daa.com.au/~james/gnome/) with python-gtkextra. A 3D plot widget has just been added to gtkextra, but I don't know if the Python bindings are complete yet. Sent via Deja.com http://www.deja.com/ Before you buy. From aleaxit at yahoo.com Sat Nov 11 19:10:51 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 12 Nov 2000 01:10:51 +0100 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0DA05A.7A5DCDE5@alcyone.com> <3A0DCD27.1B2D7416@alcyone.com> Message-ID: <8ukn8d017vc@news2.newsguy.com> "Erik Max Francis" wrote in message news:3A0DCD27.1B2D7416 at alcyone.com... > Courageous wrote: > > > As an aside, in retrospect, I wish this weren't true. It would have > > been > > nice to be able to define variables like-this, or like-this? or > > *like-this*. > > Huh? Dylan (and LISP-based languages; Ruby, too, I think; I don't know about others) let you put all sort of funky characters in identifiers. It IS sort of nice to be able to name all predicates ending with '?', all functions-which-modify-args ending with '!', etc. The price you pay for that is that you have to put spaces in LOTS of spaces where they are not needed in "run-of-the-mill" languages (such as Python) that severely restrict the set of characters usable in identifiers. a+b this would be an identifiers, so a + b is what you must write for addition etc, etc. (LISP-ish syntax is different -- if no infix operators exist, the space-around-operators issue of course disappears:-). I guess this is what Courageous was perhaps referring to... Alex From softwareuwantdotcom at my-deja.com Thu Nov 16 23:01:15 2000 From: softwareuwantdotcom at my-deja.com (softwareuwantdotcom at my-deja.com) Date: Fri, 17 Nov 2000 04:01:15 GMT Subject: Web Advertisement Message-ID: <8v2ai9$lf5$1@nnrp1.deja.com> We have a web site that is just starting out to help on programming requests, where users are looking for specific programming needs or specific programs and off the shelf applications are not an option. In the future go to http://www.softwareuwant.com or http://www.codeuwant.com and complete the form to list your request there. Why beat around for days, when you can buy the program or code you want. Besides, don't you just hate getting flamed for asking pro's to do your homework for you :) We are starting to generate more and more activity as the development community learns more about this site and this business model. Thanks! Kentfitz at softwareuwant.com Sent via Deja.com http://www.deja.com/ Before you buy. From parkw at better.net Thu Nov 16 17:42:29 2000 From: parkw at better.net (William Park) Date: Thu, 16 Nov 2000 17:42:29 -0500 Subject: fastmath library? In-Reply-To: ; from annis@biostat.wisc.edu on Thu, Nov 16, 2000 at 03:18:33PM -0600 References: <8v1gbc$33n$1@la-mail4.digilink.net> Message-ID: <20001116174229.A629@better.net> On Thu, Nov 16, 2000 at 03:18:33PM -0600, William Annis wrote: > "Pete Shinners" writes: > > > one that uses high-speed lookup tables and estimates for > > low quality results? i'd mainly like one that can handle > > things like square-root, cosine, etc, etc > > This lookup-don't-compute behavior is sometimes called > memoizing. > > > i figure there's got to be something like this already > > available for python? > > Well I've written the little memoizing class below. I'm not > sure the overhead will help you in the case of sine and cosines, but > certainly will for more complex functions: ... > Basically, it keeps a dictionary of arguments. When it has > seen the arguments before, it just looks up the data. When they're > new, it does the computation. So, this is only helpful when you're > calling the memoized function a lot. I would think that the class attribute lookup would be slower than calling C math function. This would defeat the original question for speed. For speed, write the table lookup or approximation in C. ---William Park, Open Geometry Consulting From dsh8290 at rit.edu Sat Nov 4 15:56:48 2000 From: dsh8290 at rit.edu (D-Man) Date: Sat, 4 Nov 2000 15:56:48 -0500 Subject: Python Lists -> C arrays? In-Reply-To: <3A032E29.1000F079@srl.css.mot.com>; from mikeb@srl.css.mot.com on Fri, Nov 03, 2000 at 16:29:13 -0500 References: <3A032E29.1000F079@srl.css.mot.com> Message-ID: <20001104155648.C29814@dman.rh.rit.edu> If you're writing C code, that should be easy. The algorithm would be to malloc an array of size "len( mylist )". Then iterate through the list copying the values to the array. Or perhaps populating the array with pointers to the PyObjects in the list (and maintaining the correct ref count). -D On Fri, 03 Nov 2000 16:29:13 Michael Brown wrote: | Hi. | | I've been looking at the python extension features and noticed that | Python has an easy way to convert integer elements in C | into a python list using the Py_BuildValue function. Is there an easy | way to do this in reverse, say to convert Python lists | (not tuples) into C arrays (strings, int, float)? | | Thanks. | | Mike | | -- | Michael F. Brown | email: mikeb at srl.css.mot.com | | | | | | Hi. |

I've been looking at the python extension features and noticed that | Python has an easy way to convert integer elements in C |
into a python list using the Py_BuildValue function.  Is there | an easy way to do this in reverse, say to convert Python lists |
(not tuples) into C arrays (strings, int, float)? |

Thanks. |

Mike |

-- 
 |         Michael F. Brown
 |         email:  mikeb at srl.css.mot.com  
 | 
|   | From not.this at seebelow.org Wed Nov 8 16:32:12 2000 From: not.this at seebelow.org (Grant Griffin) Date: Wed, 08 Nov 2000 21:32:12 +0000 Subject: parsing windows resource scripts References: <3A087199.CF2782DB@seebelow.org> <3A099A97.DBB03CC1@iit.demokritos.gr> Message-ID: <3A09C65B.B93998EA@seebelow.org> Vassilis Virvilis wrote: > > Grant Griffin wrote: > > > > - Does anybody know where I can find a grammar that describes Windows > > resource scripts? (I have a reference book for this but not a > > "grammar".) > > > > If you take a look into the WINE project http://www.winehq.com they > implement something called wrc which is a resource compiler actually. I > assume that having the grammar defined in a yacc file it is sufficient > for you. > > .Bill Thanks for the tip, Bill--I'll look into it. I've also just found one in GNU's "binutils" package. now,-if-only-i-fully-understood-yacc-and-lex--ly y'rs, =g2 -- _____________________________________________________________________ Grant R. Griffin g2 at dspguru.com Publisher of dspGuru http://www.dspguru.com Iowegian International Corporation http://www.iowegian.com From szee at corp.nl.home.com Fri Nov 10 10:30:15 2000 From: szee at corp.nl.home.com (Siebren van der Zee) Date: Fri, 10 Nov 2000 15:30:15 GMT Subject: Want to inherit from file References: <8ugjuk$daf$1@newsreaderm1.core.theplanet.net> Message-ID: <3A0C13D2.C1738D9A@corp.nl.home.com> Franz GEIGER wrote: > > I'd like to inherit from file to add some functionality: > > As a file object comes into existence by calling f=open() and not something > like f=File(), I guess there is no regular way to do it. > > Any idea how to overcome this? How about first implementing File as a wrapper around open() yourself? class File: def __init__(self, name, mode = 'r'): self._fileobj = open(name, mode) def readline(self): return self._fileobj.readline() def readlines(self): return self._fileobj.readlines() def close(self): return self._fileobj.close() def allTheOthers(): ... -- Siebren van der Zee, @Home Benelux BV Email: szee at corp.nl.home.com Telno: +31 (0)20 8855746 http://www.home.nl/ From fredrik at effbot.org Tue Nov 7 14:31:41 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Tue, 07 Nov 2000 19:31:41 GMT Subject: Caller's frame, was: Re: Q: Interactive input References: Message-ID: Jan Kybic wrote: > OK, thanks. But how do I make a function out of it? Imagine I want to > replace the five lines above with a call to one function, keyboard(). > In this function, how do I retrieve the caller's frame, to pass it to > exec, so that it has access to the variables at the level where > keyboard() was called from? I looked in the documentation and could > not find anything, so I would be grateful for any pointers. throw an exception and examine the traceback stack (either directly or via traceback.extract_tb()). btw, the easiest way to accept commands is to use the stuff in the code module: def keyboard(): import code, sys try: raise None except: frame = sys.exc_info()[2].tb_frame.f_back code.interact(local=frame.f_locals) From claird at starbase.neosoft.com Wed Nov 8 10:17:25 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 8 Nov 2000 09:17:25 -0600 Subject: huge persistent dictionary References: Message-ID: <422211FB49B6B3C9.25C2FA760F0C6B89.A45DFCCC7D0C840C@lp.airnews.net> In article , Quinn Dunkan wrote: >On Tue, 07 Nov 2000 13:05:10 -0000, gunter wrote: >>Hello! >> >>My Problem is, that I want to store an huge amount of data in an >>dictionary and to make it persistent. >... >Others have made some good suggestions, but I'd recommend you try marshal >first. It only works on primitive types, but it's faster than cPickle. And >it's essentially the same as your import trick (it writes and reads python >bytecode), delta the huge intermediate file. > >still-waiting-for-someone-to-post-a-mmap-solution-ly y'rs At least four people have said, "Use the D database", for four different values of D. As Mr. Dunkan solicited a mmap() solution, I'll counter with MetaKit . While less widely known than the other alternatives suggested, it tends to inspire wild enthusiasm in its users. Salient features: it's Python-friendly, memory-based, documented as handling gigabytes with high performance, and well-maintained. -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From fiona at sitegnome.com Wed Nov 29 08:00:28 2000 From: fiona at sitegnome.com (Fiona Czuczman) Date: 29 Nov 2000 13:00:28 -0000 Subject: [FAQTS] Python Knowledge Base Update -- November 29th, 2000 Message-ID: <20001129130028.20409.qmail@synop.com> Hi Guys! The updates for November into http://python.faqts.com regards, Fiona ## Unanswered Questions ######################################## ------------------------------------------------------------- How do i add an ORBit interface to my python application to permit querying from a CGI script? http://www.faqts.com/knowledge-base/view.phtml/aid/6696 ------------------------------------------------------------- Slimy ------------------------------------------------------------- How do I dial ISP(ppp) from python? http://www.faqts.com/knowledge-base/view.phtml/aid/6535 ------------------------------------------------------------- Rick Barnich ------------------------------------------------------------- Is there a startup.py or autoexec.py for pythonwin. http://www.faqts.com/knowledge-base/view.phtml/aid/6445 ------------------------------------------------------------- steve t ## New Entries ################################################# ------------------------------------------------------------- What IDEs, debuggers, and other development tools are available for Python? http://www.faqts.com/knowledge-base/view.phtml/aid/6433 ------------------------------------------------------------- Stephan Deibel There are a number of options for those that want to go beyond the basic debugging tools that come with Python itself, or want more than the commonly used text editors like emacs or vi: Commercial 1) http://www.wingide.com/wingide -- Wing IDE provides a graphical debugger with remote debug capability, source module and class browser, source editor with autocompletion, syntax hilighting and an emacs mode, and a project manager. 2) http://www.pythonworks.com -- PythonWorks is a rapid application development environment with editor, debugger, TkInter-based user interface layout tools, and deployment manager. 3) http://www.activestate.com/Products/VisualPython.html -- VisualPython is a plug in for Microsoft's development environment, Visual Studio 7. Open Source 5) http://www.python.org/windows/pythonwin/ -- PythonWin is a Python distribution specifically for Microsoft Windows that includes support for MFC development, and a graphical environment with source editor, command shell, and a number of other features. 6) http://www.python.org/idle/ -- IDLE is a TkInter-based integrated development environment for Python, currently in early release form. 7) http://boa-constructor.sourceforge.net/ -- Boa Constructor, a rapid application development environment with WXPython-based GUI development capabilities, currently in (very?) early release form. ------------------------------------------------------------- How do you POST data to an HTTPS: server? Any examples? http://www.faqts.com/knowledge-base/view.phtml/aid/6511 ------------------------------------------------------------- Jose Correia I have managed to find an answer myself to this question. This is a solution for the Windows environment. It involves using COM and MSIE and requires no manual handling of either SSL or cookies, etc. It's really painfully easy once you get pointed in the right direction. My special thanks to Michal Wallace whose newsgroup posting a while back answering someone else's question helped get me on the right track. (some parts below are cut directly from his posting). Instructions: 1) Install Win32 extensions. 2) Once you have them installed: - open pythonwin - load the "COM Makepy utility" under the Tools menu - in the window that pops up, double click on: "Microsoft Internet Controls" This generates a magical python module for you... 3) Now, in the python window, type: >>> from win32com.client import Dispatch >>> ie = Dispatch("InternetExplorer.Application") >>> ie.Visible = 1 #Shows you the window so you can see what's happening. >>> ie.Navigate("https://www.suretrade.com/cgi-bin/login") #The URL (secure or otherwise) you want to get to, this one used as an example is my online broker's secure URL. ... Well, it shows up in the browser... But how to get the text? "Tools/COM Browser" "Registered Type Libraries" "Microsoft Internet Controls" "Type Library" "IWebBrowser2" Hmmm. That seems to show a bit more info, but we still don't know what to do with it.. Let's go to msdn and see if we can look that control up... Here it is: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/I WebBrowser2/IWebBrowser2.asp 4) Looks like we want the "get Document" thing. Back to python. >>> ie.Document Cool! >>> doc = ie.Document According to the MSDN docs, this is just a normal DHTML document object. For a list of controls and things you can do with this go to: http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_do cument.asp >>> doc.url 'https://www.suretrade.com/cgi-bin/login' >>> print doc.body.innerHTML [it works!] doesn't print the WHOLE HTML document, granted, just the body.. but you can basically script it as if it were client side DHTML because you're using the same engine. You may not need to grab it.. Huh. 5) Now to enter the data into the required fields: >>> doc.LoginForm.UserID.value="Jabba" A few notes here. LoginForm is the NAME of the form, UserID is the NAME of the INPUT field in the form, value is the actual value in the field. Flip to you browser and you'll see the text magically appear in the input fields in the browser. To get the values from the field just refer to it: >>> doc.LoginForm.UserID.value 'Jabba' >>> doc.LoginForm.Passwd.value="password" (what else?) >>> doc.LoginForm.destination.value = "/cgi-bin/order?action=Stock&" This just sets an optional value in the dropdown box. 6) Now submit the form data: >>> doc.LoginForm.submit() And you're at the next screen, all logged on and ready to party! 7) Finally, to get rid of it: >>> del doc # Kills the object. >>> ie.Quit() # Kills the browser session. You'll have to put in checks to verify whether the page is fully loaded (i.e. if doc.readyState == 'complete':) before submitting data and so on to make it more robust, but as a way of actually getting connected with results I think this should help anyone get started. HTH any other newbies to Python/COM/web programming/etc (like me). ## Edited Entries ############################################## ------------------------------------------------------------- Is there a Python MySQL module for use under Windows? http://www.faqts.com/knowledge-base/view.phtml/aid/4188 ------------------------------------------------------------- Fiona Czuczman, Gerhard Haering Stefan Franke,Steve Cook You will find a version of MySQLdb (version 0.2.2) compiled for Win32 at http://home.t-online.de/home/err666/ It works fine for me connecting to MySQL 3.23/Win2k and MySQL 3.22/Linux. Now, you will also find a brand-new version of MySQLdb 0.3.0b2 for Python 2.0 there. Please give me feedback at haering_pythongmx.de wether these builds work for you. ------------------------------------------------------------- Why are there no operators equivalent to C's , --, =, etc.? http://www.faqts.com/knowledge-base/view.phtml/aid/3378 ------------------------------------------------------------- Fiona Czuczman, Dave Brueck Fredrik Lundh, Peter Schneider-Kamp, Michael Hudson if you write things like "var = var + 1" a lot, you might be missing some important python idioms... here are a few, in no specific order: for item in sequence: ... sequence = map(operation, sequence) sequence.append(item) for index in range(size): ... for item1, item2 in map(None, sequence1, sequence): ... for index in range(start, stop, step): ... n = sequence.count(item) for index in range(len(sequence)): ... sequence.remove(item) for index in range(len(sequence)-1, -1, -1): ... (also note that most basic types are *immutable*, so it's not entirely clear how things like ++ and += should work. Michael Hudson wrote a patch for the +=, -=, *=, /= and some other of these operators. A patch can be found at: http://starship.python.net/crew/mwh/aug-patch.html http://www-jcsu.jesus.cam.ac.uk/~mwh21/aug-patch.html As of Python 2.0, the above operators are officially part of the language. ------------------------------------------------------------- How does assignment work in Python? http://www.faqts.com/knowledge-base/view.phtml/aid/1334 ------------------------------------------------------------- Nathan Wallace, Dave Brueck, Fiona Czuczman Fredrik Lundh In many programming languages, a variable is a small region of memory in which you can put things of a given type. However, in Python, a variable is a name which can point to any existing object. Variables don't have types (but objects do). When you assign a new object to a variable, you just change the name so it points to the new object. The old object is not affected by this (in fact, it doesn't even notice, unless the assigment means that nobody cares about the object anymore, in which case it's destroyed) Python 2.0 now supports augmented assignment, which lets you do stuff like: x += 1 instead of x = x + 1 This has two subtle differences from the longer type of assignment: (1) In augmented assignment, x is evaluated only once (2) When possible, augmented assignment performs the operation in- place, which means that instead of creating a new object to hold the new result, the existing object is modified. ------------------------------------------------------------- How do I find the byte length of a float, double or an int? Are all standard python float, double, ints, etc of a fixed format? http://www.faqts.com/knowledge-base/view.phtml/aid/2638 ------------------------------------------------------------- Fiona Czuczman, Dave Brueck Tim Peters You can't find the byte length short of reading the source code. A Python float is a C double. Python doesn't have a double type. A Python int is a C long. Every Python object also comes with some amount of object hair, like a refcount and a pointer to its type object ... again, you have to read the source to get the full story. *But*, if you're interested in byte length because you want to send the data as a network message or if you want to store data in a file or array and calculate an offset into that array, you can use the struct module, which lets you pack data into a string of bytes. You can optionally tell it to put the bytes in network order so that it will work on any platform, and you can also use the struct.calcsize method to see how much space the packed version will use. There is also the array module for storing homogeneous data, and it has an itemsize method, but the value returned can vary by platform. From aleaxit at yahoo.com Sun Nov 19 03:39:00 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 19 Nov 2000 09:39:00 +0100 Subject: ANN.: Beta 1.0 of Weak Reference Extension Module is nowavailable References: <8usorp$3i3$1@nnrp1.deja.com> <8uvjmj$dt8$1@nnrp1.deja.com> <3A176E0F.39BF350B@felinity.com> Message-ID: <8v83rj01fou@news1.newsguy.com> "Karsten Schneider" wrote in message news:3A176E0F.39BF350B at felinity.com... [snip] > However, I have a question about the implementation. The way I understand it, > it hooks into Python's [de-]allocation mechanism to make sure weak references > don't point to objects that no longer exist. Does this require a search > through all the weak references for each deallocation? If so, that sounds > like a new performance problem. No! Only objects that are subject to weak-referencing get their deallocation-function hooked; there is no overhead for all other deallocations. Alex From scherrey at switchco.com Wed Nov 15 14:04:19 2000 From: scherrey at switchco.com (Benjamin Scherrey) Date: Thu, 16 Nov 2000 00:04:19 +0500 Subject: Python as an alternative to JavaScript? Message-ID: <8uvmua01vfa@news2.newsguy.com> I'm very interested in some kind of web-browser plugin that would allow me to embed Python into a webpage like one can currently do with JavaScript. Does such a thing exist and, if not, what kind of effort would be involved to implement such a thing? Are there any major sticking points? My platforms of choice are Netscape/Explorer under Windows and Netscape under Linux. thanx & later, Ben Scherrey From syver.enstad at sensewave.com Sun Nov 5 19:54:48 2000 From: syver.enstad at sensewave.com (Syver Enstad) Date: Mon, 6 Nov 2000 01:54:48 +0100 Subject: Newbie, whitespace trouble References: <8u4mme$sp6$1@troll.powertech.no> Message-ID: <8u79hi$u0j$1@troll.powertech.no> "William Park" wrote in message news:mailman.973463715.24501.python-list at python.org... > This is editor problem, not Python's. In vim, I do 'set paste' before > pasting, and 'set nopaste' after. Thank you, but I don't use vim. >Also, make sure your is 8 > spaces. Won't this indent far too much? From peter at engcorp.com Sun Nov 19 10:16:37 2000 From: peter at engcorp.com (Peter Hansen) Date: Sun, 19 Nov 2000 10:16:37 -0500 Subject: What is Python? References: <39C92845.10D86E5D@seebelow.org> Message-ID: <3A17EED5.6E038529@engcorp.com> Nick Bensema wrote: > > I looked at Perl and thought, "man, this is confuzling. This is like > no programming language I know. And like all of them. It's nuts." > Then I heard about how Mr. Wall modeled it on human language, and > suddenly it all made perfect sense. Perl is the computer equivalent > of English, in a historical sense. > > In contrast, Python looks to me like Esperanto. It's meant to give > everyone equal footing, and be easy to learn and dive right into, > while at the same time it can be wordy and cumbersome. (Like I haven't extended enough threads with "Esperanto" in them yet. :-) It sounds like you are implying Esperanto can be "wordy and cumbersome", a charge I've never heard until now. Esperanto is generally considered quite compact, and definitely not cumbersome. Its flexible word ordering and agglutinative nature (allowing word meanings to be modified in a consistent manner using affixes, in the manner of English tacking "ly" on the end of things to make them adverbs) are key features making it neither wordy nor cumbersome. Esperanto can be slightly longer than English, when measured character for character, but shorter than French. When examined from the point of view of a syllable being the basic unit of "cumbersomeness", Esperanto beats out both, if I recall correctly (but only just slightly... English is *quite* compact). I'm the first to agree with the comparison of Python to Esperanto, however, having subjected the good-natured occupants of c.l.p to that claim in several other threads. And they still let me in here (but only just barely, I think.) ;-) From ssthapa at harper.uchicago.edu Sat Nov 11 17:39:53 2000 From: ssthapa at harper.uchicago.edu (Suchandra Thapa) Date: Sat, 11 Nov 2000 22:39:53 GMT Subject: CODING and CROSS PLATFORM References: <3a078743@mega.ultra.net.au> <8u8id601i1t@news2.newsguy.com> <1ejxkal.8e6eeh1y65jdrN@paris11-nas2-43-65.dial.proxad.net> Message-ID: Fran?ois Granger wrote: >Alex Martelli wrote: > >> wxWindows (and wxPython) is my candidate for this role. wxWindows is >> a GUI-and-other-crossplatform-stuff framework, main/original author >> Julian Smart, coded in C++; I've seen it work excellently on Linux >> and Win32, and I'm told it's now just as good on Mac and BeOs (but I >> have no first hand experience of either of those, sorry). > >Searching on the site confirm that there is no Mac version available. wxWindows appears to have a functioning port on the mcac although it is an earlier version. The latest version has a beta, although I'm not sure how much of it is functioning. I don't thin wxPython has a mac version yet although that may appear. -- ------------------------------------------------------------------ | Suchandra Thapa | "There are only two kinds of math books. s-thapaNO at SPAMuchicago.edu | Those you cannot read beyond the first | sentence, and those you cannot read | beyond the first page." | -C.N. Yang ------------------------------------------------------------------ From junaftnoon at nospamplzyahoo.com Fri Nov 3 15:08:26 2000 From: junaftnoon at nospamplzyahoo.com (June Kim) Date: Sat, 4 Nov 2000 05:08:26 +0900 Subject: Benefits of continuation? References: <8ttral$o5t$1@nnrp1.deja.com> <8tu4do$vq9$1@nnrp1.deja.com> Message-ID: <8tv61a$gmt$1@news.nuri.net> "Courageous" wrote in message news:ar160tcnr3vdocehs12rg7u53tfhjohdhl at 4ax.com... > > >I think this remark above is very true. Context switches was the very > >first brain wave I had. Makes me wonder whether continuation actual ever > >will be used directly. Indirect usage ("under-water", hidden, etc.) > >seems more likely. > > Right. You have to understand that they are a very useful > mechanism upon which you can build alternate flow-control > constructs. I personally use them for context-switching in a > simulation I wrote. They are, ah.... VERY VERY FAST. > Could I have a look at some snippets of examples to get the feeling of how it works in reality? It would be really nice 'cause reading those rather abstract documents gives me only vague images of the castle in the air. Best regards, June. > An attempt to do the same thing in Java would cause the > JVM to die a horrible death with 1/10th the thread-load. > > > > C// > > > > From rgruet at ina.fr Sat Nov 11 12:17:41 2000 From: rgruet at ina.fr (Richard Gruet) Date: Sat, 11 Nov 2000 18:17:41 +0100 Subject: How to kill a thread from another thread ? References: <3A0A6715.35C19F47@ina.fr> <8uegli$bjf$1@panix6.panix.com> <8FE925FB2rcamesz@127.0.0.1> Message-ID: <3A0D7F35.AD33C83D@ina.fr> Robert Amesz wrote: > Aahz Maruch wrote: > > >In article <3A0A6715.35C19F47 at ina.fr>, Richard Gruet > > wrote: > >> > >>Does someone know how to kill a Python thread from another Python > >>thread (in the same process) ? > > > >You don't. You need to set up each of your threads so that they > >look for some kind of signal to kill themselves (which means > >returning). It has been argued that the ability to kill threads is > >necessary for server applications, but I haven't seen any powerful > >arguments in favor of that. > > How about doing blocking I/O in a thread? If something goes wrong the > thread might block forever. Anticipating the response: "So don't do > blocking I/O", I'd like to add that you may not have that option, > because the blocking call could be in another module which you need to > use but didn't write yourself > If Python uses non-blocking I/O internally, *and* it had the ability to > raise exceptions in another thread you would have a very powerful > mechanism to kill threads and still have a thread clean up after itself > (which is, I think, the most powerful argument against having threads > kill each other). In my particular case, I want to kill the thread from the thread which created it when something is going wrong (e.g. a timed out I/O) and furthermore I performed the cautious operation in a separate thread precisely to be avoid getting stuck in case of problem. To me this is a good reason to want to kill a thread in this case. I agree that *usually* killing a thread without clean-up is not a good policy! This leads me back to my original question: how can I do that (and in a portable way) ? Apparently there is no obvious solution. To use a separate process to execute an operation is quite inefficient (although in this case I know how to kill the process). Richard Gruet From peter at engcorp.com Mon Nov 6 23:36:20 2000 From: peter at engcorp.com (Peter Hansen) Date: Mon, 06 Nov 2000 23:36:20 -0500 Subject: Red/Green Bars References: <8t6umj$qma$1@clematis.singnet.com.sg> <8u73pc$6vh$1@gaia.cdg.acriter.nl> Message-ID: <3A0786C4.AAC52096@engcorp.com> Alex wrote: > > What's a red/green bar for? > > Alex. In Canada it's probably a place that serves Moosehead beer and has plenty of duct-tape holding the joint together. But you'd probably have to be a fan of a particular comedy show on the CBC to know what I'm talking about. (But no, this doesn't have anything to do with the "I Am Canadian" rant. :-) -- Peter Hansen From timr at probo.com Wed Nov 15 01:21:13 2000 From: timr at probo.com (Tim Roberts) Date: Tue, 14 Nov 2000 22:21:13 -0800 Subject: Precise timing in Python? References: <8uqu4s$acb$1@newstoo.ericsson.se> Message-ID: <2ja41tc1p4kq1lbhed95qmcsgp8vlmepko@4ax.com> "Bror Johansson" wrote: > >I'm considering to use Python for an application that shall - among other >things - stimulate some external equipment (via an I/O-card on the PCI-bus) >with a frequency of 10 Hz. > >This frequency should be kept very close to 10 Hz, i.e. in the long run (~10 >hours or so) it must average to 10 +- 0.05 Hz. > >The 'distance' between any two consecutive 'ticks' shall be 0.1 +- 0.03 >seconds. > >I think signal.alarm() is not good enough, is it?. > >Could 'stackless python' with microthreads be a viable option? > >Are there any other possibilities, or do I have to abandon Python for this >application? Python is not your problem. The problem is the underlying operating system. Most of the operating systems on which Python runs have no performance guarantees at all. This includes Linux and Windows. If a failure to maintain your specifications results in damage or injury (and given your domain -- esavionics.se -- I'm guessing it might), then you need to investigate real-time operating systems, or at least real-time extensions. You're asking for 0.5% accuracy. Even the crystal oscillators on the average motherboard do not maintain that accuracy. If you really need 10 +/- 0.05 Hz average, then you should be using a piece of hardware with a timebase of known precision. -- - Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. From knightsofspamalot-factotum at mail1.stofanet.dk Mon Nov 13 02:03:47 2000 From: knightsofspamalot-factotum at mail1.stofanet.dk (Martin Christensen) Date: 13 Nov 2000 08:03:47 +0100 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> Message-ID: <87snowl5f0.fsf@fangorn.stofanet.dk> >>>>> "Jim" == Jim Richardson writes: Jim> At the risk of being flamed to a crisp, can I whineingly point Jim> out that you misspelled hypocrisy? :) Yes, but I get 'they're' and 'their' right _every_ time. How many natives do that? Martin -- GPG public key: http://home1.stofanet.dk/factotum/gpgkey.txt From grante at visi.com Tue Nov 14 15:40:08 2000 From: grante at visi.com (Grant Edwards) Date: Tue, 14 Nov 2000 20:40:08 GMT Subject: Lost at C References: Message-ID: In article , Bruce Dodson wrote: >"Daniel Klein" wrote > >> Do you have to learn C to use Python? > >Definitely not. It helps with a few advanced aspects, such as >moving performance-critical functionality out to a C extension >module. For the great majority of Python develpment, it is >just not needed. While knowlege of C isn't needed, it is *occasionally* useful to be familiar with the standard C library routines. Many of the CPython library routines are influenced by the underlying C library routines -- and they're available on most platforms with a thin Python wrapper. I wouldn't worry about it though. It won't matter unless you get into doing low-level, platform-specific tricks. -- Grant Edwards grante Yow! Hold the MAYO & pass at the COSMIC AWARENESS... visi.com From yann at winwise.fr Wed Nov 8 13:02:10 2000 From: yann at winwise.fr (Yann Schwartz) Date: Wed, 08 Nov 2000 18:02:10 GMT Subject: Python for ASP References: <8u8r16$86i$1@nnrp1.deja.com> <3a083021.1320581896@news.iway.fr> Message-ID: <3a099440.1411749007@news.iway.fr> On Tue, 07 Nov 2000 21:50:47 GMT, "Arturo P?rez Mulas" wrote: >> >2) I request login to access to my pages via an NT net server. Is the >> >login name stored somewhere in the ASP jungle? >> The login is a user defined on the NT Web Server (or on the domain the >> server is). So to authenticate on it, you need to provide a valid >> login/pwd corresponding to a user in the nt box. > >Ok! Let's say a user is properly authenticated by the NT domain server, >and get access to my pages. Is there any way to know what his login >string is? Yes, there is with Request.ServerVariables("AUTH_USER") or Request.ServerVariables("LOGON_USER") (which are basically the same in this context) You get the login in the form "domain\user" >From this login, you can query the corresponding first name, last name, etc. using the WinNT provider for ADSI (and ADSI, of course). From rlboloNOSPAM at libero.it Mon Nov 6 07:25:10 2000 From: rlboloNOSPAM at libero.it (Super Bolo) Date: Mon, 06 Nov 2000 12:25:10 GMT Subject: [Newbie] - First Help References: <8u4qbj$65p$1@news.udel.edu> Message-ID: Thank You... Lorenzo From hzhu at users.sourceforge.net Wed Nov 1 17:05:19 2000 From: hzhu at users.sourceforge.net (Huaiyu Zhu) Date: Wed, 01 Nov 2000 22:05:19 GMT Subject: Rounding Bug in Python 2.0! - ugh References: Message-ID: On 01 Nov 2000 14:39:05 +0000, Pete Forman wrote: > >It would be nice if Python would make use of dtoa() rather than stock >sprintf() to display floating-point numbers. There are variants of >dtoa in netlib and libg++. Some simple examples of what dtoa do differently? Huaiyu From ahopkins at dynacare.com Tue Nov 21 17:01:09 2000 From: ahopkins at dynacare.com (Albert Hopkins) Date: 21 Nov 2000 16:01:09 -0600 Subject: starship status? References: <3dpujqibh2.fsf@kronos.cnri.reston.va.us> Message-ID: On 20 Nov 2000 16:23:53 -0500, Andrew Kuchling wrote: >ahopkins at dynacare.com (Albert Hopkins) writes: >> Does anyone know when starship.python.net will be available (for >> login) again? > >It should be available now, but you have to ssh to port 10022, not the >default ssh port. Try 'ssh -p 10022 @starship.python.net'. I get a 'connection refused' for that port. >--amk > -- Albert Hopkins Sr. Systems Specialist Dynacare Laboratories ahopkins at dynacare.com Prosperity is a great teacher; adversity a greater. -William Hazlitt -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From vasvir at iit.demokritos.gr Wed Nov 22 14:53:17 2000 From: vasvir at iit.demokritos.gr (Vassilis Virvilis) Date: Wed, 22 Nov 2000 21:53:17 +0200 Subject: parsing w spark References: <3A1A154B.9D99951@iit.demokritos.gr> <14874.13974.496653.211828@beluga.mojam.com> Message-ID: <3A1C242D.1036E77A@iit.demokritos.gr> Skip Montanaro wrote: > > I've never used spark before but something jumps to mind. It looks like you > tried to parse > > VERSION=1.23p12 That's right. > > but you defined statement as IDENTIFIER OPERATOR IDENTIFIER. While you > didn't tell us how an IDENTIFIER is constructed, I'd be hard-pressed to find > a common definition where it starts with a digit. Perhaps your stmt > definition needs to be something like > > stmt ::= IDENTIFIER OPERATOR STRING NL Yes this is required by the mini language I am trying to implement. > > for some suitable definition of STRING. To test my hypothesis, try parsing > > VERSION=VERSION > Nice try... It didn't work. However John Aycock had help me find the error. The __cmp__ function in the Token class was not defined (my mistake), so there was no correlation between tokens and terminals such as IDENTIFIER. Anyway thank you very much for your concern. .Bill From geckeler at gmx.net Tue Nov 21 19:10:58 2000 From: geckeler at gmx.net (Carsten Geckeler) Date: Wed, 22 Nov 2000 01:10:58 +0100 (MET) Subject: how to delete multiple elements from a list In-Reply-To: <3A1AFD80.4F75654E@correionet.com.br> Message-ID: On Tue, 21 Nov 2000, Rodrigo Senra wrote: > Mikael Olofsson wrote: > > > > On 14-Nov-00 etsang at my-deja.com wrote: > > > I have a List X with N number of items in it. I have another List Y > > > which contains the postion of the elements to be deleted from List X. > > > I cannot do a for loop to delete that because for each iteration, List > > > X will be changed and there will be sliperage. > > > > You _can_ do that with a loop. Just make sure that you have Y in reverse > > order. > > > > Y.sort() > > Y.reverse() > > for y in Y: > > del X[y] > > x=[1,2,3,4] > y=[1] # want to delete element-2 at index 1 > x.reverse() This should be y.reverse()! ^ > x.del(y[0]) # not yet! must correct List Y too Now it's ok for me. Cheers, Carsten -- Carsten Geckeler: geckeler at gmx dot net From moshez at zadka.site.co.il Tue Nov 21 00:02:54 2000 From: moshez at zadka.site.co.il (Moshe Zadka) Date: Tue, 21 Nov 2000 07:02:54 +0200 Subject: ANN.: Beta 1.0 of Weak Reference Extension Module is now available In-Reply-To: Message from graham of "Sat, 18 Nov 2000 16:11:11 EST." References: <8usorp$3i3$1@nnrp1.deja.com> <8uvjmj$dt8$1@nnrp1.deja.com> Message-ID: > On top of this more modern collection schemes have no penalty associated > with collecting circular references, in the sense that it is just as easy > to collect non-circular obbject chains as it is circular ones. Please read the FAQ about why Python is not garbage collected. It's a bit outdated, because Python has grown some form of garbage collection since then. However, it does explain why Python doesn't imploy classical GC schemes. > Like Johann I find weak references hard to fathom -- at least for their > utility. If you think of trees and back pointers, I expect you'll have a revelation. Or method caching. -- Moshe Zadka This is a signature anti-virus. Please stop the spread of signature viruses! From anders.eriksson at morateknikutveckling.se Mon Nov 6 04:05:52 2000 From: anders.eriksson at morateknikutveckling.se (Anders M Eriksson) Date: Mon, 06 Nov 2000 10:05:52 +0100 Subject: XBase for Python? References: <3A04B291.3080806@execpc.com> <3a05ee04$0$62632$726baab@news.execpc.com> <8u5j4r$j3c$1@nnrp1.deja.com> Message-ID: On Mon, 06 Nov 2000 06:29:50 GMT, andy47 at my-deja.com wrote: >> Jim Sabatke wrote: >> >> > Is there a package that will read/write XBase, or similar, files? >I > >Jumping on the bandwagon, can I expand the question to something more >general. I have a requirement to build a system which would >most 'easily' be developed in MS tools (Access, VB, etc.) as >integration with MS Word and Outlook are high on the feature list. > >I'd rather not go that way and am looking at using Python + window >toolkit for the front end and would like any help or pointers for which >database I could use (must be Windows I'm afraid) as the back end. >Also, any pointers on interfacing with MS Word/Outlook/Excel would be >most appreciated. > The integration with Word/Outlook/Excel is 'easiest' done using COM and if you need to use Access then you have ODBC. For the database you could use Metakit or Access via ODBC. To use COM and ODBC you need to install the Python Windows Extension by Mr. Marc Hammond (it included in the ActivePython distribution) http://www.python.org/windows/ For the ODBC I would recommend that you 'upgrade' to mxODBC by Mr. Marc-Andr? Lemburg. http://starship.python.net/crew/lemburg/ // Anders From peter at engcorp.com Sun Nov 5 17:13:54 2000 From: peter at engcorp.com (Peter Hansen) Date: Sun, 05 Nov 2000 17:13:54 -0500 Subject: Date manipulation and Java 'interface' equivalents References: <87puka8qaw.fsf@fangorn.stofanet.dk> Message-ID: <3A05DBA2.EC23CBD@engcorp.com> Martin Christensen wrote: > > First of all, I am doing some statistics with a PostgreSQL database, > and for this I need to manipulate some dates, ie. add a week to this > date or subtract a month from another. http://starship.python.net/crew/lemburg/mxExtensions.html#mxDateTime > Second question: is there a Python equivalent of Java interfaces? In a > matter of months I'll be constructing a web based sales and customer > relations thingy, and a similar feature would really make things > easier. I haven't decided on the implementation language yet, but > this is one of the things that make Java more appealing. Assuming you absolutely want the safety restrictions that an interface gives you (as opposed to the freer style of programming Python gives you, which might be more appropriate for writing a "thingy"), how about something like the following? (I don't know whether this would "really make things easier", though. And you still miss what is perhaps the only benefit of the Java interface: compile-time error messages.) >>> class AnInterface: ... someConstant = 5 ... def someMethod(self): ... raise NotImplementedError ... >>> class BadInterface(AnInterface): ... pass ... >>> class GoodInterface(AnInterface): ... def someMethod(self): ... print 'someConstant is %s' % AnInterface.someConstant ... >>> x = GoodInterface() >>> x.someMethod() someConstant is 5 >>> y = BadInterface() >>> y.someMethod() Traceback (most recent call last): File "", line 1, in ? File "", line 4, in someMethod NotImplementedError >>> -- Peter Hansen From aleaxit at yahoo.com Sun Nov 12 17:43:01 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 12 Nov 2000 23:43:01 +0100 Subject: Style: global configuration data References: <8umc4u$i28$1@news1.xs4all.nl> <3A0EF361.4F7FA244@gte.net> Message-ID: <8un6fv0g7i@news2.newsguy.com> "Steve Williams" wrote in message news:3A0EF361.4F7FA244 at gte.net... > Michael Hudson's sig block says: > > > 59. In English every word can be verbed. Would that it were so in > > our programming languages. > > -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html > > Lermontov's poem Parus (The Sail) starts out the with Russian word for white > (Byelo) used as a verb: > > (Byelyeet Parus odinaky. . .) > > Maybe Perlis knows how to 'verb' the word white, but I sure don't. Shines? > Glistens? Glitters? Coruscates? Bleaches? Blanches? Whites? I don't think > so. "Whitens" is one possibility -- while the transitive senses of the verb "to whiten" are more common, it does have intransitive use, too. (Actually, "glistens" sounds better to me in this context, but it's less literal, I think). Alex From peter at engcorp.com Mon Nov 20 23:56:27 2000 From: peter at engcorp.com (Peter Hansen) Date: Mon, 20 Nov 2000 23:56:27 -0500 Subject: How do I exchange the values of A and B References: <3A19CD9E.D625A57E@juniata.dgsys.com> Message-ID: <3A1A007B.B21C2DF7@engcorp.com> Charlie Kilmer wrote: > > How do I exchange the values > int A = x; > int B= y; > > here x and y are the values > > how do exchange the values so that > int A = y; > int B = x; Umm, in what language? 'Cause that ain't Python... From support at internetdiscovery.com Mon Nov 6 14:56:16 2000 From: support at internetdiscovery.com (Mike Clarkson) Date: Mon, 06 Nov 2000 19:56:16 GMT Subject: Tk with thread - Lost in Thread Space References: <7tuivs46osods22uumpvsvsap2jocrd4si@4ax.com> <00102712405206.00566@quadra.teleo.net> <8tf0hl$fc9$1@srv38.cas.org> Message-ID: <3a06205a.35581284@24.0.228.33> On 28 Oct 2000 16:57:25 GMT, lvirden at cas.org wrote: >According to Seung Chan Lim : >:I'm just fooling around with threads and Tk... > >Danger Will Robinson... > >Tk is not thread safe yet. I know that Tk is not thread-safe, but I don't know what that means in practical terms. I see that communication between Tk in _tkinter.c and python is thread safe, so my question is the following: If you have one (and only one) Tk running in one python thread are you "thread-safe" (assuming the Tk itself does not use threads)? I assume that python threads are safe with regard to each other, and that python threads are safe with respect to the Tk running in the main python thread. So it would seem to me that one Tk _tkinter in phython is "thread-safe" with regard to itself and to other python threads? Am I right? Many thanks, Mike. From donod at home.com Sat Nov 18 11:58:22 2000 From: donod at home.com (Donald O'Donnell) Date: Sat, 18 Nov 2000 16:58:22 GMT Subject: swap function? References: <3A132B71.A4A947EA@uniserve.com> <3A15FE61.C8272766@home.com> Message-ID: <3A16B0B6.23906F9@home.com> Fredrik: Thanks for your prompt reply and for correcting my misconceptions. You say > > (CPython actually uses indexes for all variables: for global names > and attributes, the index is used to find the name instead). That's very interesting. I'm going to try to check out the source. I'm very interested in how that works ... > local variables are much faster. try timing it. > I will, soon as I get a chance. I'll post the results. Cheers, Don From sandj.williams at gte.net Mon Nov 6 23:11:37 2000 From: sandj.williams at gte.net (Steve Williams) Date: Tue, 07 Nov 2000 04:11:37 GMT Subject: XBase for Python? References: <3A04B291.3080806@execpc.com> <3a05ee04$0$62632$726baab@news.execpc.com> <8u5j4r$j3c$1@nnrp1.deja.com> Message-ID: <3A0780DF.AFD422C9@gte.net> Anders M Eriksson wrote: > On Mon, 06 Nov 2000 06:29:50 GMT, andy47 at my-deja.com wrote: > > [snip] > The integration with Word/Outlook/Excel is 'easiest' done using COM > and if you need to use Access then you have ODBC. > [snip] Please don't use Access. Borland's Interbase is [infinitely] superior. From randy at spoke.net Thu Nov 9 18:08:45 2000 From: randy at spoke.net (Randall Kern) Date: Thu, 09 Nov 2000 23:08:45 GMT Subject: zope 2.2.2 and python 2.0 on linux? Message-ID: <18GO5.757$u41.246627@dfiatx1-snr1.gtei.net> anyone successfully done this? My results during a build: gcc -fpic -g -O2 -Wall -Wstrict-prototypes -I/usr/local/include/python2.0 - I/usr/local/include/python2.0 -DHAVE_CONFIG_H -c ./../Components/cPickle/cPickle.c ./../Components/cPickle/cPickle.c:57: mymath.h: No such file or directory make: *** [cPickle.o] Error 1 Traceback (most recent call last): File "wo_pcgi.py", line 116, in ? File "wo_pcgi.py", line 104, in main File "/usr/src/Zope-2.2.2-src/inst/build_extensions.py", line 96, in ? make('lib','python') File "/usr/src/Zope-2.2.2-src/inst/do.py", line 135, in make do('make') File "/usr/src/Zope-2.2.2-src/inst/do.py", line 104, in do if i and picky: raise SystemError, i SystemError: 512 -Randy From andrer at stud.cs.uit.no Tue Nov 7 08:39:40 2000 From: andrer at stud.cs.uit.no (=?iso-8859-1?Q?Andr=E9?= Larsen Risnes) Date: Tue, 07 Nov 2000 14:39:40 +0100 Subject: Python threads References: <3A04A638.A106A55F@tin.it> Message-ID: <3A08061C.C92110A9@stud.cs.uit.no> ADSL wrote: > > Hi all, > I'm looking for a decent tutorial the threading module, or at least > some piece of code on the subject, any hint? The threading module has objects that can be used much like those in Java.lang.thread, so if you are familiar with threading in java the transition should be easy. Also there are lots of tutorials/books on using threads with java. Of course, python has no synchronized keyword, but the threading.Lock object can be used for synchronization instead. (just remember to match acquire()'s and release()'s :-) ) -- Best Regards Andr? Risnes From kcazabon at home.com Wed Nov 1 15:33:39 2000 From: kcazabon at home.com (Kevin Cazabon) Date: Wed, 01 Nov 2000 20:33:39 GMT Subject: tkFileDialog, but no tkDirectoryDialog? References: <8tpom0$boc$1@nnrp1.deja.com> Message-ID: Just a side note: I believe that the tk_choosedirectory command is only valid in TK 8.4 and above... correct? Kevin. "Fredrik Lundh" wrote in message news:TTZL5.3874$jv2.437438 at newsc.telia.net... | vplatt at my-deja.com wrote: | > I have been unable to find any Tkinter dialog | > which would allow users of my application to pick | > a directory. My work-around right now is to | > simply allow them to choose a file (using | > tkFileDialog) within the directory, which I then | > split from the result and get the directory name | > that way. | | so let's write one: | | # | # tkDirectoryChooser.py | # $Id$ | # | # tk common directory dialogue | # | # this module provides interfaces to the native directory dialogue | # available in Tk 8.3 and newer. | # | # written by Fredrik Lundh, November 2000. | # | | # | # options (all have default values): | # | # - initialdir: initial directory. preserved by dialog instance. | # | # - mustexist: if true, user must pick an existing directory | # | # - parent: which window to place the dialog on top of | # | # - title: dialog title | # | | from tkCommonDialog import Dialog | | class Chooser(Dialog): | | command = "tk_chooseDirectory" | | def _fixresult(self, widget, result): | if result: | # keep directory until next time | self.options["initialdir"] = result | self.directory = result # compatibility | return result | | # | # convenience stuff | | def askdirectory(**options): | "Ask for a directory name" | | return apply(Chooser, (), options).show() | | # -------------------------------------------------------------------- | # test stuff | | if __name__ == "__main__": | | print "directory", askdirectory() | | | | From janssen at parc.xerox.com Thu Nov 2 14:24:39 2000 From: janssen at parc.xerox.com (Bill Janssen) Date: Thu, 2 Nov 2000 11:24:39 PST Subject: what happened to sys.prefix in 2.0? In-Reply-To: Your message of "Wed, 01 Nov 2000 18:19:27 PST." <00Nov1.181929pst."3448"@watson.parc.xerox.com> Message-ID: <00Nov2.112443pst."3448"@watson.parc.xerox.com> Ah, the perils of computing while flaked out on excess Halloween candy... > I find that a number of config things seem to have broken, since 2.0 > doesn't seem to export sys.prefix or sys.exec_prefix. Any idea where > I can find these? I grepped src/Misc/NEWS for them, but no luck. I was looking at Python 1.2, not 2.0. 1.2 predated sys.prefix. Sorry for the confusion. Bill From lchan_ea at my-deja.com Thu Nov 9 16:53:39 2000 From: lchan_ea at my-deja.com (lchan_ea at my-deja.com) Date: Thu, 09 Nov 2000 21:53:39 GMT Subject: environment space Message-ID: <8uf6cv$ib3$1@nnrp1.deja.com> I am invoking an executable as a subprocess from my Python script using os.system and when I run the script by double-clicking in Windows explorer, I get a message: Out of environment space. This does not happen if I run the Python script in the IDE or within a DOS window. I've tried setting all the DOS prompt exectuables to the max environment size and this still doesnt work. Is Python calling some internal DOS shell? Any ideas about how to init the environment size for the subprocess before execution? Thanks. Lydia Chan Sent via Deja.com http://www.deja.com/ Before you buy. From not_such_a_brain_after_all at mit.edu Wed Nov 8 08:00:00 2000 From: not_such_a_brain_after_all at mit.edu (Alex) Date: 08 Nov 2000 08:00:00 -0500 Subject: Instantiation of 2nd object appends 1st? References: <973680201.294555@lave> Message-ID: A_list is associated to the class A rather than any particular instance of A. If you want a distinct list for each instance, set it in the __init__ method. Alex. -- Speak softly but carry a big carrot. From euler27182 at my-deja.com Tue Nov 14 23:03:13 2000 From: euler27182 at my-deja.com (euler) Date: Wed, 15 Nov 2000 04:03:13 GMT Subject: STDIO Questions. References: <8upq18$le1$1@nnrp1.deja.com> <9e_P5.4926$QH2.536706@newsb.telia.net> <8uq0fs$qvm$1@nnrp1.deja.com> <3A10B6E6.803AFAE9@engcorp.com> Message-ID: <5WnQ5.1574$O21.260080@typhoon.nyroc.rr.com> So, I guess I wasn't the only one who thought this would be useful. It would also be nice to have the cursor keys, editing keys, and some other special function keys identified in a platform independant way as well. I don't know of any language that can do that reliably. (curses/ncurses is really just a Unix thing, the windows implementations are not great.) It would be a great advantage to Python to support these things consistantly. On the output side, a cursor relocation method would be very nice. It is a very simple function which is a building block to creating useful interfaces in terminals. From ayinger1 at my-deja.com Mon Nov 6 15:19:02 2000 From: ayinger1 at my-deja.com (yinger) Date: Mon, 06 Nov 2000 20:19:02 GMT Subject: how can I tell when a Thread object dies? Message-ID: <8u73ne$rea$1@nnrp1.deja.com> ... I mean besides threadObject.isalive(), because I want to be able to tell when a thread terminates on a sys.exit() call. I would like to be able to 'except' a SystemExit exception in the logic calling/ running the thread, but this doesn't work. Andrew Sent via Deja.com http://www.deja.com/ Before you buy. From dubois at users.sourceforge.net Sun Nov 5 10:33:58 2000 From: dubois at users.sourceforge.net (Paul F. Dubois) Date: Sun, 05 Nov 2000 15:33:58 GMT Subject: NumPy Installation on Win32 References: <8u0b18$gd$1@news.nuri.net> Message-ID: Sorry, I didn't realize that was still out there. Numpy stuff is now all at: http://numpy.sourceforge.net including a binary install version for Windows; just unzip it into your python 2.0 top-level directory. "June Kim" wrote in message news:8u0b18$gd$1 at news.nuri.net... > I wanted to install NumPy on my Windows machine, and > visited the ftp site at ftp://ftp-icf.llnl.gov/pub/python/. > The pdf document said that there is a binary install version > for win32, whose name is "NumPy.exe" but I couldn't find > it in the ftp site. > > Thanks in advance. > > June > > From sbrunning at bigfoot.com Tue Nov 28 05:59:19 2000 From: sbrunning at bigfoot.com (Simon B.) Date: Tue, 28 Nov 2000 10:59:19 GMT Subject: Python mailing list/usenet bridge. References: <8vt9t4$r0f$1@nnrp1.deja.com> Message-ID: <200011281059.EAA21601@x58.deja.com> In article <8vt9t4$r0f$1 at nnrp1.deja.com>, sbrunning at bigfoot.com wrote: > The Python mailing list/usenet bridge seems to be down at the moment, > and has been since last Wednesday. Any have any idea who to contact in > order to get this sorted? Quick update - Neil [nas at arctrix.com] and Barry [barry at digicool.com] both got back to me, pointing out that the problem is at CNRI. They have both attempted to contact the sysadmins at CNRI to get this going again, but obvously no joy yet. The *good* news is that deja is working again. Far from ideal, but any port in a storm... BTW, when the problem is resolved, the list should recieve all the posts that it has been missing over the last week or so. Hold onto your hats - I'm expecting at least a megabyte from Alex Martelli alone! ;-) Cheers, Simon Brunning Only put off until tomorrow what you are willing to die having left undone. - Pablo Picasso From cg at schlund.de Fri Nov 17 05:30:01 2000 From: cg at schlund.de (Carsten Gaebler) Date: Fri, 17 Nov 2000 11:30:01 +0100 Subject: "Embedded" Python? Message-ID: <3A1508A9.2F8EB4A3@schlund.de> Hi! Is there something like "embedded" Python for Apache, i.e. Python embedded in HTML pages like PHP? Regards Carsten. From ruben at techfactor.com Wed Nov 8 12:00:17 2000 From: ruben at techfactor.com (ruben at techfactor.com) Date: Wed, 08 Nov 2000 23:00:17 +0600 Subject: Python EJB Equivalent Message-ID: Coming from a Java background and recently using Python for application development, I have a question. Is there an equivalent to Enterprise JavaBeans in Python? If so, please point me to some resources!!! ruben From spahievi at vega.bg Tue Nov 7 15:43:10 2000 From: spahievi at vega.bg (Niki Spahiev) Date: Tue, 7 Nov 2000 22:43:10 +0200 Subject: XBase for Python? In-Reply-To: <8u5j4r$j3c$1@nnrp1.deja.com> References: <3A04B291.3080806@execpc.com> <3a05ee04$0$62632$726baab@news.execpc.com> <8u5j4r$j3c$1@nnrp1.deja.com> Message-ID: <745931591.20001107224310@vega.bg> 06.11.2000, 08:29:50, andy47 at my-deja.com wrote: amdc> I'd rather not go that way and am looking at using Python + window amdc> toolkit for the front end and would like any help or pointers for which amdc> database I could use (must be Windows I'm afraid) as the back end. amdc> Also, any pointers on interfacing with MS Word/Outlook/Excel would be amdc> most appreciated. If you need single-user DB try MetaKit. -- Best regards, Niki Spahiev From db3l at fitlinxx.com Thu Nov 16 00:48:31 2000 From: db3l at fitlinxx.com (David Bolen) Date: 16 Nov 2000 00:48:31 -0500 Subject: .readline() - VERY SLOW compared to PERL References: <8uthf2$pjh$04$1@news.t-online.com> <8utnqk02rlq@news1.newsguy.com> <8uu44b$4nc$04$1@news.t-online.com> Message-ID: "Harald Schneider" writes: > Thanks or your reply. .readlines() won't fit, since the data is VERY huge. > So .readline() is a must. Well, you can still use readlines() but just supply a maximum buffer size so that it doesn't snarf too much of the file into memory at once. Python will avoid reading past that number (subject to a small minimum like a few K I think), and then you can keep calling readlines() to continue processing the file in chunks. This can make the I/O more efficient as well as the internal processing Python does for each line. Whether or not it works well for the other processing you need to do I can't say, but as a point of comparison, the following two scripts: Perl: open(INPUT,'file.input') or die "Failure opening"; $count = 0; while () { $count++; } print "$count\n"; Python: file = open('file.input') count = 0 while 1: lines = file.readlines(8192) if not lines: break count = count + len(lines) print count Run on my machine (WinNT 4.0 SP4) on a text file of 100,000 lines of 78 characters (8000000 bytes including line endings) in .951s for the Python script and .651s for the Perl script. Bumping the buffer size up to 64K in the Python script drops it to .751s. So you can get it to within about 15% of the Perl runtime, but of course that mileage may vary once you do other processing within the loop. In general, this sort of raw text processing is just one of those cases where Perl is going to be more efficient than Python in general. Such processing is something that plays into Perl's strengths and something Perl was really designed to handle. With that said, you can generally get Python to be at least competitive (which I'd agree your original 3x factor wasn't), and then it becomes a question of issues such as maintainability and/or purpose of the script as to which language might be more appropriate. You also mentioned search for a key in your first post, so I might also mention that while you would probably use a regex pattern match in Perl to locate lines with that key, depending on the effort to isolate the key from within each line, you may find better performance with Python by using functions from the string module as opposed to regex's. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From nas at arctrix.com Mon Nov 27 05:47:33 2000 From: nas at arctrix.com (Neil Schemenauer) Date: Mon, 27 Nov 2000 02:47:33 -0800 Subject: lists and the letter u In-Reply-To: <35BD410BA148D411A7ED00508BCFFBDA65FEE9@msgil65170u05.nbk2305.il.ameritech.com>; from BARRON.F.SNYDER@msg.ameritech.com on Mon, Nov 27, 2000 at 12:29:17PM -0500 References: <35BD410BA148D411A7ED00508BCFFBDA65FEE9@msgil65170u05.nbk2305.il.ameritech.com> Message-ID: <20001127024733.A11692@glacier.fnational.com> On Mon, Nov 27, 2000 at 12:29:17PM -0500, SNYDER, BARRON F. (AIT) wrote: > I'm appending string values to a list and when I print the list, the letter > 'u' appears before each element: > > [u'dog', u'cat'] > > What does the 'u' mean? (I didn't see it documented in any of the books I > have and had a hard time searching for it in the archives) You must be using Python 2.0. A new feature is Unicode strings. Just as 'r' denotes a raw string, 'u' denotes a Unicode string. I'm not sure how you are creating Unicode strings. What environment are you using? Neil From phrxy at csv.warwick.ac.uk Sun Nov 19 13:27:58 2000 From: phrxy at csv.warwick.ac.uk (John J. Lee) Date: Sun, 19 Nov 2000 18:27:58 +0000 Subject: Use of JPython with Java Question In-Reply-To: <8v5pj2$k8$1@neptunium.btinternet.com> References: <8v5pj2$k8$1@neptunium.btinternet.com> Message-ID: On Sat, 18 Nov 2000, Ian Bolton wrote: > I'm writing a text-based adventure game in Java and have decided to script > the behaviour of items with JPython. [...] Sorry if I misunderstand your requirements, but you probably don't want to do that. Try Hugo, Inform or TADS, or I guess (just searched rec.arts.int-fiction and found this) PAWS - you can guess what that last one stands for. I think text adventure games are one of the few areas that not only has more developers than users, but more tool-developers than developers! Well, almost. Many text adventure (aka IF, Interactive Fiction) writing systems have been written, few are ever used by anybody. You would be duplicating a lot of work if you were to write a game without using one of these systems. Roughly, Hugo is to Inform as Python is to Perl (IMHO). I don't know anything about PAWS, other than that it uses Python of course. I think the order of popularity is Inform, TADS, Hugo, then everything else a long way down the list. I may be out of date though, try rec.arts.int-fiction. Inform is interesting because it compiles to the old z-machine bytecode as used by the original Infocom games, which runs on more platforms than Python even, including 'the Java platform'. ftp://ftp.gmd.de/if-archive/infocom/interpreters/zax/zax-0.9.txt John From vplatt at my-deja.com Wed Nov 1 16:33:13 2000 From: vplatt at my-deja.com (vplatt at my-deja.com) Date: Wed, 01 Nov 2000 21:33:13 GMT Subject: tkFileDialog, but no tkDirectoryDialog? References: <8tpom0$boc$1@nnrp1.deja.com> <8tpu2v$grn$1@nnrp1.deja.com> Message-ID: <8tq26q$kp1$1@nnrp1.deja.com> > I have to ask: Where does one learn about all the neat things you can > do with apply? I sense that this is just the tip of the iceberg, and I > would like to learn more. > Ok... just to answer some of my own questions. Although apply() is hard to find documentation for, I did figure out that it's just a pass through of all things Tk. That said, it looks like I can use any of the commands on http://dev.scriptics.com/man/tcl8.3.2/TkCmd/contents.htm with apply (where one can select the correct version of the Tk documentation they want to consult at http://dev.scriptics.com/man/). Of course, Tkinter takes care of most of this stuff for you, but it's cool to realize that one can use the very nice Tk documentation to wring the most out of Tkinter, which is not as well documented (through necessity I realize now, since the Tkinter documentation would have to try to keep pace with the Tk documentation). This is a lot of fun for a VB wonk. I have options! "Quick! Someone give me duct tape before my head implodes." Thanks! Sent via Deja.com http://www.deja.com/ Before you buy. From 1_quest_man at my-deja.com Fri Nov 10 17:02:59 2000 From: 1_quest_man at my-deja.com (1_quest_man at my-deja.com) Date: Fri, 10 Nov 2000 22:02:59 GMT Subject: new-b: Hide command window in wx? References: <8uhd5i$b51$1@nnrp1.deja.com> <8uhj6312tjd@news1.newsguy.com> Message-ID: <8uhrad$nqv$1@nnrp1.deja.com> Alex, You are correct. That did the trick. That was easy, and yet worth a lot. Your care for the community is much appreciated. I hope I can do something for you some day in return. Sincerely, Ruben In article <8uhj6312tjd at news1.newsguy.com>, "Alex Martelli" wrote: > <1_quest_man at my-deja.com> wrote in message > news:8uhd5i$b51$1 at nnrp1.deja.com... > > I am writting a little utility using wxPython. I can't seem to find a > > way to start the app without an adjacent command window. Even the demo > > has it, so I fear that it is not possible. Is this true. If so would > > it be possible to have the command window minimize itself while the > > main app window runs normal. (Ah! now you know I'm in Win shhh...:). > > Just use pythonw.exe rather than python.exe to run your > script, and there will be no "command window". The > extension .pyw (rather than .py) should do that by default, > I think, if you start your app by double-click on icons &c. > > Alex > > Sent via Deja.com http://www.deja.com/ Before you buy. From frederic.quin at free.fr Fri Nov 24 09:58:47 2000 From: frederic.quin at free.fr (Frederic Quin) Date: Fri, 24 Nov 2000 15:58:47 +0100 Subject: Question about gdchart module... Message-ID: <3A1E8227.B54F6EC4@free.fr> Hi all, I know that the gdchart module was written in c (there is only a python interface) but maybe someone knows more about it... I need to know how is calculate the size of the grid and the size of a bar depending on the size of the image and the number of bars. This is to create image maps dynamicly. I can't really know how it is calculated. Thanks fred From nickb at fnord.io.com Sun Nov 19 01:59:45 2000 From: nickb at fnord.io.com (Nick Bensema) Date: Sun, 19 Nov 2000 06:59:45 GMT Subject: What is Python? References: Message-ID: In article , Grant Edwards wrote: > >"When a programmer needs to write a quick utility program, it >should consider using Python." A word on this: My old JCL teacher called the computer "he", as in "The computer sees DD *, and he knows the next few cards are going to be his input." This is the first time I've heard an "it" become a "he", though we've all heard of cars and ships becoming "she". Perhaps it's because your car or your ship is something you're intimate with, while your computer is something you fight with. In contrast, in most European languages, "he" and "she" are used for all gendered nouns. La moutard, elle me monte au nez. -- Nick Bensema ICQ#2135445 ==== ======= ============== GAME OVER CONTINUE? CREDIT 1 From tariq.rashid at iname.com Fri Nov 17 09:16:48 2000 From: tariq.rashid at iname.com (Taz) Date: Fri, 17 Nov 2000 14:16:48 -0000 Subject: python 1.5.2 memory leak? References: <2J8R5.292$JE1.5619@news2-win.server.ntlworld.com> Message-ID: i don't del the re-used vasriables eg while 1: a = something other stuff i don;t think i need to del a at the end of the loop do i? thanks for the thoughts Gene C wrote in message news:EY9R5.719$n9.128801 at newsread2.prod.itd.earthlink.net... > You could try using del, but I doubt it will matter. > > >>> n = "abc" > >>> del n > >>> n > Traceback (innermost last): > File "", line 1, in ? > NameError: n > >>> > > From tim_one at email.msn.com Sat Nov 4 02:22:24 2000 From: tim_one at email.msn.com (Tim Peters) Date: Sat, 4 Nov 2000 02:22:24 -0500 Subject: Status of IDLE? In-Reply-To: <8tvel201ecj@news1.newsguy.com> Message-ID: Note that IDLE development has moved to its own project at SourceForge: http://sourceforge.net/projects/idlefork/ This reflects that Guido doesn't do anything on it except talk about it anymore <0.9 wink>. Note too this ominous quote, from http://lwn.net/2000/features/Guido.php3 Computer Programming for Everybody (www.python.org/cp4e) will get a new boost from perhaps an unexpected corner: ActiveState's Komodo (www.activestate.com/Products/Komodo) may be on its way to become the GUI that IDLE wanted to be. We'll be working with the ActiveState folks to promote Python as the best programming language for as-yet- non-programmers. that-guido-lets-himself-get-quoted-by-a-php-script-may-be-more- evidence-of-python's-impending-doom-ly y'rs - tim From nitin at borwankar.com Sun Nov 26 17:39:09 2000 From: nitin at borwankar.com (Nitin Borwankar) Date: Sun, 26 Nov 2000 14:39:09 -0800 Subject: [Zope] Python and EJB (J2EE) References: Message-ID: <3A21910D.53518128@borwankar.com> > > If you know where to get more info on XA/TX, could you provide some > pointers? Search for XA on Amazon - you can buy a copy of the Spec. It takes a while to ship 2-3 weeks I think. Also look at the specs for the JTA, Java Transaction API. There are some references there. Nitin. > > thanks, > > Hung Jung > > _____________________________________________________________________________________ > Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com From not.this at seebelow.org Thu Nov 16 17:06:28 2000 From: not.this at seebelow.org (Grant Griffin) Date: Thu, 16 Nov 2000 22:06:28 +0000 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> Message-ID: <3A145A64.65E50246@seebelow.org> June Kim wrote: > > I've read some comparisons between Ruby and Python from Ruby-centric view. > They estimate that four years will see Ruby overtake Python. > > Has anyone used Ruby here? or are there some documents at least unbiased -- > yet, Python-centric view would be okay if not too fictional. Not knowing anything about Ruby beyond what I've read in a couple of online articles, it sounds like it's competition for Perl more than Python. Specifically, it seems to be pretty Perlish, except that it seems to have cured some of Perl's flaws; from what I read, it seems to be "a better Perl". (Those who design a "new" programming language don't have to perpetually repeat the lessons of history for the sake of backwards compatability. ) But while I was reading about Ruby, one thing stood out. Ruby's creator said something to the effect that he didn't like Python's use of indentation to denote blocks. True, that's a relatively rare feature in the pantheon programming languages, and perhaps in the big scheme of things it's not something every language oughtta have. But the true Pythoneer understands why Python does that, and he loves Python for it. So while I can't predict which languages the masses will prefer in the future, I think it's fair to say that Pythoneers, at least, are likely to continue to prefer Python to a language designed by someone who (frankly) "just doesn't get it"*. besides,-"a-better-perl"-is-an-oxymoron--ly y'rs, =g2 *see http://www.python.org/doc/Humor.html#zen. For those of us whose approach to programming adheres to these principle, no programming language known to Man allows us to express ourselves better than Python. -- _____________________________________________________________________ Grant R. Griffin g2 at dspguru.com Publisher of dspGuru http://www.dspguru.com Iowegian International Corporation http://www.iowegian.com From martin.franklin at bedford.waii.com Mon Nov 13 10:35:02 2000 From: martin.franklin at bedford.waii.com (Martin Franklin) Date: Mon, 13 Nov 2000 15:35:02 +0000 Subject: Pmw Counter bug? Message-ID: <3A100A26.D84CF1C6@bedford.waii.com> I think there was a posting about a bug in Pmw.Counter widget under python 2.0 Tcl/Tk8.3.2 when you press the up and down buttons all you got was a beep! I just discovered I also have this bug and I have a fix..... #### old code.... def _changeNumber(text, factor, increment): value = long(text) if factor > 0: value = (value / increment) * increment + increment else: value = ((value - 1) / increment) * increment return str(value)[:-1] ##### new code..... def _changeNumber(text, factor, increment): value = long(text) if factor > 0: value = (value / increment) * increment + increment else: value = ((value - 1) / increment) * increment return str(value) From c00dn at dmu.ac.uk Mon Nov 6 06:55:55 2000 From: c00dn at dmu.ac.uk (Daniel Neumann) Date: Mon, 06 Nov 2000 11:55:55 +0000 Subject: QT && GTK libs Message-ID: <3A069C4B.BDF64AF9@dmu.ac.uk> Hi, can anybody give me a tip where I could find the libs/modules for qt and/or gtk (python2.0)? cheers, Daniel From dr at upload.it Thu Nov 2 05:57:16 2000 From: dr at upload.it (Dr.Upload) Date: Thu, 02 Nov 2000 11:57:16 +0100 Subject: ANN-Upload.it, for sharewarists (and a request) Message-ID: <3A01488C.962A412@upload.it> Hi! http://Upload.it is a new site created for sharewarists, i.e. shareware developers. There are no decoys, but simply a collection of useful tips and resources. In short, browsing "Upload it" is a simple way to not reinvent the wheel. I think this may be interesting for programmers like you. If you find it useful, well, I'm searching new resources to add, and programmer's ezines, mailing lists, newsletters where to announce the site. If you can help me on this please email me. Thanx and enjoy the site! Regards, ------------------------------------------------ Dr.Upload dr at upload.it ------------------------------------------------ NOTE please reply if you feel this is off topic! From d.ruttle at ntlworld.com Thu Nov 16 12:00:01 2000 From: d.ruttle at ntlworld.com (Dann-o) Date: Thu, 16 Nov 2000 09:00:01 -0800 Subject: sorting a list using the first 4 characters of each item References: <3A128551.2CE6E0C4@holdenweb.com> Message-ID: Steve Thanks for your suggestion. As I'm new to Python your suggestion seems easier to follow than the other contributions (for which I am very grateful). regards Dann-o From darius at bofh.net.au Mon Nov 6 12:48:28 2000 From: darius at bofh.net.au (KevinL) Date: Tue, 07 Nov 2000 04:48:28 +1100 Subject: How do you create constants?/immutable dicts In-Reply-To: Your message of "Mon, 06 Nov 2000 17:03:10 -0000." Message-ID: <200011061748.EAA08929@wobbly.bofh.net.au> (I'm assuming this one follows my post the other day, 'cause it mentions immutable dicts, and I've been thinking about them lately. Apologies to anyone who doesn't want to hear about my own little toy projects) >>> Steve Horne wrote > OK, I can understand your concern, but even so - in any language there > are ways to break the const-ness of data. In C and C++, for example, > you can directly typecast using const_cast which exists precisely for > that purpose. In pascal, you'd probably have to use pointer tricks, > but it could be done. At the end of the day, const-ness is only > assured when the data is in ROM - not likely in a desktop app. Except, where you control the context in which alien code can be executed. Lemme give you the example I've been working with, that leads me to believe immutable dictionaries in particular would be a useful construct. I've got a project, Moebius, which is 9/10ths of the way to being a fully fledged multi-user python - it provides persistant objects, upon which you can hang various (picklable) data structures. It provides a scripting engine, by virtue of some bytecode trickery and various interesting namespace games, so that you can define and execute your own methods, shovel data around however you like, etc. etc. It even has a little XMLish interface, which someone's trying to turn into a way to ship python objects from place to place and RPC-reference them, ala corba. Anyways. In giving people the ability to script within the engine, all sorts of interesting challenges come up - the one that interests me particularly in this case is "how do I give everyone a stable of standard 'safe' builtins etc - a reliable global namespace?" Every time a function is executed (actually, every time it's "compiled"), it has to have a global namespace attached to it. Now, here's where things get fun: If I use a dictionary for my global namespace, I can guarantee some smart sod will change items in the global namespace - in fact, one of the first people on, many months ago, replaced the time module with None, which wreaked havoc. So, I moved to a dictionary with a little "read-only" class pretending to be a dictionary, for it's __builtins__. All well and good, but we've still got basically the same problem - people can reach up and change things in the global namespace (even if they can't reach the stuff inside __builtins__ to change it). Here's the nasty bit: Because there's a fundamental difference between dictionaries and anything you can create, you cannot bind user objects to functions/methods as their namespace - python spits it. So I _can't_ protect that namespace. The best I can do is make a new copy of it every time I bind a function to a different object. Which a) feels kludgy, b) complicates things refcount-wise when I put interesting things in that namespace. What I'd love to do is simply build the global namespace dictionary, call an "immutable(1)" method on it, and rest easy knowing that the dictionary cannot be changed from the restricted execution space users are playing in. It's worth noting that, if you can do that, you've essentially got const variables - because python's so namespace-centric, simply executing code in a namespace you can't change basically means that the items in that namespace are consts (excepting the potential for overriding them in the local namespace, which I'm not concerned about because python doesn't have a hierarchical namespace, so the only person a method writer is kidding by doing that is themselves - no call they make will inherit their local namespace changes). That's basically the problem I'm facing. I know it's fairly specific, but I have trouble believing I'm the only one to come across this. The restricted execution setup is almost really really useful - if I had more control over the namespaces it existed in, I'd be ultra-happy ;) I agree with you that in normal use, there's various ways to get around it - but mixed in with a couple of the other standard python constructs, and it does get more useful. I'd also be happy if the difference between dictionaries and my own class-based objects were done away with - but I still think even if that happened, immutable dictionaries would be a useful construct to have handy. I don't believe this change would impact python negatively - other than the potential speed impact (which should be marginal anyway by rights), it simply works toward making dictionaries a little more useful, by implementing in them one of the more common reasons people resort to using their own dictionary-like classes. I've been hunting through the archives, and unfortunately can't turn up any previous discussion, tho I'm fairly sure there must have been. If anyone has any pointers as to why immutable dictionaries are a dumb idea, please let me know ;) KL (BTW, I made a really kludgy patch, that actually appeared to work but will probably break in interesting ways, and unfortunately places it's checks right in the line of execution, but does give the above "immutable()" method, at http://www.bofh.net.au/snippets/ Ideally, executing immutable(1) would simply change PyDict_SetItem to be a new function raising an error, but various other places in the code go straight to that function rather than through the PyMethodDef at the bottom, so it'd be a more wide-ranging (and probably higher impact) change anyway.) From max at alcyone.com Sat Nov 4 00:12:39 2000 From: max at alcyone.com (Erik Max Francis) Date: Fri, 03 Nov 2000 21:12:39 -0800 Subject: conditionals in lambdas? References: <8tv48r$kn8$1@bmerhc5e.ca.nortel.com> Message-ID: <3A039AC7.788E8C6A@alcyone.com> "Michael P. Soulier" wrote: > I'd like to make something like this a lambda function. Is that > possible? Sure: lambda s: s[:3] == 'yes' It's not possible in the general case, where you have more involved control structures being used. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE / \ All the people in his neighborhood turn around and get mad and sing \__/ Public Enemy Official Buh rules / http://www.alcyone.com/max/projects/cards/buh/ The official rules to the betting card game, Buh. From Jason.Tishler at dothill.com Fri Nov 17 10:52:08 2000 From: Jason.Tishler at dothill.com (Jason Tishler) Date: Fri, 17 Nov 2000 10:52:08 -0500 Subject: Win32 Python 2.0 Readline Module or Is python20.lib missing symbols? Message-ID: <20001117105208.I356@dothill.com> Has anyone been successful building the Readline Module for Win32 Python 2.0? I'm attempting to redo the 1.5.2 port by Paul Sokolovsky or Robert Kern as described in http://www.is.lg.ua/~paul/devel/readline/pymodule.html and http://starship.python.net/crew/kernr/binaries/Binaries.html respectively. After fiddle around, I seemed to have discovered that python20.lib is missing the following symbols that were in python15.lib: PyExc_IOError PyExc_TypeError PyOS_InputHook PyOS_ReadlineFunctionPointer _Py_NoneStruct This causes the Mingw link to fail when building readline.pyd with undefined references to the above symbols. I even rebuilt Python (using MSVC 6.0) from CVS and the symbols are still missing from python20.lib. Is the above a known issue? Any pointers or suggestions would be greatly appreciated. Thanks, Jason -- Jason Tishler Director, Software Engineering Phone: +1 (732) 264-8770 x235 Dot Hill Systems Corporation Fax: +1 (732) 264-8798 82 Bethany Road, Suite 7 Email: Jason.Tishler at dothill.com Hazlet, NJ 07730 USA WWW: http://www.dothill.com From bbum at codefab.com Wed Nov 8 18:42:40 2000 From: bbum at codefab.com (Bill Bumgarner) Date: Wed, 8 Nov 2000 18:42:40 -0500 Subject: [pyobjc] NSAutorelease support In-Reply-To: <200011082200.eA8M0hi14192@bjork.codefab.com> Message-ID: <200011082342.eA8Ngfi17841@bjork.codefab.com> AFAIK, Carbon on MacOS does not include ObjC-- so, no point in going to the relatively primitive CoreFoundation API because it won't gain portability to that environment and it will greatly impede portability to GnuStep/OpenStep.... I'm thinking that we can keep the basic code structure as is, but simply rewrite the internals to the modern underlying APIs. BTW: I have patches to makesetup and Python v. 2.0 that both fixes bugs and adds support for OSXS and OSX external shlib based modules... I'll try to pull 'em together and forward 'em sometime soon. b.bum From: "Steven D. Majewski" Date: 2000-11-08 18:36:11 -0500 To: Bill Bumgarner Subject: Re: [pyobjc] NSAutorelease support cc: Bill Bumgarner , python-list at python.org, pythonmac-sig at python.org, Andrew Zeldis , bobsavage at mac.com, jas at corpus-callosum.com, tony at metanet.com In-Reply-To: <200011082200.eA8M0hi14192 at bjork.codefab.com> X-Sender: sdm7g at elvis.med.Virginia.EDU On Wed, 8 Nov 2000, Bill Bumgarner wrote: > Ultimately, I think what we need to do is *rewrite* the module entirely > because of all of the changes between both OSX and Python 2.0. I also think this is likely. A lot will need to be done to add better Darwin/MacOSX/Carbon/Cocoa support and there doesn't appear to be a line of people willing to test changes for GnuStep or OpenStep. As CoreFoundation is common to Darwin and MacOSX, as well as CarbonLib on Classic MacOS, it would seem to make sense to build ontop of that ( CFBundle and the plugin-services [sort of COM for the Mac] ) rather than NSBundle et.al. which are only on OSX. ( and I assume GnuStep/NextStep/OpenStep ) Still, it might be good to get out one last "legacy" release of pyobjc -- Darwin and MacOSX might spark some more interest in Objective-C and GnuStep! ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- "All operating systems want to be unix, All programming languages want to be lisp." From syver.enstad at sensewave.com Sat Nov 11 09:23:28 2000 From: syver.enstad at sensewave.com (Syver Enstad) Date: Sat, 11 Nov 2000 15:23:28 +0100 Subject: A matter of style: class.foo = bar vs. class.set_foo(bar) References: <8uhkk9$2r5$1@panix2.panix.com> Message-ID: <8ujkua$seu$2@troll.powertech.no> "Aahz Maruch" wrote in message news:8uhkk9$2r5$1 at panix2.panix.com... > Generally speaking, because Python does not have private parts, you only > use a method when you want to trigger an action in addition to just > changing the variable's value. It does have a kind of privacy if you prefix your instance variables with two underscores "__". Python will then mangle the name if used outside the class so that it will be extremely painful to use it directly. The problem then is using the variable from a derived class, it seems you'll have to use accessors then too. From michael.soulier at home.com Sun Nov 5 15:28:50 2000 From: michael.soulier at home.com (Michael P. Soulier) Date: Sun, 05 Nov 2000 20:28:50 GMT Subject: python compiler?? References: <3A04051A.B1A8517B@cyberway.com.sg> <8u2f1i$505$1@news.udel.edu> Message-ID: In article <8u2f1i$505$1 at news.udel.edu>, Terry Reedy wrote: > >No: there have been efforts to translate Python to C for compilation to >native machine code but they have not yet been successful, that I know of, >for reasons discussed in many previous postings. I thought that the frozen module was a C backend. Granted, it's not native code, it links the interpreter in, but you can still compile it. Mike -- Michael P. Soulier "...the word HACK is used as a verb to indicate a massive amount of nerd-like effort." -Harley Hahn, A Student's Guide to UNIX PGP Public Key: http://www.storm.ca/~msoulier/personal.html From helmit_world at hotmail.com Wed Nov 1 02:06:51 2000 From: helmit_world at hotmail.com (Helmit) Date: Wed, 1 Nov 2000 10:06:51 +0300 Subject: Python to EXE Message-ID: <8tp486$4u61@news.qualitynet.net> Does anyone know a way to turn python programs into EXEs? From peter at engcorp.com Thu Nov 16 09:55:14 2000 From: peter at engcorp.com (Peter Hansen) Date: Thu, 16 Nov 2000 09:55:14 -0500 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> Message-ID: <3A13F552.4CBFF993@engcorp.com> June Kim wrote: > > I've read some comparisons between Ruby and Python from Ruby-centric view. > They estimate that four years will see Ruby overtake Python. "Four years"? In the computer industry, and in terms of "Internet time", that's so far beyond anyone's ability to predict that it's an irrelevant claim. Java was announced only five years ago and look where it is compared to all the claims made in the early days (although it's stood up remarkably well). > Has anyone used Ruby here? or are there some documents at least unbiased -- > yet, Python-centric view would be okay if not too fictional. There are some unbiased views out there, if you just search (Try http://www.google.com/search?q=python+ruby+comparison for example). I would judge it extremely unlikely that anything will "unseat" Python in the minds, hearts, and companies of many people for quite some time. That's because it is extremely effective, easy to learn and maintain, fun, powerful, flexible, and integrates so many different things together that it's not even funny. If you have practical reasons for needing Ruby (small memory space?) it would doubtless be a very good solution for you. If you have no specific driving need for what Ruby gives you that Python does not, Python will, IMHO, be a far more suitable option. -- Peter Hansen From mwh21 at cam.ac.uk Sat Nov 4 08:31:43 2000 From: mwh21 at cam.ac.uk (Michael Hudson) Date: 04 Nov 2000 13:31:43 +0000 Subject: Method or function? References: Message-ID: Thomas Wouters writes: > As for what binds tighter, the minus or the method call, that's easy. Not > because it's obvious what the answer should be, but because it's already > perfectly valid syntax. It's just that int and float objects don't have > attributes. For example: > > >>> class Negtest: > ... def __neg__(self): > ... print "__neg__ called on Negtest." > ... > >>> class Methtest: > ... def __neg__(self): > ... print "__neg__ called on Methtest." > ... def abs(self): > ... print "__abs__ called on Methtest." > ... return Negtest() > ... > >>> > >>> m = Methtest() > >>> -m > __neg__ called on Methtest. > >>> -m.abs() > __abs__ called on Methtest. > __neg__ called on Negtest. You don't really have to get that fancy: >>> class C: ... pass ... >>> c=C() >>> c.a = 1 >>> -c.a -1 >>> -c Traceback (most recent call last): File "", line 1, in ? AttributeError: 'C' instance has no attribute '__neg__' ... which is what I'd expect at least (it's one of these things where I'm more likely to get it right if I *don't* think about it!). Cheers, M. -- This makes it possible to pass complex object hierarchies to a C coder who thinks computer science has made no worthwhile advancements since the invention of the pointer. -- Gordon McMillan, 30 Jul 1998 From aleaxit at yahoo.com Tue Nov 14 09:15:06 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 14 Nov 2000 15:15:06 +0100 Subject: Proposal: default __init__ References: <8uotmc$uo4$1@slb7.atl.mindspring.net> <1xVP5.5768$jv2.681460@newsc.telia.net> <8upha902oie@news2.newsguy.com> <3dn1f3cyej.fsf@kronos.cnri.reston.va.us> Message-ID: <8urhdf021sn@news2.newsguy.com> "Andrew Kuchling" wrote in message news:3dn1f3cyej.fsf at kronos.cnri.reston.va.us... [snip] > No, I was simply wrong when I wrote the text; B.__init__ will call B's > __init__ method if it exists, and otherwise fall back to A.__init__. OK, thanks. > The list does need to be updated to take 2.0 into account, too. Oh yes -- I VERY MUCH want to whine again about 'print>>bsah'!!!-) Alex From howard at eegsoftware.com Fri Nov 3 19:06:47 2000 From: howard at eegsoftware.com (howard at eegsoftware.com) Date: Sat, 04 Nov 2000 00:06:47 GMT Subject: How to use BLT2.4 and Tcl/tk8.3 under Windows9X/NT ? References: <39F6BBCD.C25D4FEA@mailux.berl.tek.com> Message-ID: <3a0351b4.7467539@news-server.socal.rr.com> Following up on myself as it were..... I was unable to get the blt2.4u for 8.3 bltwish shell to run until I copied the library directories to be under Python20\Libs. Bltwish then was able to run its own demos (graph1.tcl). The following program : from Tkinter import * import Pmw root=Tk() graph=Pmw.Blt.Graph(root) works in 1.5.2 but fails as follows on 2.0: Traceback (most recent call last): File "test.py", line 5, in ? graph=Pmw.Blt.Graph(root) File "c:\python20\Pmw\Pmw_0_8_4\lib\PmwBlt.py", line 260, in __init__ Tkinter.Widget.__init__(self, master, _graphCommand, cnf, kw) File "c:\python20\lib\lib-tk\Tkinter.py", line 1758, in __init__ self.tk.call( TclError: invalid command name "::blt::graph" Significantly, the Dos window hangs after this and must be terminated forcefully (forceably ?). It seems to me that this is a symptom of mismatched DLL's somewhere. Still hoping for a good idea from someone...... Howard Lightstone EEGSoftware howard at eegsoftware.com From greg at perceval.be Thu Nov 9 07:45:46 2000 From: greg at perceval.be (greg at perceval.be) Date: Thu, 9 Nov 2000 13:45:46 +0100 (CET) Subject: Python weird state Message-ID: Hello pytoneers, I run FreeBSD 3.2 with Python 1.5.2 and MySQL 3.23.3. I met a strange problem with one of the applications i wrote in Python. This application use the MySQLdb module to connect to the MySQL server. The MySQLdb.__version__ is : 1.16 The application does the following job: it parses a CSV file (Excel ascii sheet) and add values to the MySQL db. I don't know if it can help, but the csvparser generate a lot (depends on the csv file size) of small queries (mainly insert but select too). This application was running correctly for 3 month (started automatically by cron on uploads). Since yesterday, I met a strange problem. When the process is started, it does a dozen of queries and then seems to freeze. I looked in the logs of the mysqld and saw that no more queries where performed. the top shows that the python process was in a sbwait state. After looking for information, I found in the kernel sources of freebsd the sbwait system call: "Wait for data to arrive at/drain from a socket buffer". >From here, I understand that python connects to MySQL server through a Unix socket (Am I wrong with this ?). While the python process was in this state, I tried to connect to MySQL server and perform some queries with both the mysql client and through an apache server without having any problems. I restart the FreeBSD server and try to manually launch the application. It now seems to work correctly. But I don't know what was the problem, I don't know what I can do to avoid it. I even don't know if the problem is FreeBSD, MySQL or Python related. Any clue ? Does someone had a similar problem ? Gregoire Welraeds greg at perceval.be Perceval Development team ------------------------------------------------------------------------------- Perceval Technologies sa/nv Tel: +32-2-6409194 Rue Tenbosch, 9 Fax: +32-2-6403154 B-1000 Brussels general information: info at perceval.net BELGIUM technical information: helpdesk at perceval.net URL: http://www.perceval.be/ ------------------------------------------------------------------------------- From xiao.bing at oztime.com Wed Nov 1 03:48:14 2000 From: xiao.bing at oztime.com (Xiao Bing) Date: Wed, 1 Nov 2000 16:48:14 +0800 Subject: problem about Mailman Message-ID: <011001c043e0$78fd37d0$eb00a8c0@prc.oztime.com> I modify The subscription script for my request. like this(msg include some Chinese Charactors.Never mind) --------------------------------------------------------------------# This Python Program is wroten by Xiao.Bing # 2000.11 # oz_subscribe.py """Process subscription requests from oz_maillist form.""" import sys import os import string import cgi from Mailman import Utils from Mailman import MailList from Mailman import Errors from Mailman.htmlformat import * from Mailman import mm_cfg from Mailman.Logging.Syslog import syslog def main(): doc = Document() parts = Utils.GetPathPieces() if not parts: doc.AddItem(Header(2, "??")) doc.AddItem(Bold('????CGI?????!')) print doc.Format(bgcolor="#ffffff") return listname = string.lower(parts[0]) try: mlist = MailList.MailList(listname) mlist.IsListInitialized() except Errors.MMListError, e: doc.AddItem(Header(2, "??")) doc.AddItem(Bold('???????%s' % listname)) print doc.Format(bgcolor="#ffffff") syslog('error', 'No such list "%s": %s\n' % (listname, e)) return try: process_form(mlist, doc) finally: mlist.Save() mlist.Unlock() def process_form(mlist, doc): form = cgi.FieldStorage() error = 0 results = '' # Preliminaries done, actual processing of the form input below. if not form.has_key("email"): error = 1 results = results + "??????????Email??.
" # # define email so we don't get a NameError below # with if email == mlist.GetListEmail() -scott # email = "" else: email = form["email"].value remote = remote_addr() if email == mlist.GetListEmail(): error = 1 if remote: remote = "Web site " + remote else: remote = "unidentified origin" badremote = "\n\tfrom " + remote syslog("mischief", "Attempt to self subscribe %s:%s" % (email, badremote)) # results = results + "You must not subscribe a list to itself!
" results = results + "?????????!
" # ????????? digest = mlist.digest_is_default if not mlist.digestable: digest = 0 elif not mlist.nondigestable: digest = 1 if not error: try: if mlist.FindUser(email): raise Errors.MMAlreadyAMember, email if digest: digesting = " digest" else: digesting = "" mlist.AddMember(email, "", digest, remote) # # check for all the errors that mlist.AddMember can throw # options on the web page for this cgi # except Errors.MMBadEmailError: results = results + ("????????????????" "???????.

") except Errors.MMListError: results = results + ("???????" "????????.

") except Errors.MMSubscribeNeedsConfirmation: results = results + ("??????????," "??????????" "%s. ???: " "?????????,???" "????!

" % email) except Errors.MMNeedApproval, x: results = results + ("?????? " "?? %s. ???????" "??????????." "????????

" % x) except Errors.MMHostileAddress: results = results + ("???????,??" "????????????.

") except Errors.MMAlreadyAMember: results = results + "???????!

" # # these shouldn't happen, but if someone's futzing with the cgi # they might -scott # except Errors.MMCantDigestError: results = results + \ "No one can subscribe to the digest of this list!" except Errors.MMMustDigestError: results = results + \ "This list only supports digest subscriptions!" else: results = results + \ "???!????????? %s ????.

" % \ (mlist.real_name) PrintResults(mlist, results, doc) def PrintResults(mlist, results, doc): replacements = mlist.GetStandardReplacements() replacements[''] = results output = mlist.ParseTags('oz_sub_success.html', replacements) doc.AddItem(output) print doc.Format(bgcolor="#ffffff") def remote_addr(): "Try to return the remote addr, or if unavailable, None." if os.environ.has_key('REMOTE_HOST'): return os.environ['REMOTE_HOST'] elif os.environ.has_key('REMOTE_ADDR'): return os.environ['REMOTE_ADDR'] else: return None -------------------------------------------------------------------------- I write a simple HTML code to invoke the script.

Please Input you email addr: 

--------------------------------------------------------------------------- oz_subscribe is a CGI program produced by a script(PY) file with same name. oztime_tech is a MailList name. But I get a error msg Bug in Mailman version 2.0rc1 We're sorry, we hit a bug! Please inform the webmaster for this site of this problem. Printing of traceback and other system information has been explicitly inhibited, but the webmaster can find this information in the Mailman error logs. So I go to see the error log.I found nothing.(Before did these.I simply cleared all content in the error log file) Why?Who can help me? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tdelaney at avaya.com Thu Nov 16 17:35:58 2000 From: tdelaney at avaya.com (Delaney, Timothy) Date: Fri, 17 Nov 2000 09:35:58 +1100 Subject: Does CGI need mutex ? Message-ID: I respectfully have to disagree here. Any time multiple requests can possibly access shared resources at the same time, there is a need for some sort of synchronisation. The original poster would probably not be asking the question if they were not using shared resources. I read the original question more as "Is there a guarantee that only one CGI process will be running at the same time, or do I need to synchronise access to shared resources?" The answer is that there is no guarantee that there is only one CGI process running at the same time. You must synchronise access to shared resources. How you do that will of course depend on the circumstances specific to your configuration. If they are (for example) all completely separate processes (traditional CGI) you will need to use OS-based synchronisation methods (possibly based on the file system, or other services available). Tim Delaney Avaya Australia +61 2 9532 9079 > -----Original Message----- > From: Andreas Jung [mailto:ajung at sz-sb.de] > Sent: Friday, 17 November 2000 1:23 AM > To: andyheath2 at lineone.net > Cc: python-list at python.org > Subject: Re: Does CGI need mutex ? > > > On Thu, Nov 16, 2000 at 08:08:51AM +0000, > andyheath2 at lineone.net wrote: > > Running apache on linux. > > > > Anyone know - am I guaranteed instances > > of a particular cgi script execute > > atomically ? Even if they block > > for some reason ? > > Every CGI request (independant of using Python) runs > in its own process. So there is usually no dependancy between > the instances. > > Andreas > > -- > http://www.python.org/mailman/listinfo/python-list > From grante at visi.com Thu Nov 16 11:06:08 2000 From: grante at visi.com (Grant Edwards) Date: Thu, 16 Nov 2000 16:06:08 GMT Subject: ping References: <8uubhg$rrl$1@localhost.localdomain> <3a12c29a.25708476@news.main-echo.net> <3a136508_2@corp.newsfeeds.com> Message-ID: In article <3a136508_2 at corp.newsfeeds.com>, Joshua Muskovitz wrote: >Forking a process which opens a socket, sends a packet, waits >for the result, and then returns said result to your process is >*much* slower than just doing it yourself. We're talking about pinging hosts on the Internet, which takes tens or hundreds of ms, and you're worried about a few microseconds of overhead involved in a fork/return? -- Grant Edwards grante Yow! .. If I cover this at entire WALL with MAZOLA, visi.com wdo I have to give my AGENT ten per cent?? From andrew_dot_henshaw_at_earthling_dot_net Thu Nov 9 22:55:08 2000 From: andrew_dot_henshaw_at_earthling_dot_net (Andrew Henshaw) Date: Thu, 9 Nov 2000 22:55:08 -0500 Subject: Calculating circle´s points coordinates. References: <3A0AE584.E177C454@hotmail.com> <3a0b07f3_3@corp.newsfeeds.com> Message-ID: "Joshua Muskovitz" wrote in message news:3a0b07f3_3 at corp.newsfeeds.com... > If you are working in degrees, create a list of angles with "range(0,360)" > or something like that. Then, you can use map to substitute the > corresponding x,y coordinates for the angle. > ...snip... I'm not sure of the original poster's requirements, but if he wants to plot a set of points on a integer-based grid (e.g., a memory-mapped display), then the Bresenham Circle algorithm is usually recommended. It's very fast and it doesn't have a problem with "holes" in the point set. Here's a pythonized implementation. ########################## # # Bresenham Circle Algorithm # ########################## def circle(radius): x = 0 y = radius switch = 3 - (2 * radius) points = [] while x <= y: points.extend([(x,y),(x,-y),(-x,y),(-x,-y),\ (y,x),(y,-x),(-y,x),(-y,-x)]) if switch < 0: switch = switch + (4 * x) + 6 else: switch = switch + (4 * (x - y)) + 10 y = y - 1 x = x + 1 return points Good luck! Andy Henshaw From not_such_a_brain_after_all at mit.edu Mon Nov 6 16:28:12 2000 From: not_such_a_brain_after_all at mit.edu (Alex) Date: 06 Nov 2000 16:28:12 -0500 Subject: lambda & scope References: Message-ID: Sorry, I don't really follow what you want to do, here. Can you be more specific? Alex. -- Speak softly but carry a big carrot. From jdries at mail.com Wed Nov 1 07:19:02 2000 From: jdries at mail.com (Jan Dries) Date: Wed, 01 Nov 2000 13:19:02 +0100 Subject: CPython vs. Jython/JPython References: <8tn36u$r8m$1@news5.svr.pol.co.uk> <39FF4663.A7B5E81E@synacon.ch> Message-ID: <3A000A36.FA9A13D@mail.com> Ingo Adler wrote: > > Bill de h?ra wrote: > > > ANSI C is very possibly more portable than Java. > > Really? What are the #ifdefs for in "ANSI C" - Python? As Bjarne Stroustoup sais in his FAQ answer to the question how Java compares to C++: Java isn't really platform independent! Java is a platform. A virtual platform that can be superimposed on many other hardware/OS platforms, but a platform nonetheless. The only platform independent piece of Java is the JVM, which, by the way, is written in C, and I expect it to have just as many #ifdefs as does the Python interpreter. The question of portability is not whether Java source of even byte code is portable across java interpreters, because it by definition is (or should be, if everybody, MS included, stuck to the JVM spec). The question of portability is how portable the Java platform itself (i.e. the JVM) really is. And it remains a fact that (today at least) the Python platform is available on several hardware/OS combinations where there's no Java platform available today. > > > Raw C written by a good programmer is typically more efficient in space ... > > There are benchmarks that show the opposite. Could you give a pointer to these benchmarks? > Regards, Jan From fred at balzac.scd.ucar.edu Wed Nov 8 18:50:49 2000 From: fred at balzac.scd.ucar.edu (Fred Clare) Date: 8 Nov 2000 23:50:49 GMT Subject: Two newbie questions Message-ID: <8ucosp$7bd$1@ncar.ucar.edu> 1.) Is there a Python equivalent to the C function "sprintf"? That is, I would like to do a formatted print and save the result in a Python string. 2.) What is an efficient way of packing a large (i.e. > 1MB) list of integers (that are in the range 0 to 255) into a Python string as a sequence of contiguous bytes? Something like the following seems very inefficient: import struct . . . ir = [ ... lots of integers in the range 0 to 255 ... ] bytes = "" for x in ir: bytes = bytes + struct.pack("B",x) --Fred Clare -- Fred Clare fred at ucar.edu From Gareth.McCaughan at pobox.com Thu Nov 16 19:11:28 2000 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: Fri, 17 Nov 2000 00:11:28 +0000 Subject: ANN.: Beta 1.0 of Weak Reference Extension Module is now available References: <8usorp$3i3$1@nnrp1.deja.com> <8uvjmj$dt8$1@nnrp1.deja.com> <68m61t47n6rs120q3e06v18nuri0ujhqsm@4ax.com> Message-ID: Johann Hibschman wrote: >>>> Looks neat! But maybe you could answer me a quick question, since I >>>> really don't understand weak references. > >> Suppose you are designing a cache. > > It's still not obvious to me. Say I had a database that I was > caching. Then > > x = database.get('RECORD_ID') > > would only get the file from disk once, etc. But the cache itself is > invisible; it's entirely under the hood. Once you have the data > object, you have it. > > Are you saying that once you have the object, something weird might > happen elsewhere that means you no longer have it? That seems like a > sign that you don't really have the object at all, or that you don't > have synchronization working quite right. You do a database.get. It returns a (perfectly ordinary) reference to the object. It *also* updates an internal "weak hash table" so that it contains the mapping from RECORD_ID to the object. If you throw away your copy of the object, then subsequent database retrievals will get it quickly via the hash table until it happens to get GCed. If the object *does* get GCed (at a time when user-visible stuff isn't holding on to it) then the next attempt at fetching it will see a NIL or Null or None or whatever your preferred language calls its null value, and so will go back to the database itself. Another use for weak references: You build a class that remembers what all its instances are, but you still want the instances to disappear when there are no "ordinary" references to them. In languages with support for finalization (like Python and C++) you do this in the __del__ method, or destructor, or whatever you want to call it; in languages without such support (like Common Lisp) you do it by making the class's references to its instances weak references. -- Gareth McCaughan Gareth.McCaughan at pobox.com sig under construc From mikael at isy.liu.se Tue Nov 14 08:42:47 2000 From: mikael at isy.liu.se (Mikael Olofsson) Date: Tue, 14 Nov 2000 14:42:47 +0100 (MET) Subject: [Newbie] How to make the difference beetween 2 dates... ? In-Reply-To: <8ur9ep$a2v$1@reader1.imaginet.fr> Message-ID: On 14-Nov-00 Christophe Prevost wrote: > I have a month and a year and i want to know if this date is 2 months old > from now > In PHP it's quite simple : $TwoMonthAgo = MkTime(0, 0, 0, $Month-2, $Day, > $Year); The same principle seems to work very well i python: >>> import time >>> time.time() 974208614.846 >>> time.localtime(time.time()) (2000, 11, 14, 14, 30, 28, 1, 319, 0) >>> time.localtime(time.mktime((2000, 11, 14, 0,0,0,0,0,0))) (2000, 11, 14, 0, 0, 0, 1, 319, 0) >>> time.localtime(time.mktime((2000, -1, 14, 0,0,0,0,0,0))) (1999, 11, 14, 0, 0, 0, 6, 318, 0) >>> time.localtime(time.mktime((2000, 0, 14, 0,0,0,0,0,0))) (1999, 12, 14, 0, 0, 0, 1, 348, 0) All you have to do is extract the current date from time.localtime(time.time()), subtract 2 from the month and stuff it back using time.mktime(your_new_date) and compare. Good luck. /Mikael ----------------------------------------------------------------------- E-Mail: Mikael Olofsson WWW: http://www.dtr.isy.liu.se/dtr/staff/mikael Phone: +46 - (0)13 - 28 1343 Telefax: +46 - (0)13 - 28 1339 Date: 14-Nov-00 Time: 14:33:20 /"\ \ / ASCII Ribbon Campaign X Against HTML Mail / \ This message was sent by XF-Mail. ----------------------------------------------------------------------- From fredrik at effbot.org Thu Nov 9 12:10:45 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Thu, 09 Nov 2000 17:10:45 GMT Subject: using the 'data' option on the PhotoImage class of Tkinter References: Message-ID: Seung Chan Lim wrote: > I'm doing the following to load the binary data of a GIF file and trying to > instantiate a PhotoImage object using that data through its "data" option, > and I'm having some trouble... > > import Tkinter > root=Tk() > f=open("temp.gif","rb") > img=f.read() > pimg=Tkinter.PhotoImage(data=img) > > and I get a > > TclError: couldn't recognize image data > > my GIF file is just a simple gif file saved in Photoshop... how about "pimg=Tkinter.PhotoImage(file="temp.gif")" ;-) but assuming you have good reasons for loading the image in a non-direct way, you can find a hint in the tkinter intro docs [1]: "Read image data from a string. In the current version of Tk, this only works for base64-encoded GIF files. If the file option is given, this option is ignored. in other words, this should work: f=open("temp.gif","rb") img=base64.encodestring(f.read()) pimg=Tkinter.PhotoImage(data=img) for less convoluted ways to get binary image data into Tkinter, check out the Python Imaging Library [2] 1) http://www.pythonware.com/library/tkinter/introduction/photoimage.htm => options 2) http://www.pythonware.com/products/pil From aleaxit at yahoo.com Thu Nov 9 09:31:53 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Thu, 9 Nov 2000 15:31:53 +0100 Subject: Exporting events from Python COM class. References: <8ueb9l01voj@news1.newsguy.com> Message-ID: <8uecgq0217t@news1.newsguy.com> "Alex Martelli" wrote in message news:8ueb9l01voj at news1.newsguy.com... [snip] > c. it sets its classmember _connect_interfaces_ to the list of > IIDs for the event (aka 'source') interfaces it wants to [snip] > Points e/f may be a little delicate in the very unusual case > in which you want your server to expose TWO source-interfaces -- Oops -- I just checked win32com\server\connect.py, and this just won't fly -- the client-object trying to connect is always queried for the *first* interface in the list, so the others (if any) seem to be there just to cause confusion (when the client does the FindConnectionPoint for an IID that's in the list, but not the first one, it will appear to succeed -- but then the call to Advise will fail!). A good thing that needing to use >1 source interface is so rare. I think ConnectableServer should be modified to accept *just one* "_connect_interface_" in the Python class that inherits from it, not a list... the fact that it's a list is (it seems to me) misleading. (I fully understand that supporting separate connectionpoints for more than 1 source-interface, such a rare need, is an unwarranted amount of effort!-). I also think there's a bug in win32com\server\connect.py's Advise implementation -- if a client tries to connect (to the one-and-only source interface), with an object that also implements some _other_ dispatch-interface (and returns that 'other' when QI's for IDispatch), the methods being called when events are fired are going to be methods on the _default_ IDispatch version of the client-object, NOT on the specific dispinterface it asked to connect. I think this violates COM's rules, and, while it's unlikely that a specific client implementation will trigger this bug, I expect _very_ subtle, hard to reproduce, hard to understand, little semantics disasters if/when it happens. Is the second call to QueryInterface on that Advise method really necessary...? I guess so, since commenting it out makes win32com.demos.connect.test() fail with an AttributeError on Invoke, but I don't really understand why... (would it work OK if the source-interface were to inherit IDispatch as it should and the event-generating Python COM server was properly apprised of that...?) Alex From SBrunning at trisystems.co.uk Mon Nov 20 04:00:53 2000 From: SBrunning at trisystems.co.uk (Simon Brunning) Date: Mon, 20 Nov 2000 09:00:53 -0000 Subject: Stupid "\" question Message-ID: <31575A892FF6D1118F5800600846864D5B1490@intrepid> > From: Gene C [SMTP:gchiaramonte at yahoo.com] > If I get an input string from a user or file like this: "a\b\c" > How do I convert it to this: "a\\b\\c" Have you looked at re.escape? (Apologies if someone has already pointed this out - I didn't get many posts over the weekend, and I suspect that I'm missing some.) Cheers, Simon Brunning TriSystems Ltd. sbrunning at trisystems.co.uk ----------------------------------------------------------------------- The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot accept liability for statements made which are clearly the senders own. From aleaxit at yahoo.com Sun Nov 19 03:44:37 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sun, 19 Nov 2000 09:44:37 +0100 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> <8v0uv4$jh$1@panix3.panix.com> <3A1410C4.915F6029@letterror.com> <8v73jl0hfr@news1.newsguy.com> Message-ID: <8v83v301g0n@news1.newsguy.com> "graham" wrote in message news:B63CA023.172F7%graham73 at telocity.com... [snip] > > You may dislike having to be explicit about the details > > of the new function object -- 'use the code of local > > function add, use the current variable look-up settings > > as the "global" namespace' -- and wish new.function > > defaulted them for you, but it doesn't. Big deal. > > Actually it is a big deal. When you do > > c = a + b > > to construct the object c (say a and b are ints, although in this > case c isn't an object, but that doesn't change me point), you don't But of course it IS an object, just like a function-object is one. That is, by Python definition. If you're thinking 'class-instance' when you say 'object', then neither ints not functions in Python are 'objects' in THIS sense. > have to say where you are getting a and b from (which environment or > namespace or whatever you want to call it). But if I want to > define a function I do have to be explicit about where I am > getting objects used in the function definition from. So functions No! Absolutely no difference. c = lambda x, y=a, z=b: x + y + z You don't have to be any more explicit about where a and b are 'coming from' (which environment or namespace) in the definition of this object (which you're binding to c) than you do in the definition of the object that YOU were binding. > are not treated like other objects, and hence are not first class. They're treated exactly like every other object, and thus are first-class. Alex From jdries at mail.com Wed Nov 8 13:18:22 2000 From: jdries at mail.com (Jan Dries) Date: Wed, 08 Nov 2000 19:18:22 +0100 Subject: C++ and Python References: Message-ID: <3A0998EE.A7460272@mail.com> > > > Hi, > > I was wondering if there is already a more or less automatic way out there > > to build Python interfaces to C++ classes. > > I want to write the Gui in python and the C++ part interact with this Gui. > > It should be a Python program that use C++ static Lib or Dll. > > Can you pls send me some examples? > > Thanks, > > Aviad > > SWIG (www.swig.org) > CXX (was originally from LLNL, there is probably some reference from > numpy.sourceforge.net) > SCXX (by Gordon McMillan, probably on his page somewhere) You may also want to look at Py_cpp: http://people.ne.mediaone.net/abrahams/downloads/py_cpp.html Jan From glenfant at equod.com.nospam Mon Nov 20 13:42:32 2000 From: glenfant at equod.com.nospam (Gilles Lenfant) Date: Mon, 20 Nov 2000 19:42:32 +0100 Subject: Win32 Python 2.0 Readline Module or Is python20.lib missing symbols? References: <8vba7q$91v$1@nnrp1.deja.com> Message-ID: <8vbr33$6bq$1@reader1.imaginet.fr> Hmmm! Seems that readline module requires GNU libraries available only with Unix.... see http://www.python.org/doc/2.0b1/lib/module-readline.html Sorry... a ?crit dans le message news: 8vba7q$91v$1 at nnrp1.deja.com... > [My post on Fri, 17 Nov 2000 10:52:08 -0500 appears to have only made it to > the mailing list and not to the newsgroup. So, I am reposting directly > to the newsgroup. I apologize for the dup, if you receive one. Sigh...] > > Has anyone been successful building the Readline Module for Win32 Python > 2.0? > > I'm attempting to redo the 1.5.2 port by Paul Sokolovsky or Robert > Kern as described in > > http://www.is.lg.ua/~paul/devel/readline/pymodule.html > > and > > http://starship.python.net/crew/kernr/binaries/Binaries.html > > respectively. > > After fiddle around, I seemed to have discovered that python20.lib is > missing the following symbols that were in python15.lib: > > PyExc_IOError > PyExc_TypeError > PyOS_InputHook > PyOS_ReadlineFunctionPointer > _Py_NoneStruct > > This causes the Mingw link to fail when building readline.pyd with > undefined references to the above symbols. I even rebuilt Python (using > MSVC 6.0) from CVS and the symbols are still missing from python20.lib. > > Is the above a known issue? > > Any pointers or suggestions would be greatly appreciated. > > Thanks, > Jason > > -- > Jason Tishler > Director, Software Engineering Phone: +1 (732) 264-8770 x235 > Dot Hill Systems Corporation Fax: +1 (732) 264-8798 > 82 Bethany Road, Suite 7 Email: Jason.Tishler at dothill.com > Hazlet, NJ 07730 USA WWW: http://www.dothill.com > > > Sent via Deja.com http://www.deja.com/ > Before you buy. From boud at rempt.xs4all.nl Sun Nov 12 10:14:38 2000 From: boud at rempt.xs4all.nl (Boudewijn Rempt) Date: 12 Nov 2000 15:14:38 GMT Subject: Style: global configuration data Message-ID: <8umc4u$i28$1@news1.xs4all.nl> I have been wondering for some time about the best way to offer configuration data and other global resources to all modules and classes in my application, other than creating a config object and passing that on with every constructor. What's the received Pythonic wisdom on this? I'd prefer to just have one instance of my config class, or my repository class or whatever, so if I were working in Java I'd create a singleton, but that somehow doesn't seem right for Python to me. -- Boudewijn Rempt | http://www.valdyas.org From speed at ?.com Tue Nov 7 12:01:25 2000 From: speed at ?.com (Jake Speed) Date: Tue, 07 Nov 2000 17:01:25 -0000 Subject: Unbuffered keyboard input References: <8u97c8$hod$1@nnrp1.deja.com> <8u99fl$jch$1@nnrp1.deja.com> Message-ID: apighin at my-deja.com wrote in <8u99fl$jch$1 at nnrp1.deja.com>: >To tell the truth, what I am really trying to do is to parse a file >that is ever expanding. The file will be open()ed, parsed, but will >continue to grow in the background. I can not seem to get Python to >see that the file have changed and begin processing again. Ideas? This is the what the Unix command 'tail -f' does. When you get an end-of-file, any further read will immediately return. You need to wait a bit, then clear the EOF status with a seek() and see if there is more data. import time f = open("data.txt", "rb") while 1: data = f.read(1024) if data: print repr(data) else: time.sleep(1) # wait a second f.seek(0, 1) # seek to the current position f.close() Note that the loop never exits, because there's no way to tell when the writing process has closed! If you were reading a pipe, socket, or terminal, which stdin usually is, read() would block until more data was available, and would only return EOF when the writing process closed its end. -Speed! From aleaxit at yahoo.com Sat Nov 11 17:50:22 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sat, 11 Nov 2000 23:50:22 +0100 Subject: Confused. References: <8ubfv8$nth$1@plutonium.compulink.co.uk> <8ujmg5$t3j$1@troll.powertech.no> <8ujqao029t5@news1.newsguy.com> <8ujvgv$ne$1@troll.powertech.no> Message-ID: <8ukira0q1v@news2.newsguy.com> "Syver Enstad" wrote in message news:8ujvgv$ne$1 at troll.powertech.no... > > "Alex Martelli" wrote in message > news:8ujqao029t5 at news1.newsguy.com... > > gbreed's alternative suggestion was: > > > > > > import pywintypes, time > > > > comtime = pywintypes.Time(time.time()) > > What you're trying to say is that the constructor of Time, converts from > time.time() format to a PyTime object, and you use float on the PyTime to > get the variant_date or whatever the COM date type is called. Right?. Right, AFAIK. > But there is still no function to convert from comtime to ctime format is > there? int() on a pywintypes.PyTime object gives 'ctime', as you call it. I.e., >>> a=pywintypes.Time(0) >>> float(a) 25569.041666666668 >>> int(a) 0 >>> (Yeah, I agree that's not very intuitive:-). > An interesting bug by the way: > >>> import pywintypes, time > >>> ctime = time.time() > >>> comtime = pywintypes.Time(ctime) > > I'll think I'll stick to the time module or I'll have to go to work tomorrow > ;-) > >>> time.ctime(ctime) > 'Sat Nov 11 17:59:33 2000' > >>> comtime.Format('%#c') > 'Sunday, November 11, 2000 17:59:33' Pretty buggy, yes...! Alex From rupole at msn.com Sun Nov 5 18:50:00 2000 From: rupole at msn.com (Roger Upole) Date: Sun, 05 Nov 2000 23:50:00 GMT Subject: Module Expect to control Win32 programs? References: <8u0lte$cuj$1@newsreaderg1.core.theplanet.net> Message-ID: You could use SendKeys from Window Scripting Host. However, this has a couple of drawbacks. It only sends keystrokes to the foreground window, so you'd have to make sure your app always stays on top. Also, there's no feedback so you'd have to have some external way to check if the action was actually performed. (Or you may be able to use win32ui.GetForeGroundWindow and GetWindowText to check for success/error messages, but I've never tried this...) HTH Roger Upole "Franz GEIGER" wrote in message news:8u0lte$cuj$1 at newsreaderg1.core.theplanet.net... > I have a Win32 App with a rather complex GUI, which still is extended and > improved. After each major extension it has to be tested. I wonder if there > is a possibility to automate this with Python. There is moule out there > known as EXPECT. Could this be a possibility? On > http://sourceforge.net/projects/ExpectPy it reads "Environment: Console > (text based) (...)", so it seems not to be what I'm looking for. The GUI I'm > speaking of provides a keyboard interface (ALT-...), though. > > Any ideas or links I can follow? > > Regards > Franz GEIGER > > > From fredrik at effbot.org Sun Nov 19 02:45:15 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Sun, 19 Nov 2000 07:45:15 GMT Subject: Find file functionality References: <3a15b668.361990264@news.earthlink.net> Message-ID: Robert Gottlieb wrote: > Or does anyone know how to get os.path.walk to stop once a file is > found? the docs mention that you can modify the directory list: "The visit function may modify names to influence the set of directories visited below dirname, e.g., to avoid visiting certain parts of the tree. (The object referred to by names must be modified in place, using del or slice assignment.) ::: if you need to stop on an individual file, you can raise an exception instead (e.g. EOFError) def func(arg, dirname, names): for file in names: if something(file): raise EOFError try: os.path.walk(...) except EOFError: print "found it" ::: a third alternative is to forget about walk, and use a directory walker object instead. here's an example from the eff-bot guide to the standard library: # os-path-walk-example-3.py # from (the eff-bot guide to) The Python Standard Library # http://www.pythonware.com/people/fredrik/librarybook.htm import os class DirectoryWalker: def __init__(self, directory): self.stack = [directory] self.files = [] self.index = 0 def __getitem__(self, index): while 1: try: file = self.files[self.index] self.index = self.index + 1 except IndexError: # pop next directory from stack self.directory = self.stack.pop() self.files = os.listdir(self.directory) self.index = 0 else: # got a filename fullname = os.path.join(self.directory, file) if os.path.isdir(fullname) and not os.path.islink(fullname): self.stack.append(fullname) return fullname for file in DirectoryWalker("."): print file if something(file): break From jkraska1 at san.rr.com Mon Nov 6 00:24:57 2000 From: jkraska1 at san.rr.com (Courageous) Date: Mon, 06 Nov 2000 05:24:57 GMT Subject: CPython vs. Jython/JPython References: <8tn36u$r8m$1@news5.svr.pol.co.uk> <39FF4663.A7B5E81E@synacon.ch> <8p666m22kgr.fsf@Eng.Sun.COM> <24qb0tcceqakpcfoe2f3bntk3f11nfcc4t@4ax.com> <8p63dh53gbo.fsf@Eng.Sun.COM> Message-ID: >> I think this poster was referring to the fact that most JVMs are >> written in C, necessarily creating a bit of a chicken and the egg >> problem. Which isn't to rule out all sorts of other possibilities, >> of course. :) > >Maybe I came in late and missed something, but the statement I quoted >doesn't seem to be talking about which came first. Um. I really don't know the posters original intent, but most arguments of this sort allude to general tendency of Java users to execute their java byte codes on a JVM. This JVM is usually written in C. Ergo it is "impossible" to have faster Java than C, because it's really C which is doing the execution. This is forgetting native compilers, and the like, course. This is also forgetting various advantages one might not use given standard normal practices in one language and not the other. It really depends on where you're coming from, I'm sure. C// From fredrik at effbot.org Thu Nov 2 14:39:10 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Thu, 02 Nov 2000 19:39:10 GMT Subject: Method by name lookup References: <8tsboe0rcs@news1.newsguy.com> Message-ID: Will Hartung wrote > As an extra bonus, is there anyplace one can get all of the function names > associated with an instance? # builtin-dir-example-2.py # from (the eff-bot guide to) The Python Standard Library # http://www.pythonware.com/people/fredrik/librarybook.htm class A: def a(self): pass def b(self): pass class B(A): def c(self): pass def d(self): pass def getmembers(klass, members=None): # get a list of all class members if members is None: members = [] for k in klass.__bases__: getmembers(k, members) for m in dir(klass): if m not in members: members.append(m) return members print getmembers(A) print getmembers(B) print getmembers(IOError) ## prints: ## ['__doc__', '__module__', 'a', 'b'] ## ['__doc__', '__module__', 'a', 'b', 'c', 'd'] ## ['__doc__', '__getitem__', '__init__', '__module__', '__str__'] From peter at engcorp.com Sun Nov 19 01:09:20 2000 From: peter at engcorp.com (Peter Hansen) Date: Sun, 19 Nov 2000 01:09:20 -0500 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <87snowl5f0.fsf@fangorn.stofanet.dk> <3A16E158.A8DB692@engcorp.com> Message-ID: <3A176E90.CC66D305@engcorp.com> Tim Hammerquist wrote: > > Samuel A. Falvo II wrote: > > On Sat, 18 Nov 2000 15:06:48 -0500, Peter Hansen wrote: > > >Sorry, you're disqualified. It should have been: > > > > > > ooh! ooh! I, I! > > > > Sorry, but that's not true. "Me!", when used in this context, is an > > imperative, as in, "Give it to me!" or, "Notice me!" > > Agreed. This follows the French in saying 'Moi' (me) in this same context. > However, Spanish _does_ use "yo" (I) in this context. > > If Mr. Hansen wishes to push the issue, we can start by tackling the > issue of a famous greeting: "It's me." In strict grammatical terms, > the subject (It) and the object (me), linked by a verb of being (is), > are in conflict with each other. However, this also follows the French idiom > of "C'est moi" (It's me.) Spanish, however, uses "Soy yo" in this > case (literally: "I am I"), which agrees all 'round. I would suggest > that Mr. Hansen take up Spanish. ;) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ No thanks. I tried but Esperanto ten times easier and more rewarding. Interesting background on *idioms* in other languages, however, but for proper English usage I'll merely defer to *the* book on the subject, "A Dictionary of Modern English Usage" by H.W.Fowler, 2nd Edition, (Oxford at the Clarendon Press, 1965). In the section on "I" (p. 258), one finds: "*Between you and I* is a piece of false grammer which, though often heard, is not sanctioned, like its opposites *It's me* and *That's him*, even in colloquial usage." The technically incorrect but nevertheless completely accepted usage is simply an idiom which, since 1965, has surely grown ever more "sanctioned in colloquial usage". The fact that other languages follow (or lead, as you suggest) the incorrect usage means nothing. The problem here is that "to be" is what is known as a "copulative" verb, which links a subject to a complement, rather than to an object. "Me" is an object, and can never be used after a form of "to be". (I make this sweeping generalization without thorough thought, merely to leave open the possibility that someone will notice an instance where I'm wrong, and jump on it and me. If I didn't do this, this thread might actually die. ;-) I agree the cry "Me, me!" refers to the imperative, as you mention. The original writer was not, however, asking for something to be given to him, but was holding himself out as someone who "get's it right every time", with respect to "they're" vs. "their". Since the focus was on correct grammatical usage, rather than a ready grasp of idiomatic usage, I judged "Me, me" incorrect, with the full weight of a single individual's opinion backing up my view, which is all Usenet has ever required. :) pedantical-ly-but-with-an-attempt-at-subtle-humor-ly yrs, Peter Hansen From xco at online.fr Tue Nov 14 11:50:57 2000 From: xco at online.fr (x. coolen) Date: Tue, 14 Nov 2000 16:50:57 +0000 Subject: parallel port acces Message-ID: <3A116D71.F5C74C4E@online.fr> I would like to read and write to the printer port . Is it possible with python on windows platform ? xavier coolen xco at online.fr From carey_murray at hotmail.com Sat Nov 11 16:24:35 2000 From: carey_murray at hotmail.com (Carey Murray) Date: Sat, 11 Nov 2000 21:24:35 GMT Subject: Python as a Scripting Language for Game Development? Message-ID: Many game developers use some sort of scripting system for controlling game events, or for giving non-programmers access to the game engine during development. Has anybody used Python for this? Any info would be helpful. Thanks Carey From ommadawn at club-internet.fr Tue Nov 14 08:53:10 2000 From: ommadawn at club-internet.fr (Christophe Prevost) Date: Tue, 14 Nov 2000 13:53:10 -0000 Subject: [Newbie] How to make the difference beetween 2 dates... ? References: <8ur9ep$a2v$1@reader1.imaginet.fr> <3A113299.640CC0FE@unice.fr> Message-ID: <8urci4$fuo$1@reader1.imaginet.fr> "Jerome Alet" a ?crit dans le message news: 3A113299.640CC0FE at unice.fr... > Christophe Prevost wrote: > > > I have a month and a year and i want to know if this date is 2 months old > > from now > > In PHP it's quite simple : $TwoMonthAgo = MkTime(0, 0, 0, $Month-2, $Day, > > $Year); > I suggest you to download mxDateTime from > http://starship.python.net/~lemburg/ > this will solve all your problems and possibly more ;-) Oui, remarque en plus j'en ai besoin pour installer mxODBC... From euler27182 at my-deja.com Mon Nov 20 15:25:35 2000 From: euler27182 at my-deja.com (euler) Date: Mon, 20 Nov 2000 20:25:35 GMT Subject: GUI development Message-ID: <3NfS5.254780$JS3.37905932@typhoon.nyroc.rr.com> Does python have a simple tool for laying out GUI interfaces in TK? Under TCL, there is a nice tool called vtcl. Is there a Python equivalent? http://vtcl.sourceforge.net/ From johes at ifi.uio.no Sat Nov 11 15:57:28 2000 From: johes at ifi.uio.no (Jo Erik Hesthagen) Date: Sat, 11 Nov 2000 21:57:28 +0100 Subject: Jpython/swing.. LayoutManagers.... Message-ID: <3A0DB2B7.51C90739@ifi.uio.no> Hi! Do somebody out there know where I can find some information and maybe som examples of using jpython with swing and different LayoutManagers?? Thanks Jo Erik Hesthagen -- Wherever you go, there you are.. From sdm7g at minsky.med.Virginia.EDU Fri Nov 10 12:19:30 2000 From: sdm7g at minsky.med.Virginia.EDU (Steven D. Majewski) Date: 10 Nov 2000 17:19:30 GMT Subject: How to make a conditional import??? References: <8ugvjf$25p$1@news2.iabg.de> Message-ID: <8uhan2$riv$1@murdoch.acc.Virginia.EDU> > >def selectProjectType(): > #... skipped > if projectType == 'phys': > from pyhsModule import * > else: > from logicModule import * > for a more global effect, try instead: import sys if projectType == 'phys' : import physModule sys.modules['theModule'] = physModule else: import logicModule sys.modules['theModule'] = logicModule and then anywhere, you can do: import theModule or from theModule import * import will find 'theModule' in the cache and it won't look for a file of that name. -- Steve Majewski From tuttledon at hotmail.com Wed Nov 8 09:55:18 2000 From: tuttledon at hotmail.com (Don Tuttle) Date: Wed, 08 Nov 2000 14:55:18 GMT Subject: Python for ASP References: <8u8r16$86i$1@nnrp1.deja.com> <3a083021.1320581896@news.iway.fr> Message-ID: > > >1) Do you now any good resource for ASP programming in python? > > I did some ASP in Python, and I will provide my source as soon as I > > find it showable (the code still consists mostly of atrocious hacks). > > Please, let us know when you do! ME TOO!!! (none to subtle, I might add ;-) Don From johndheintz at my-deja.com Sun Nov 19 22:27:09 2000 From: johndheintz at my-deja.com (johndheintz at my-deja.com) Date: Mon, 20 Nov 2000 03:27:09 GMT Subject: Standalone ZODB - Connections and multiple threads References: <3A17069E.D60260E9@digicool.com> Message-ID: <8va5m8$eeu$1@nnrp1.deja.com> I have a proposal and patch at http://dev.zope.org/Wikis/DevSite/Proposals/ExplicitTransactions that I think addresses these issues. See my comments below. Jim Fulton wrote: > > David Bolen wrote: > > > > I'm wondering if someone here might be able to help out with a query > > about using ZODB standalone without Zope? > > Yup. > > > ZODB3 is documented as supporting multiple connections to a storage > > which supports independent object caches for multiple threads. > > However, although I've looked around at a bunch of documents, I can't > > seem to find if this is required or simply available. I am planning of releasing template code for how I am using ZODB with omniORB. This code needs to deal with the ORB calling into different Connection caches of Persistent object from a different thread for each CORBA request. I currently don't have the requirement to do thread-syncronization within the objects from the same DB Connection, but I do have the problem of not being able to control which thread is doing the work. > It isn't required, but it is by far the common usage pattern. > > Hm, I guess that the current implementation actually makes it > hard to institute a different policy. I think that the current implementation makes if very hard to even override get_transaction() because the Transaction module is delete from the namespace after import. (See my proposal for how much I would like to change it ;-) > > That is, if I'm > > using ZODB in a multi-threaded Python application, must I create > > separate connections for each thread, or can they share a single > > connection. > > Multiple threads *can* share a single connection, but > if you do this, you'll need to: > > - Perform whatever locking is required to serialize > access to the shared objects, > > - You'll need to override get_transaction with a version > that doesn't manage transactions by thread. > > > In my case, the application is already securing itself against > > simultaneous access to the objects that I'm making persistent, so I > > don't really think I need the distinct connections, but I ran into one > > case where it seemed that the thread within which a > > get_connection().commit() was performed was important to getting the > > object changes really committed. > > The logic for the Persistent mix-in class calls get_transaction > to get the current transaction when it needs to > register that an object has changed. The standard get_transaction > manages transaction objects per thread. In addition, the > function is cached the first time it is called, to avoid > global lookups each time. The ExplicitTransactions proposal is based on the claim that this logic is not necessary and makes it overly difficult to implement other transaction policies. The change that the patch makes is to have the Persistent mix-in class lookup the appropriate Transaction from its Connection object, not from a global function. It also re-exposes the Transaction module so client code can directly create Transactions that DB Connections can be associated with. I think that this change makes it more intuitive when multiple threads are being used to modify Persistent object from multiple DB Connections. (This is the circumstance when using CORBA). > You can replace get_transacton by installing a different version > in builtins, but you will need to do so immediately after importing > ZODB, to make sure your version gets cached. > > > If I did create separate connections, my understanding is that the > > object stores referenced beneath the root obtained from each > > connection would be distinct in memory, but in my case the persistent > > object information is truly being shared among the execution threads > > (with appropriate locking), so I'd think having separate copies of > > them would only complicate things. > > Why do your threads actually need to share the same object (copy)? For my application it is CORBA that controls the threads and every different CORBA Request can be run from a different thread. > Jim > > -- > Jim Fulton mailto:jim at digicool.com > Technical Director (888) 344-4332 Python Powered! > Digital Creations http://www.digicool.com http://www.python.org > > Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email > address may not be added to any commercial mail list with out my > permission. Violation of my privacy with advertising or SPAM will > result in a suit for a MINIMUM of $500 damages/incident, $1500 for > repeats. Thanks, John -- . . . . . . . . . . . . . . . . . . . . . . . . John D. Heintz | Senior Engineer 1016 La Posada Dr. | Suite 240 | Austin TX 78752 T 512.633.1198 | jheintz at isogen.com w w w . d a t a c h a n n e l . c o m Sent via Deja.com http://www.deja.com/ Before you buy. From etsang at my-deja.com Tue Nov 7 14:05:11 2000 From: etsang at my-deja.com (etsang at my-deja.com) Date: Tue, 07 Nov 2000 19:05:11 GMT Subject: Hwo can I enable list to select multiple items? Message-ID: <8u9jp0$t9h$1@nnrp1.deja.com> Hi, Currently I have tring to do the following: a list containing names of files for selection. The list is dispalyed in a window. But I do not want to just click and select one item at a time? How can I let the user to select a block of files? I am using TkIncr for Solaris. Regards, Sent via Deja.com http://www.deja.com/ Before you buy. From tjreedy at udel.edu Wed Nov 22 00:37:23 2000 From: tjreedy at udel.edu (Terry Reedy) Date: Wed, 22 Nov 2000 00:37:23 -0500 Subject: Polite complaints can get results Message-ID: <8vflo4$nvr$1@news.udel.edu> A few days ago, our newsgroup was polluted with a spam ad entitled !! Free Fetish Pics !! High Quality !! 100% Free!! I hit reply, changed the addressee to abuse at hotmail.com (no copy to the bozo) and added a couple of polite lines at the top saying that this was a nice, professional, on-topic newsgroup and that I would appreciate their assistance. in keeping it that way. Today I got this response: I appreciate your bringing this matter to our attention. I have closed the account you reported in accordance with the Hotmail Terms of Service (TOS). It is a strict violation of the TOS for our members to send objectionable material of any kind or nature using our service. ... Sincerely, Leah C. MSN Hotmail Customer Support From parker at gol.com Sat Nov 18 19:20:16 2000 From: parker at gol.com (Ian Parker) Date: Sun, 19 Nov 2000 00:20:16 GMT Subject: Serial Port I/O with Python References: <3a13a190.3228378@news.wanadoo.fr> Message-ID: In article <3a13a190.3228378 at news.wanadoo.fr>, Jean-Claude REPETTO writes >In the Python FAQ, I have read : > >>How do I access the serial (RS232) port? >> >>For Unix, search Deja News (using http://www.python.org/search/) >> for "serial port" with author Mitch Chapman (his post is a little too >> long to include here). > >Unfortunately, this post is no longer available on Deja News. >I have asked Mitch Chapman, but he answered that he has not kept a >copy of his post. He proposed to re-construct the examples at home. > >Perhaps someone has a copy of his post, that would avoid Mitch some >work ... > >Thanks, > >Jean-Claude Repetto > For handling Windows serial ports, have a look for siomodule at http://www.python.org -- Ian Parker From cjc26 at nospam.cornell.edu Mon Nov 13 14:36:04 2000 From: cjc26 at nospam.cornell.edu (Cliff Crawford) Date: Mon, 13 Nov 2000 19:36:04 GMT Subject: SelectMixIn Message-ID: Has anyone ever done a mixin for the SocketServer/*HTTPServer modules, along the lines of ForkingMixIn or ThreadingMixIn, which uses select() or poll() to handle multiple connections? I tried searching parnassus but couldn't find anything. -- cliff crawford http://www.people.cornell.edu/pages/cjc26/ But WHERE are the turtles? From wester at ilt.fhg.de Fri Nov 3 06:49:39 2000 From: wester at ilt.fhg.de (Wester) Date: Fri, 03 Nov 2000 12:49:39 +0100 Subject: reversing byte order Message-ID: <3A02A653.76282293@ilt.fhg.de> Hi, I have a binary file with double's in the wrong byte order. Some time ago I found a module in the Python distribution that could be used to change byte orders. Unfortunately I cannot find right now. Can anybody tell me what module this is? Thanks Rolf From cmena at my-deja.com Mon Nov 20 09:44:52 2000 From: cmena at my-deja.com (cmena at my-deja.com) Date: Mon, 20 Nov 2000 14:44:52 GMT Subject: java support References: <8v90l1$j0r$1@nnrp1.deja.com> <9166109171EFC8CE.221C814AA2A738F0.BC67F30EB74F88C3@lp.airnews.net> <3A18FF1F.5274DC52@infercor.no> Message-ID: <8vbdd2$bks$1@nnrp1.deja.com> In article <3A18FF1F.5274DC52 at infercor.no>, Paul Boddie wrote: > Cameron Laird wrote: > > > > I believe Finn Bock has a bit of experience linking > > in C-coded objects with Jython, which conceivably > > can get you some of the results you're after. A > > CPython module that scripts Java, though? No, there > > isn't one. > > There is JPI: > > http://www.ndim.edrc.cmu.edu/dougc/jpi/Home.html > > I don't think that it has been touched for a while, though, and only binary > releases seem to be available. However, I did try it once and it worked as > advertised. > > Regards, > > Paul thanks. will take a look. Sent via Deja.com http://www.deja.com/ Before you buy. From fredrik at effbot.org Fri Nov 3 14:30:32 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Fri, 03 Nov 2000 19:30:32 GMT Subject: Problems building C extension for Python 2.0 References: <3a0043ac.25932418@news.ecs.soton.ac.uk> <8tphqs$3hd$1@pea.uk.research.att.com> <6niM5.3537$QH2.345644@newsb.telia.net> <8tu38k$76s$1@pea.uk.research.att.com> Message-ID: Duncan wrote: > >> You might be able to recompile Python itself with VC++ 5. > > > >replace "might be able to" with "can easily" -- I'm doing > >it all the time... > > Really? Don't you have anything better to do? oh, you don't appreciate my contributions to 2.0? (I usually compile stuff before checking it in, you know) From paulb at infercor.no Mon Nov 20 13:00:38 2000 From: paulb at infercor.no (Paul Boddie) Date: Mon, 20 Nov 2000 19:00:38 +0100 Subject: Basic help wanted: building on unix References: <8v3skj$deai$1@nntp6.u.washington.edu> <3A157FD3.F092F41C@alcyone.com> <8vbko2$feok$1@nntp6.u.washington.edu> Message-ID: <3A1966C6.95E526CC@infercor.no> "Russell E. Owen" wrote: > > Thanks to everybody for their helpful responses. > > I'll install the source on any partition that has room, after getting > gcc and gnu make. Then try to figure out how to get Tkinter and wxPython > installed (I can't run wxPython on my Mac, so here's my first chance to > see if it's more suitable than Tkinter for my project). It should be straightforward enough, if Solaris 8 is similar enough to previous releases of Solaris. You shouldn't need GNU make, however, as I seem to recall that Python is (or at least was) fairly happy with Sun's make. I installed GNU make for other reasons myself, though. ;-) As for Tkinter, it should be easy enough to configure and install if you follow the instructions provided with Python. wxPython is a bit harder, given that you will need to install glib, gtk+, and wxGTK before you get to installing wxPython itself. These should build easily enough, using the configure system that Python also uses, but be careful to read wxPython's documentation about Solaris-specific compiler options, and don't be too concerned if you don't get wxPython 2.2.2 working... I'm currently on 2.2.1 until I get around to trying 2.2.2 again. Good luck! Paul From not_such_a_brain_after_all at mit.edu Sat Nov 4 02:01:24 2000 From: not_such_a_brain_after_all at mit.edu (Alex) Date: 04 Nov 2000 02:01:24 -0500 Subject: Pickle question References: <8u07am$nf3$1@solaris.cc.vt.edu> Message-ID: > Except there are certain states in which the object shouldn't be > pickled. You could include a __getstate__ method that raises an error when in those states, or just arranges things so that the offensive bits of the class don't get pickled. Alex. -- Speak softly but carry a big carrot. From gs234 at cam.ac.uk Mon Nov 6 05:36:11 2000 From: gs234 at cam.ac.uk (Gaute B Strokkenes) Date: 06 Nov 2000 10:36:11 +0000 Subject: How can I tell when a string is in fact a number? References: <4a8zqyqxqv.fsf@kern.srcf.societies.cam.ac.uk> <8u45fo015ql@news1.newsguy.com> Message-ID: <4an1fde6as.fsf@kern.srcf.societies.cam.ac.uk> "Alex Martelli" writes: > just of digits is probably via the re module...: > > def isanum(str): > import re > return re.match(r'\d*',str)!=None > > this checks for '0 or more digits', like your original > code -- i.e., an empty str will get a 1 return value. > > To check for '1 or more digits', just change the > regular expression rawstring to r'\d+'. I did this, but it doesn't work properly. It returns 1 no matter what. After looking at the docs for a while, I came up with the following: def isanum(str): import re return re.match(r'^[0-9]', str) != None Which works beautifully. Thanks to everyone who gently pushed me in the right direction. -- Big Gaute http://www.srcf.ucam.org/~gs234/ I hope I bought the right relish... zzzzzzzzz... From dgoodger at bigfoot.com Sun Nov 5 20:56:59 2000 From: dgoodger at bigfoot.com (David Goodger) Date: Sun, 05 Nov 2000 20:56:59 -0500 Subject: Need to add to ord and convert to chr In-Reply-To: <8u4gn9$pe5$1@nnrp1.deja.com> References: <8u4gn9$pe5$1@nnrp1.deja.com> Message-ID: on 2000-11-05 15:42, mchitti at my-deja.com (mchitti at my-deja.com) wrote: > Trying to teach myself python, would appreciate any help. This is the place! > I have a long string of letters (a caesar cipher) which I chop up, > convert to ord values and stick into a list. I need to be able to add > an arbitrary interger to the ord values and then convert back to char. > This should allow me to brute force the cipher if my logic is good. The other two replies so far have valid points, but the code has a bug. Caesar ciphers need to wrap around when you add the offset, so that 'z' + 1 == 'a'. By the way, your example message doesn't seem to be a valid Caesar cipher. Should it be? The code below will do what you want, and works in 1.5.2. -- David Goodger dgoodger at bigfoot.com Open-source projects: - The Go Tools Project: http://gotools.sourceforge.net (more to come!) ---------- cut here ---------- cut here ---------- cut here ---------- #!/usr/bin/env python import string def caesar(message, offset): result = [] orda = ord('a') ordz = ord('z') for c in string.lower(message): ordchar = ord(c) if orda <= ordchar < ordz: result.append(chr((ordchar - orda + offset) % 26 + orda)) else: # if not a letter, don't convert result.append(c) return string.join(result, '') message = 'weet bksa myjx oekh fojxed ijktyui!' for offset in range(26): # test all offsets print '\noffset by:', offset result = caesar(message, offset) print result From claird at starbase.neosoft.com Sun Nov 12 08:46:43 2000 From: claird at starbase.neosoft.com (Cameron Laird) Date: 12 Nov 2000 07:46:43 -0600 Subject: Python as a Scripting Language for Game Development? References: Message-ID: <1D5D1CE6457080BD.4F743862AFE3B48D.970C7C8E117F5F53@lp.airnews.net> In article , Carey Murray wrote: >Many game developers use some sort of scripting system for controlling game >events, or for giving non-programmers access to the game engine during >development. Has anybody used Python for this? Any info would be helpful. . . . Yes. I thought I'd written a column on this topic, but the only mention I can find is Perhaps I'll unpack my notes on the subject ... -- Cameron Laird Business: http://www.Phaseit.net Personal: http://starbase.neosoft.com/~claird/home.html From dsh8290 at rit.edu Thu Nov 16 23:10:27 2000 From: dsh8290 at rit.edu (D-Man) Date: Thu, 16 Nov 2000 23:10:27 -0500 Subject: P*rl in Latin, whither Python? In-Reply-To: <3A144D9A.90A7A737@kst.siemens.de>; from richard.suchenwirth@kst.siemens.de on Thu, Nov 16, 2000 at 16:11:54 -0500 References: <3A0C8258.4217A1C@alcyone.com> <3A0DA05A.7A5DCDE5@alcyone.com> <3A0DCD27.1B2D7416@alcyone.com> <8ukn8d017vc@news2.newsguy.com> <3A144D9A.90A7A737@kst.siemens.de> Message-ID: <20001116231027.B21947@westsidecnc.rh.rit.edu> I too rather like the unrestricted use of chars in symbols in LISP. The '?' and '!' conventions are much more concise and stand out more than "is" and "set". I also like the use of hyphens. I always put space around my operators for readability anyways so I'm in agreement with this. -D On Thu, 16 Nov 2000 16:11:54 Richard.Suchenwirth wrote: | Alex Martelli wrote: | > It IS sort of nice to be able to name all predicates ending with '?', | > all functions-which-modify-args ending with '!', etc. The price you | > pay for that is that you have to put spaces in LOTS of spaces | > where they are not needed in "run-of-the-mill" languages (such | > as Python) that severely restrict the set of characters usable in | > identifiers. | > a+b this would be an identifiers, so | > a + b is what you must write for addition | > etc, etc. (LISP-ish syntax is different -- if no infix operators | > exist, the space-around-operators issue of course disappears:-). | > | These required whitespaces (and the freedom in variable, procedure.. | names) are also a feature in Tcl. But I'm not much troubled by having to | put in lots of spaces -- the space bar is so easy to hit with the | thumb... | -- | Schoene Gruesse/best regards, Richard Suchenwirth - +49-7531-86 2703 | RC DT2, Siemens Electrocom, Buecklestr. 1-5, D-78467 Konstanz,Germany | -------------- http://purl.org/thecliff/tcl/wiki//Richard*Suchenwirth | AL:The Analytical Engine worketh not! CB:What version dost thou have? | -- | http://www.python.org/mailman/listinfo/python-list | From thomas at xs4all.net Sun Nov 5 09:22:56 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Sun, 5 Nov 2000 15:22:56 +0100 Subject: Python threads In-Reply-To: <3A04A638.A106A55F@tin.it>; from clemente.biondo@tin.it on Sun, Nov 05, 2000 at 01:13:44AM +0100 References: <3A04A638.A106A55F@tin.it> Message-ID: <20001105152256.A27208@xs4all.nl> On Sun, Nov 05, 2000 at 01:13:44AM +0100, ADSL wrote: > I've started using python on friday, ok, little nice language, with poor > db support but nice. 'Poor' DB support ? I'm not sure what you are looking for, but Python DB support is far from poor. There are modules for dbm, gdbm and bsddb (version 1) in the standard library, and many more dbmish modules (bsddb 2, bsddb 3, dbhash, dbf) and modules for other 'common' formats (like all forms of CSV files.) As for SQL databases, it might not exceed Perl DBI in all aspects, but it comes close in many, and suprasses in some ;) There is a common API for DB modules (DB-API), a generic ODBC module (mxODBC) and there are 'native' modules for at least MySQL, PostgreSQL, Oracle, Sybase, Informix, Interbase, Solid and Typhoon. See the Vaults of Parnassus for more information. Just go to http://www.vex.net/parnassus/, and click on 'Databases'. As for little, I'm sure noone will object to that. The fact that the language is little is one of its strong points :) > Now the matter. I've hadn't understand the way python manages threads. I'm > looking for a decent tutorial the threading module, or at least some piece > of code on the subject, any hint? There isn't much to tutor about regarding threads. If you haven't used threads in any other language, they can be tricky, but programming for threads in the Python level is dead easy. The library reference sections on the 'thread' and 'threading' modules tell you how to start threads, how to do locking, and how to get them to end. All your Python code is 'thread safe' automatically, but none of the operations are truly atomic (use locks if you want to ensure data integrity across objects.) You can't corrupt objects by using threads (they protect themselves,) but you might end up with inconsistencies. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From Gareth.McCaughan at pobox.com Fri Nov 17 21:05:22 2000 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: Sat, 18 Nov 2000 02:05:22 +0000 Subject: The origin of Python? References: <8v4cu6$k5u$1@news.nuri.net> Message-ID: June Kim wrote: > I read from Guido's writing that "Python" came from his favourite comedy > show Monty Python. Now I wonder where Monty Python came from, and what it > stands for. Is it a person's name or what? "Monty Python's Flying Circus" was a series of programmes on British television in the 1970s. There was nothing very special about the name; they considered lots of others and that was the best they found. I recently saw (but have completely forgotten where, alas) a list of names they considered and rejected. It doesn't stand for anything. Its very arbitrariness might be symbolic of the deliberately bizarre nature of the programmes, though. -- Gareth McCaughan Gareth.McCaughan at pobox.com sig under construc From euler27182 at my-deja.com Mon Nov 13 17:30:11 2000 From: euler27182 at my-deja.com (euler27182 at my-deja.com) Date: Mon, 13 Nov 2000 22:30:11 GMT Subject: STDIO Questions. Message-ID: <8upq18$le1$1@nnrp1.deja.com> I'm new to Python, and just wondered about the following peculiarities under Windows version 1.6 of Python: ? sys.stdin.read(1) ...Always waits for the carriage return, displaying as many characters as are typed.? Though it does return the specified number of characters, I would expect this function to return execution immediately with a null character if no keystroke has been made.? If I wanted to see a whole line, I would use the .readline() function instead.? How would I implement a stateless keybuffer read (to catch nulls as well)?? I've commonly used this functionality in BASIC and assembly to periodically poll for user input without stopping execution in the main loop, but don't see how to in Python. ? Why doesn't IDLE have a .read() function in the interactive interpreter, to allow input from stdin? ? If I try to redirect stdout to a null file (which has a dummy write function), the sys.stdin.read(1) function still echoes keystrokes to stdout. Is there any possible way to suppress echoing (for password input from the user)? ? Sent via Deja.com http://www.deja.com/ Before you buy. From fgeiger at datec.at Mon Nov 13 10:34:17 2000 From: fgeiger at datec.at (Franz GEIGER) Date: Mon, 13 Nov 2000 16:34:17 +0100 Subject: Distributing Python Code References: <3a0ff4dc@news.xtml.co.uk> Message-ID: <8up1n4$a2d$1@newsreaderm1.core.theplanet.net> If you need to be cross platform, you will distribute the py files themselves. If you want them to run on a MS machine with a Python installation, use your zip archives. If you want them to run on a MS machine w/o a Python installation, use Mac Millan's freezer. Regards Franz GEIGER Nick Trout schrieb in im Newsbeitrag: 3a0ff4dc at news.xtml.co.uk... > I'd like to distribute some Python files. I use Win95/Win2k so Zip archived > files are preferrable/natural for me. > > How portable are Zip files? > > What would be a better solution? > > Regards, > Nick. > > > > From aviada at richfx.com Wed Nov 8 11:57:36 2000 From: aviada at richfx.com (Aviad Arviv) Date: Wed, 8 Nov 2000 18:57:36 +0200 Subject: C++ and Python Message-ID: Hi, I was wondering if there is already a more or less automatic way out there to build Python interfaces to C++ classes. I want to write the Gui in python and the C++ part interact with this Gui. It should be a Python program that use C++ static Lib or Dll. Can you pls send me some examples? Thanks, Aviad From yzhou10 at scu.edu.au Fri Nov 10 01:37:18 2000 From: yzhou10 at scu.edu.au (Yan Zhou) Date: Fri, 10 Nov 2000 17:37:18 +1100 Subject: MySQL with Python? Message-ID: <3.0.2.32.20001110173718.00aef758@students.scu.edu.au> Hi, I am a research student in Australia and trying to put MySQL database tables on webpage with Python. Do you know how to read from or write into a MySQL table with Python? How to put different data fields into table rows on webpage with Python? Best regards Harley From htling at cyberway.com.sg Sat Nov 11 09:58:18 2000 From: htling at cyberway.com.sg (Maurice Ling) Date: Sat, 11 Nov 2000 22:58:18 +0800 Subject: python compiler?? References: <3A04051A.B1A8517B@cyberway.com.sg> Message-ID: <3A0D5E8A.F9788C86@cyberway.com.sg> I think I have to make myself clear again. What I'm looking for is a Python compiler, which compiles the python source into executable binaries. My main intention is not to distribute my source codes and I'm developing for Windows platform. Can someone help?? mauriceling Maurice Ling wrote: > Is there a python compiler somewhere?? > > maurice ling From tismer at tismer.com Sun Nov 5 10:05:15 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 05 Nov 2000 17:05:15 +0200 Subject: Maximum recursion depth in python References: <3a018dad@news.edunet.ru> <8ts7fj$7eb$1@panix6.panix.com> <87bsvyl25s.fsf@hobbes.home.ruud.org> Message-ID: <3A05772B.5C0123CF@tismer.com> Ruud de Rooij wrote: > > aahz at panix.com (Aahz Maruch) writes: > > > I believe that > > Stackless Python has no recursion limits. > > Of course it has. The recursion depth is necessarily limited by the > amount of memory available. Yes. Limited by available memory is the usually auto-applied substitution macro when one reads "no limits". Of course you might argue that the size of the C stack is also just an arbitrary thing that could be made as large as you want, but that's not so practical. Aside, recursion can be completely unlimited if keeping the program state can be done with a finite amount of memory. To be able to do this, your program must be re-written using tail-recursion, and the number of continuations to be kept must be finite. This is not always possible, also we don't have tail recursion in Python yet. (but I believe it is possible, to some extent). ciao - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com From jepler.lnk at lnk.ispi.net Wed Nov 1 18:47:34 2000 From: jepler.lnk at lnk.ispi.net (jepler epler) Date: Wed, 01 Nov 2000 23:47:34 GMT Subject: URLLIB and PROXY References: Message-ID: You have to authenticate with your proxy via the "NTLM" authentication method. This should be documented by Microsoft somewhere, the only authentication method documented in the HTTP standards is "BASIC". Once you've found the documentation, you'll have to extend urllib to give your proxy server the proper NTLM authentication string in the HTTP headers. I suspect that the community would be greatful for a contribution of this nature. Jeff From aleaxit at yahoo.com Thu Nov 9 12:03:02 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Thu, 9 Nov 2000 18:03:02 +0100 Subject: conditionals in lambdas? References: <8tv48r$kn8$1@bmerhc5e.ca.nortel.com> <8uea1701u88@news1.newsguy.com> Message-ID: <8uelcc02gjr@news1.newsguy.com> "Steve Horne" wrote in message news:psgl0t4bvnm5o76phoaqqldrrs44uoafmh at 4ax.com... [snip] > However, did you realise how easy a lazy version is to create... No, I hadn't thought of it -- it *is* neat:-). > Using tuples (which do seem clearer than my list version, and probably > better in other ways to)... > > (no_value,yes_value) [condition] > > This can be adapted as follows... > > ((lambda : no_value, lambda : yes_value) [condition]) () > > That is, the indexing operation selects which lambda to evaluate. > > Of course the lambdas may need some default parameters, and could > easily get a bit awkward syntactically. But it should work. The syntax is rapidly headed towards an "Obfuscated Python Context", yes, but the _concept_ behind it is nevertheless cool. > So with the case using division... > > ((lambda : 0, lambda j=j : 1/j) [j != 0]) () Or, to avoid default-valued parms, ((lambda j:0, lambda j:1/j)[j!=0])(j) Not that readability and clarity change much, here...:-) Alex From aleaxit at yahoo.com Tue Nov 21 03:15:40 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 21 Nov 2000 09:15:40 +0100 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <871ywhmiis.fsf@fangorn.stofanet.dk> <3A0F77DA.40AD3612@engcorp.com> <3A19FBE6.2EC3D9F@engcorp.com> Message-ID: <8vdavb01t12@news2.newsguy.com> "Samuel A. Falvo II" wrote in message news:slrn91k44t.j0u.kc5tja at garnet.armored.net... > On Mon, 20 Nov 2000 23:36:54 -0500, Peter Hansen wrote: > >Quod erat demonstrandum. Dankon, Konrad. :-) > > I just want to see if I can translate this myself, without any Esparanto > knowledge. Please forgive me if I mis-interpretted: "Please demonstrate. > Thanks, Konrad." Is that correct? (Literal: Quote the demonstration [e.g., > put up or shut up]; thanks Konrad). The first three words are of course Latin, not Esperanto. Literally, you could translate them "Which was [what we had] to prove". Particularly in their acronym 'QED', they are generally used to conclude the exposition of a theorem's proof; or, by extension, to comment on some aspect which appears to be, if not a proof, a strong indication of a thesis one is defending. This was not an idiom in either Classical Latin or Mediaeval Scholarship (although it's perfectly correct from a grammatical viewpoint). It appears to have emerged in the very late stages of the Renaissance: Oronce Fine [acute accent on the ending 'e' of the surname], a French astronomer, cartographer and mathematician (also known for coining the name 'Australia'), may have been among the first to use it (he also used a huge variety of other sentences with the same meaning to end his 'Propositions'), around 1550. Isaac Barrow, English mathematician and theologian (best-known as the founder of optical geometry; arguably the first to conceive of integration and differentiation as each other's "inverses", the so-called "fundamental theorem of Calculus"), appears to have been the first to systematically use the acronym 'QED' (around 1660). Alex From duncan at rcp.co.uk Tue Nov 21 06:48:32 2000 From: duncan at rcp.co.uk (Duncan Booth) Date: Tue, 21 Nov 2000 11:48:32 +0000 (UTC) Subject: .readline() - VERY SLOW compared to PERL References: <8uthf2$pjh$04$1@news.t-online.com> <8utnqk02rlq@news1.newsguy.com> <8uu44b$4nc$04$1@news.t-online.com> <8vd94d$mjo$06$1@news.t-online.com> Message-ID: <8FF37B1D6duncanrcpcouk@194.238.50.13> h_schneider at marketmix.com (Harald Schneider) wrote in <8vd94d$mjo$06$1 at news.t-online.com>: >Thanks for your reply. > >The alternate methods posted here (readlines with chunks) cut down the >weak perfomance to nearly the >results, you posted. > >For everyone interested, here are the scripts used for testing: > > Just for interest, I wondered what difference, if any, does it make to the Python scripts you posted if you put everything inside a function so that it uses local variables in place of the global variables? I tried this and, although the times fluctuate substantially on different runs, I got your 5.6 second script running on my test file (48Mb) in 12.66 seconds. My version with local variables took 10.12 seconds. Not a major difference, but possibly worthwhile. Interestingly, most of the speedup comes from using a local variable for string.split. Without this optimisation it takes about 12.06 seconds. Also note that I used the -O command line option as otherwise the times were all about 5 seconds slower. Here is my version: ====================================== import sys, string, time def run(): print "Running..." dbname = 'test.dat' secStart = time.time() db = open(dbname, 'r') read = db.readlines split = string.split while 1: lines = read(250000) if not lines: break for dbline in lines: rs = split(dbline, ';') if rs[0] == 'TEST': print dbline + "\n" break print "DONE!\n" db.close print "Elapsed time: %f sec." % (time.time() - secStart) if __name__=='__main__': run() ======================================== From hf at tangro.de Tue Nov 21 10:23:42 2000 From: hf at tangro.de (Hauke Fath) Date: 21 Nov 2000 16:23:42 +0100 Subject: win32 registry access Message-ID: Hi, while porting a perl script to python, I am experiencing problems with registry access. The function def get_local_reg_key(rpath): root_key = _winreg.HKEY_LOCAL_MACHINE key = _winreg.OpenKey(root_key, rpath) val = _winreg.QueryValue(key) _winreg.CloseKey(key) return val , fed with a valid registry path ("works in perl"), gives me [...] File "./RetroEventHandler.py", line 180, in init db2_home = get_local_reg_key("SOFTWARE\\IBM\\DB2\\GLOBAL_PROFILE\\DB2PATH") File "./RetroEventHandler.py", line 164, in get_local_reg_key key = _winreg.OpenKey(root_key, rpath) WindowsError: [Errno 2] The system cannot find the file specified Searching the usual suspects aka web sites gave nothing. Any ideas? I should add that my python knowledge is no older than a few days. ;-) hauke From pinard at iro.umontreal.ca Mon Nov 27 16:55:11 2000 From: pinard at iro.umontreal.ca (=?ISO-8859-1?Q?Fran=E7ois_Pinard?=) Date: Mon, 27 Nov 2000 16:55:11 -0500 (EST) Subject: jpeg images in python In-Reply-To: <8vbrc4$6gv$1@reader1.imaginet.fr> References: <8vb9df$87a$1@nnrp1.deja.com> <8vbrc4$6gv$1@reader1.imaginet.fr> Message-ID: <20001127215511.4E015231C6@titan.progiciels-bpi.ca> [Gilles Lenfant] > jf = open('myimage.jpg', 'rb') > binaryJPGbuffer = jf.read() > jf.close() Or even more cleanly (in C Python): binaryJPGbuffer = open('myimage.jpg', 'rb').read() which does the same. You even spare `jf', and a few nanoseconds :-). -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From knightsofspamalot-factotum at mail1.stofanet.dk Sat Nov 11 18:03:09 2000 From: knightsofspamalot-factotum at mail1.stofanet.dk (Martin Christensen) Date: 12 Nov 2000 00:03:09 +0100 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> Message-ID: <874s1ei02a.fsf@fangorn.stofanet.dk> >>>>> "Peter" == Peter Hansen writes: Peter> The goals of both Esperanto and Python are ease of learning Peter> (based largely on consistency and clean adoption of rules Peter> beginners will likely have learned elsewhere), compactness, Peter> power of expression, and perhaps to act as a bridge between Peter> otherwise dissimilar contexts. Oni trovas esperantistoj en multaj stangaj lokoj. :-) Martin -- GPG public key: http://home1.stofanet.dk/factotum/gpgkey.txt From aleaxit at yahoo.com Tue Nov 7 07:40:30 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 7 Nov 2000 13:40:30 +0100 Subject: python compiler?? References: <3A04051A.B1A8517B@cyberway.com.sg> <8u2f1i$505$1@news.udel.edu> <3A07CCC0.52105127@cyberway.com.sg> Message-ID: <8u8t7v018mc@news1.newsguy.com> "Maurice Ling" wrote in message news:3A07CCC0.52105127 at cyberway.com.sg... > Well, what I'm really interested in is, is there any python compiler that can > compile python codes into standalone executables? See http://www.mcmillan-inc.com/install1.html -- he offers tools to do that (which are *NOT* "python compilers") and points to a few alternatives (which might conceivably be seen as "compilers" in some sense -- at least, Python2C might be seen that way). Basically, if the goal is "make a standalone executable", it seems to me to be an over-specification error to add that this task must be performed by "a Python compiler"; a "packager", that is able to collect in a single, stand-alone executable the various already-compiled-Python files (.pyc or .pyo) that Python itself builds, plus the .pyc/.pyo/.pyd required by them (from the standard library, other libraries, etc), seems a reasonably acceptable architecture. And this is basically a description of Gordon McMillan's excellent "installer" (or, at least, one of the ways you can make use of it). The section of Gordon's notes that is specifically on stand-alone executables will be found at http://www.mcmillan-inc.com/standalones.html. Note that only in the Windows version does he build _truly_ totally self-contained executables -- "it's not culturally appropriate" (and is technically harder, it seems) to do that for Linux. I'm not sure I understand this (but then, my Linux knowledge dates mostly from 0.99 days -- I have heard executable/object formats have indeed been changed drastically since those days). But it's an issue of C-written DLL's (.so's, in Linux), not of any Python code -- apparently it's hard/inappropriate to package up an executable together with all the DLL's it needs. Actually, very few do that in Windows, either -- at the very least, kernel32.dll, etc, are _never_ packaged together with the .exe (or else the latter would run on just ONE possible Windows configuration...), so, there is really no such thing as "a truly, fully stand-alone exe". But if it's OK for the C-written DLL's to remain "outside" (to be unpackaged side-by-side with the almost-standalone EXE, e.g. in the same directory), and you're only worried about Python-code (and its compiled forms), then Gordon's installer is probably the best available solution today. Alex From Gareth.McCaughan at pobox.com Sun Nov 5 17:08:27 2000 From: Gareth.McCaughan at pobox.com (Gareth McCaughan) Date: Sun, 5 Nov 2000 22:08:27 +0000 Subject: Python 2.0 Attempt to execute test_socket.py fails References: Message-ID: Tim Peters wrote: > in-general-if-you-don't-get-a-blue-screen-crash-windows-is-working- > as-designed-ly y'rs - tim Isn't that the wrong way round <0.3 wink> ? -- Gareth McCaughan Gareth.McCaughan at pobox.com sig under construc From thomas at xs4all.net Wed Nov 1 17:06:39 2000 From: thomas at xs4all.net (Thomas Wouters) Date: Wed, 1 Nov 2000 23:06:39 +0100 Subject: str vs repr Re: Rounding Bug in Python 2.0! - ugh In-Reply-To: <8tpsdm224oa@news2.newsguy.com>; from aleaxit@yahoo.com on Wed, Nov 01, 2000 at 01:27:07PM +0100 References: <8tncdk$frm$1@news2.ottawa.cyberus.ca> <8tpsdm224oa@news2.newsguy.com> Message-ID: <20001101230639.N12812@xs4all.nl> On Wed, Nov 01, 2000 at 01:27:07PM +0100, Alex Martelli wrote: [ The str()-versus-repr() issue in the Python REPL ] > Given the number of posts about this, including ones from > experienced people, this might perhaps help. How does > one open a PEP about it...? You open a PEP by writing one ;) Once you have a draft, you mail it to Barry, who will give it a number, or maybe reject it. The idea to have user-definable functions to do the P in 'REPL' was brought up before, on python-dev, but I don't recall what came of it. (That, in itself, suggests a PEP would be useful :-) The current setup makes it less-than-trivial, but not impossible. The question is, do you have enough time to waste on a PEP ? :-) Still-trying-to-catch-up-on-the-three-PEPs-that-carry-my-name-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From aleaxit at yahoo.com Wed Nov 1 12:32:51 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Wed, 1 Nov 2000 18:32:51 +0100 Subject: Expansion of the __debug__ and pass concepts References: <8tn72t$8s6$1@nnrp1.deja.com> Message-ID: <8tpsdq424oa@news2.newsguy.com> "Alex" wrote in message news:etdy9z4wnx3.fsf at oliver.mit.edu... > > You're going to have to rototill your code to do things this way, but > you may be able to automate most of the job, and it doesn't require > changes to the interpreter: > > If you compile with -O, I believe __debug__ gets automatically set to 0, > and blocks like: > > if __debug__: > DBG(DBG.DM_DEFAULT, "The value for x is : %d", x) > > get optimized away during compilation. Yes! And as long as your DBG function returns any true value, you may also choose to express this as assert DBG(etc) This is not substantially more compact than if __debug__: DBG(etc) but is roughly equivalent. Alex From timo at alum.mit.edu Thu Nov 2 21:42:07 2000 From: timo at alum.mit.edu (Timothy O'Malley) Date: Fri, 03 Nov 2000 03:42:07 +0100 Subject: ANN: timeoutsocket.py 1.8 Message-ID: hola. There is a new version of timeoutsocket.py available. This version fixes two bugs: 1- Correct connect() handling on Windows 2- The blocking-ness of a socket is now preserved. Thus, if you use socket.setblocking(), timeoutsocket.py now does the right thing. I would recommend upgrading if you use Windows or if you use the setblocking() method. URL: http://www.timo-tasi.org/python/timeoutsocket.py happy networking.. From faisalr at telkom.net Sun Nov 19 13:47:52 2000 From: faisalr at telkom.net (Faisal Rudijanto) Date: Mon, 20 Nov 2000 01:47:52 +0700 Subject: (no subject) Message-ID: <001d01c05259$48ee07e0$1bcb82cb@faisal> subscribe -------------- next part -------------- An HTML attachment was scrubbed... URL: From eq3pvl at eq.uc.pt Fri Nov 17 06:06:19 2000 From: eq3pvl at eq.uc.pt (Pedro Vale Lima) Date: Fri, 17 Nov 2000 11:06:19 +0000 Subject: "Embedded" Python? References: <3A1508A9.2F8EB4A3@schlund.de> Message-ID: <3A15112B.DDE9E5EA@eq.uc.pt> Carsten Gaebler wrote: > Hi! > > Is there something like "embedded" Python for Apache, i.e. Python > embedded in HTML pages like PHP? > > Regards > Carsten. Yes, see modsnake.sourceforge.net and www.modpython.org From aleaxit at yahoo.com Mon Nov 6 15:21:52 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Mon, 6 Nov 2000 21:21:52 +0100 Subject: change a string in text file then write it References: <3A0660E4.2975@bitstream.net> <8u5por01upv@news2.newsguy.com> <8u6omp$3pu$1@animus.fel.iae.nl> Message-ID: <8u746h0f9u@news2.newsguy.com> "Carel Fellinger" wrote in message news:8u6omp$3pu$1 at animus.fel.iae.nl... > Alex Martelli wrote: > ... > > for line in fileinput.input("thefile.txt", inplace=1): > > if re.search(myre, line): > > line = string.replace(line,'foo','bar') > > print line > > Ah, this must be one of Alex favorite typos, omitting a trailing ',' :) yes, I keep doing that (AND omitting other needed trailing stuff as well -- see a recent post where I had managed to match 'all strings starting with 0 or more digits'...!-). Actually, I did it on purpose (what, ME fall into such a simple trap?!) to see if anybody would notice -- Carel wins the prize, and a special Jury mention for the excellent explanation that follows...: > You see, the last line should actually read: > print line, #note the trailing "," > > the lines you get from "fileinput.input('thefile.txt', inplace=1)" have > a trailing end-of-line symbol embedded if it was there in the input file. > The print statement adds a trailing end-of-line symbol regardless of > whether the string to write ended with one, *unless* you end the print > statement with a comma, then this adding is omitted. Alex From gherron at aw.sgi.com Thu Nov 9 18:40:43 2000 From: gherron at aw.sgi.com (Gary Herron) Date: Thu, 09 Nov 2000 15:40:43 -0800 Subject: Zope - Python Method (internal) References: <20001109174431.28583.00000350@ng-bk1.aol.com> Message-ID: <3A0B35FB.14E40937@aw.sgi.com> Hemau wrote: > > I?m really confused! > Reading the Zope Book on www.zope.org I?m told about a product > called 'Python Method (internal)' or 'Restricted Python Methon' , which > can added like other products to a Zope-site and with which You > can add native Python Methods easily to Zope. I use Zope 2.2.2 for Win32 > and I cann't find this product. Where is it? > Please help! I asked the same question of Shane Hathaway and got back the following response. > Gary Herron wrote: > > I'm confused about the current state of Python Methods. Your voting > > page calls them a "relatively new concept" and the Zope Book talks about > > them as if they already exist, but I can't find any way to create one in > > my current version of Zope 2.2.2 (binary release, python 1.5.2, > > win32-x86). > > "Relatively new", in this case, means "created last year". Compared > with DTML, the concept is quite new. > > > So thinking that they were being developed for the next version of Zope, > > I downloaded the CVS snapshot just minutes ago, and can't find any > > mention of them there either. Am I being stupid and missing something > > obvious? > > > Python methods are intended for the next version of Zope but are > > currently in a different CVS repository. > > > Even if they are not stable, I would like to play with them in > > preperation of a project I hope to commence soon. > > I hope the people in charge can get the next release together soon. > > Shane > -- > Dr. Gary Herron > 206-287-5616 > Alias | Wavefront > 1218 3rd Ave, Suite 800, Seattle WA 98101 From peter at engcorp.com Sun Nov 19 10:06:36 2000 From: peter at engcorp.com (Peter Hansen) Date: Sun, 19 Nov 2000 10:06:36 -0500 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <87snowl5f0.fsf@fangorn.stofanet.dk> <3A16E158.A8DB692@engcorp.com> <3A176E90.CC66D305@engcorp.com> Message-ID: <3A17EC7C.7C703137@engcorp.com> Steve Lamb wrote: > > On Sun, 19 Nov 2000 01:09:20 -0500, Peter Hansen wrote: > >I judged "Me, me" incorrect, with the full weight of a single > >individual's opinion backing up my view, which is all Usenet has ever > >required. :) > > T'hell with that, you're wrong. Doesn't even need the conviction of an > opinion, just the desire to debate. :P Ouch, I think you've won! Your logic is unassailable. :-) From OnlineRomance at msn.com Tue Nov 21 15:48:56 2000 From: OnlineRomance at msn.com (OnlineRomance at msn.com) Date: Tue, 21 Nov 2000 14:48:56 -0600 Subject: Enjoy... Message-ID: <211100144856@msn.com> Friend Finder is for active singles who want to meet others for romance, dating, friendship and more! With over 4,000,000 registered members and thousands of new people joining each day, your special someone may be waiting for you now! Click the link below to join for free - it's fast, easy and anonymous! http://63.105.6.24/alenu (This message is NOT spam. If you have any problems with the content of this message please, contact me asap at Ohmyisitreal at aol.com) From aleaxit at yahoo.com Tue Nov 7 10:10:55 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 7 Nov 2000 16:10:55 +0100 Subject: How can I tell when a string is in fact a number? References: Message-ID: <8u962a01qfo@news1.newsguy.com> "Julio Flores Schwarzbeck" wrote in message news:mailman.973541120.11746.python-list at python.org... > > What numeric system uses two dots? ;) The traditional Italian one does (although they're differently-spaced). 1.234.567 is one million, twohundred and thirtyfour thousands, fivehundred and sixtyseven (decimals, if any, follow after a _comma_; basically, you can think of it as having the dot and comma roles exchanged wrt traditional British usage). Remember you need to pass the third argument as true to locale.format to see this...: >>> import locale >>> locale.setlocale(locale.LC_ALL, "IT") 'Italian_Italy.1252' >>> locale.format("%d", 12345678,1) '12.345.678' >>> locale.format("%12.2f", 12345678.9,1) ' 12.345.678,90' >>> Without that '1' at the end, you wouldn't see the dots, since 'grouping' defaults to 0 (that's the third argument to locale.format...). Alex From robert.brotherus at thermobio.com Wed Nov 1 09:09:14 2000 From: robert.brotherus at thermobio.com (Robert Brotherus) Date: Wed, 01 Nov 2000 14:09:14 GMT Subject: Embedding Python with debug-option Message-ID: I am trying to embed python 2.0 to my MS VC++ 6.0 application. When I try to make a debug build of the application, the linker gives an error: LINK : fatal error LNK1104: cannot open file "python20_d.lib" The required file python20_d.lib is not found anywhere in the python2.0 distribution. Where could I get it? Or is there any other solution to the problem? (There are no problems when I compile a release build, but that is not satisfactory since then I can't do any debugging) Robert.Brotherus at thermobio.com From boulderlin at my-deja.com Fri Nov 17 00:31:51 2000 From: boulderlin at my-deja.com (boulderlin at my-deja.com) Date: Fri, 17 Nov 2000 05:31:51 GMT Subject: Python 1.5.2 and IDLE Message-ID: <8v2fs8$pdf$1@nnrp1.deja.com> subject: Python 1.5.2 and IDLE Hi, I am learning Python. I am running SuSE linux 6.4. When I type "python" at the command prompt I could get the basic interactive mode with the usual ">>>" prompt, and I could also confirm that the version I have is Python 1.5.2 (#1, Mar 11 2000). The problem is that I could not start the IDLE mode. When I type "idle" at the shell (not the python) prompt I got "command not found" error. I ran "whereis idle" and it found nothing. >From what I read, e.g., "The Quick Python Book" by Harms and McDonald, the IDLE should come with Python 1.5.2 and, as long as the relevant Tcl/Tk tool is installed, one should be able to run it without much futher effort. My experience seems to suggest this is not the case. By the way, I did select the relevant Tcl/Tk package for Python during Linux installation. Searching through the files on my system I found only the following directory /usr/doc/packages/python/Tools/idle containing files such as idle.py that resemble what I am looking for. However none of them are executables, and they are in a /doc directory that is normally NOT searched anyway. I am afraid that there is one (or two) step of configuration or compilation I have yet to do to get the IDLE to work, but what is that step? Any helpful suggestios/hints are greatly appreciated. yizi xu Sent via Deja.com http://www.deja.com/ Before you buy. From paulb at infercor.no Wed Nov 8 15:45:30 2000 From: paulb at infercor.no (Paul Boddie) Date: Wed, 08 Nov 2000 21:45:30 +0100 Subject: wxPython, Solaris and linking C++ objects and libraries Message-ID: <3A09BB6A.1B4389DE@infercor.no> Hello, I have been having some "fun" trying to get wxPython, wxGTK, and Python working together on Solaris. In what I believe to be a general linking problem with C++-based objects and libraries on Solaris (and possibly other platforms), I have been experiencing all sorts of linking errors - some of which are presumably my fault, but surely not all of them. ;-) After seeing similar problems in the Bayonne project, and reading the recommended advice (use the -fPIC flag when compiling sources and use GNU binutils for good measure), I think I have managed to get beyond the missing symbol problems, where obvious Python symbols cannot be found when importing parts of wxPython, to a point where I am treated to a segmentation fault. Actually, the demo.py file runs, showing the picture of John Cleese, before the segmentation fault happens. Are there any opinions on how these problems should be dealt with when building Python and extensions? Should the detection of Solaris in Python's configure script result in modified compiler options? What about using the -b flag with ld, rather than the -G flag? I had to modify Makefiles by hand and recompile various extensions to get even this close with wxPython! Any advice? Regards, Paul From nas at arctrix.com Mon Nov 27 02:55:11 2000 From: nas at arctrix.com (Neil Schemenauer) Date: Sun, 26 Nov 2000 23:55:11 -0800 Subject: Python mailing list/usenet bridge. In-Reply-To: <200011270935.DAA21870@x69.deja.com>; from sbrunning@bigfoot.com on Mon, Nov 27, 2000 at 09:35:32AM +0000 References: <200011270935.DAA21870@x69.deja.com> Message-ID: <20001126235510.A11363@glacier.fnational.com> On Mon, Nov 27, 2000 at 09:35:32AM +0000, Simon B. wrote: > The Python mailing list/usenet bridge seems to be down at the moment, > and has been since last Wednesday. Any have any idea who to contact in > order to get this sorted? I believe the problem is with CNRI's news feed and not with the gateway. CNRI gets its news through uu.net. I'll see if I can someone to look into it. Neil From dag at orion.no Tue Nov 7 05:41:06 2000 From: dag at orion.no (Dag Sunde) Date: Tue, 07 Nov 2000 10:41:06 GMT Subject: how do I compiled my text files to have a .exe suffix References: <8u8g36$s0$1@slb7.atl.mindspring.net> Message-ID: <6%QN5.4224$ZL5.526054@juliett.dax.net> You don't! Python is an interpreted language. But, there is a tool that I don't remember the name of, that creates an .exe-file with the same name as your Python-script, which kick-start the scripts for you. Dag. "Madman" wrote in message news:8u8g36$s0$1 at slb7.atl.mindspring.net... > I just started to learn python I have made some simple widgets I can run > them through the dos windo but i would like to compiled the file so it would > have a .exe so i can run it with a icon. where do i get this compiler > > thanks madman > > From lobozc at my-deja.com Fri Nov 3 16:14:42 2000 From: lobozc at my-deja.com (lobozc at my-deja.com) Date: Fri, 03 Nov 2000 21:14:42 GMT Subject: Benefits of continuation? References: <8ttral$o5t$1@nnrp1.deja.com> <8tu4do$vq9$1@nnrp1.deja.com> <8tv61a$gmt$1@news.nuri.net> Message-ID: <8tv9rp$gt$1@nnrp1.deja.com> actually, i think that continuations would be very important to the core use of python! python is doing plenty of string processing, scanning etc - and this is where continuations can be used very effectively. For examples see the icon programming language with its generator approach. There is nothing there you couldn't do with appropriately crafted objects, but you can reduce your line count by order of magnitude by not having to code that. Probably the reason why compiler people are interested in that. so it's more than simulations (rather smaller niche than text processing) continuations would also give python a larger advantage over Perl and many smaller (in reach) languages. In article <8tv61a$gmt$1 at news.nuri.net>, "June Kim" wrote: > > "Courageous" wrote in message > news:ar160tcnr3vdocehs12rg7u53tfhjohdhl at 4ax.com... > > > > >I think this remark above is very true. Context switches was the very > > >first brain wave I had. Makes me wonder whether continuation actual ever > > >will be used directly. Indirect usage ("under-water", hidden, etc.) > > >seems more likely. > > > > Right. You have to understand that they are a very useful > > mechanism upon which you can build alternate flow-control > > constructs. I personally use them for context-switching in a > > simulation I wrote. They are, ah.... VERY VERY FAST. > > > > Could I have a look at some snippets of examples to > get the feeling of how it works in reality? It would be > really nice 'cause reading those rather abstract documents > gives me only vague images of the castle in the air. > > Best regards, > > June. > > > An attempt to do the same thing in Java would cause the > > JVM to die a horrible death with 1/10th the thread-load. > > > > > > > > C// > > > > > > > > > > Sent via Deja.com http://www.deja.com/ Before you buy. From nickb at fnord.io.com Sun Nov 19 01:45:54 2000 From: nickb at fnord.io.com (Nick Bensema) Date: Sun, 19 Nov 2000 06:45:54 GMT Subject: What is Python? References: <39C92845.10D86E5D@seebelow.org> Message-ID: In article , Tim Hammerquist wrote: >Grant Griffin wrote: >> To be fair, though, one of the few things I miss about Perl is its easy >> use of REs: that's obviously one of its great strengths. However, >> Python's approach of providing that same functionality as a module, not >> as a fundamental language feature, is definitely more "Pythonic": the >> result is significantly more verbose, but that's exactly the point: >> there's quite a lot of "implicit is worse than explicit" (to coarsely >> paraphrase) baggage that comes along with Perl's approach. > >This is probably one of the side-effects of Larry's styling Perl after >natural language. I should say that I'm not only a computer language >fan, but also a foreign language major with several Romance languages as >a hobby. Might that be why my mind appears *twisted* in liking Perl's >approach? You're not twisted. If you program useful things in False, that's twisted. I looked at Perl and thought, "man, this is confuzling. This is like no programming language I know. And like all of them. It's nuts." Then I heard about how Mr. Wall modeled it on human language, and suddenly it all made perfect sense. Perl is the computer equivalent of English, in a historical sense. In contrast, Python looks to me like Esperanto. It's meant to give everyone equal footing, and be easy to learn and dive right into, while at the same time it can be wordy and cumbersome. But I'm still waiting for a computer language that uses prepositions instead of commas. Besides, of course, c-b-l. -- Nick Bensema ICQ#2135445 ==== ======= ============== GAME OVER CONTINUE? CREDIT 1 From fig at monitor.net Mon Nov 6 15:17:04 2000 From: fig at monitor.net (Stephen R. Figgins) Date: Mon, 06 Nov 2000 12:17:04 -0800 Subject: Is Python any good with MySQL? References: Message-ID: <3A0711C0.562B0FF3@monitor.net> Jon Ribbens wrote: > I have extensive experience with PHP, which has eventually driven me > to give up on it and move to Python. I really, really dis-recommend it. Could you contrast the two for us, and why it is you have moved to python? Stephen R. Figgins From sholden at holdenweb.com Mon Nov 6 08:46:47 2000 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 06 Nov 2000 08:46:47 -0500 Subject: Help, Search and Substitute References: <8tcp98$t79$1@la-mail4.digilink.net> Message-ID: <3A06B647.28A714E6@holdenweb.com> Greg Jorgensen wrote: > [request for key substitution snipped] > > I just wrote something similar to do bulk mailings from templates and merge > files. My first version used re.sub but was too slow, but this technique is > fast enough: > > # break the template into list of chunks that are either plain text or > {field_name} > rx = re.compile(r'(\{[a-zA-Z0-9_]+\})') > chunks = rx.split(template) > > # values dict contains field_name: value entries, i.e. > values = {'NAME':'Greg', 'PHONE':'503-555-1212', ....} > > # look at each chunk and change {field_name} to merged value > message = [] > for s in chunks: > if s and s[0] == '{' and s[-1] == '}': # {field_name} > s = s[1:-1] # strip surrounding {...} > s = values.get(s, s) # get value of field_name, or field_name if > not in merge dict > > message.append(s) > > # put merged message back together > ''.join(message) # bizarre join syntax > > print message > > -- > My complete mailmerge program handles nested {...} and will recursively > process the message until all {FIELDS} are replaced; this allows {...} to > appear in the merge file as well as the template. > In simpler cases, which do not have your requirement for nesting and recursion, one possible optimization would be to simply replace all "{" with "%(", and all "}" with ")s", for example turning "This is {KEY}'s value: {VALUE}" into "This is %(KEY)s's value: %(VALUE)s" then you can use the "%" string formatting operator with your table as right argument to have all the substitutions made in a single pass" >>> "This is %(KEY)s's value: %(VALUE)s" % {"KEY": 'string', "VALUE": '3.14159'} "This is string's value: 3.14159" regards Steve -- Helping people meet their information needs with training and technology. 703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/ From dalke at acm.org Sun Nov 5 21:38:59 2000 From: dalke at acm.org (Andrew Dalke) Date: Sun, 5 Nov 2000 19:38:59 -0700 Subject: Python with XML opinion? References: Message-ID: <8u55in$hps$1@slb1.atl.mindspring.net> Chris wrote: >I was just looking for an opinion about learning Python in association with >XML. I am new to programming, and from what I have found it seems either >Python or Pearl would be my best bet to begin to learn programming. Thanks >for any info. Sean McGrath's book "XML Processing With Python" may be relvant for you. See http://www.bookpool.com/.x/dgf2z8pph8/sm/0130211192 Andrew dalke at acm.org From johannes at zellner.org Sun Nov 5 21:03:44 2000 From: johannes at zellner.org (Johannes Zellner) Date: 6 Nov 2000 02:03:44 GMT Subject: lambda & scope Message-ID: Hi, this fails: def fred(scale): v = [1, 2, 3] v = map(lambda x: x * scale, v) NameError: There is no variable named 'scale' how can I make it working ? -- Johannes From fredrik at effbot.org Tue Nov 7 11:25:52 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Tue, 07 Nov 2000 16:25:52 GMT Subject: how do I highlight in emacs References: Message-ID: Henrik M?rtensson wrote: > I'm wondering how I can highlight the python syntax > in emacs 20.7 (win nt) python-mode.el (in case you don't have it), and instructions on how to use it can be found at: http://www.python.org/emacs/python-mode/ From vonWedel at lfpt.rwth-aachen.de Sat Nov 4 06:41:02 2000 From: vonWedel at lfpt.rwth-aachen.de (vonWedel at lfpt.rwth-aachen.de) Date: Sat, 4 Nov 2000 12:41:02 +0100 Subject: Excel file format Message-ID: Hello, I want to transform data into Excel files using Python, not just data but also workbooks, etc.. Is there any module facilitating this? On a Windows-machine I would simply use Excel's COM interface to do this, but I'm on unix. Is the Excel file format documented somewhere? Lars -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkraska1 at san.rr.com Fri Nov 17 03:00:52 2000 From: jkraska1 at san.rr.com (Courageous) Date: Fri, 17 Nov 2000 08:00:52 GMT Subject: Internet C++ and Python? References: <8v2m28$g8a@micky.ibh-dd.de> Message-ID: >The most interesting point to me is the possibility to compile python >directly into icvm-bytecode just like Jython into Java bytecode but with the >difference of a higher performance. Maybe, but keep in mind that the very dynamicity of python is also its downfall when it comes to performance. Python won't, as it stands, compile to bytecode with performance anything resembling Internet C++. >So far the only thing about Python I dislike is the slow performance for >some tasks. I've heard Vyper is faster than vanilla Python. But that aside, I believe you will have to wait on some fairly heavy-duty compiler technology, man. Getting dynamic languages to perform well is a black art. C// From gregj at pobox.com Sat Nov 18 16:22:39 2000 From: gregj at pobox.com (Greg Jorgensen) Date: Sat, 18 Nov 2000 21:22:39 GMT Subject: Find file functionality References: <3a15b668.361990264@news.earthlink.net> Message-ID: "Robert Gottlieb" wrote in message news:3a15b668.361990264 at news.earthlink.net... > Hi all, > > We are writing a tool that will need to look for the existence of a > file in a directory hiearchy. We need to be able to run on both > Solaris and Windows NT. Currently we are looking at using > os.path.walk to crawl the tree. The problem is that there is no way > to tell it to stop, or at least we haven't figured that out yet. > > Does anyone know of a way to "find file" that is os generic? > Or does anyone know how to get os.path.walk to stop once a file is > found? You may have to tweak this code to make it generic across platforms. It works on my Win 2000 system. My solution is to define a new exception type for my visit function to raise when it finds the desired file. I hope this helps. --- import exceptions import os.path # new exception to indicate file found class FileFound(exceptions.Exception): def __init__(self, args=None): self.args = args # visit function for os.path.walk # pass name of desired file in target def visit(target, dirname, names): # print dirname for name in names: path = os.path.join(dirname, name) # print path if os.path.isfile(path) and (os.path.normcase(name) == target): raise FileFound, path break # search disk starting at root of C drive # target is the name of the file to look for target = 'resume.doc' try: os.path.walk('C:\\', visit, os.path.normcase(target)) except FileFound, path: print "found at %s" % path --- -- Greg Jorgensen Deschooling Society Portland, Oregon, USA gregj at pobox.com From dsh8290 at rit.edu Thu Nov 16 11:42:22 2000 From: dsh8290 at rit.edu (D-Man) Date: Thu, 16 Nov 2000 11:42:22 -0500 Subject: What is the differenace ? In-Reply-To: <3A1399C0.B66D87B2@obop.com.pl>; from gawron@obop.com.pl on Thu, Nov 16, 2000 at 03:24:32 -0500 References: <3A1399C0.B66D87B2@obop.com.pl> Message-ID: <20001116114222.E5783@westsidecnc.rh.rit.edu> If you are familiar with C++ or Java : class A { static int i = 1 ; int j ; A( ) { this.j = 2 ; } } Egbert was correct in his explanation, but I want to clarify it a little. The variable 'i' only has 1 copy for all instances of the class. Although references and objects being the way they are in python it doesn't work quite the way the example C++/Java code works. If you're not familiar with C++/Java, the 'static' keyword means that there is only 1 variable named 'i' that all instances of class A share. In C++/Java you can perform any operations on 'i' that you would do on any int and it remains shared. This is because C++ allocates 1 block of memory and you are modifying the memory as you please. (I'm not sure what the Java implementation does, but I believe it has the same semantics). Here's a sample of my test in the interpreter: >>> class A : .. i = 1 .. def __init__( self ) : .. self.j = 2 .. >>> a = A() >>> b = A() >>> a.i 1 >>> b.i 1 >>> b.i = 3 >>> b.i 3 >>> a.i 1 since 'i' is a reference to the object 1, the assignment doesn't work like the C++/Java would have you expect >>> class A : .. i = [1] .. def __init__( self ) : .. self.j = 2 .. >>> a = A() >>> b = A() >>> a.i [1] >>> b.i [1] >>> b.i[0] = 2 >>> b.i [2] >>> a.i [2] because the reference hasn't change, only the list contents, it works the way the C++/Java code would (think of the list as a pointer here) >>> b.i = [4] >>> a.i [2] once again, the assignment changes the reference of only 1 of the i's >>> dir ( A ) ['__doc__', '__init__', '__module__', 'i'] >>> A.i [2] >>> To get 'i' to behave like a static variable you need it to be a reference to a reference to the data. That way i will never change, only the reference it refers too, preserving the sharing. Would anybody like to contribute a more elegant way that using a list as a "pointer" ? -D On Thu, 16 Nov 2000 03:24:32 Przemys?aw G. Gawro?ski wrote: | Lets say we have a class like this one: | | class A: | i = 1 | def __init__ (self): | self.j = 2 | | When I create an object of such class (lets say v), calling dir( v ) I | get: | | ['j'] | | but I can also access the variable i what is the difference between them | ( i and j ) and why the variable i isn't listed ??? | | Thanks Przemek From aleaxit at yahoo.com Fri Nov 10 11:04:59 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Fri, 10 Nov 2000 17:04:59 +0100 Subject: How to make a conditional import??? References: <8ugvjf$25p$1@news2.iabg.de> Message-ID: <8uh6bk04jv@news2.newsguy.com> "Peter Arwanitis" wrote in message news:8ugvjf$25p$1 at news2.iabg.de... [snip] > def selectProjectType(): > #... skipped > if projectType == 'phys': > from pyhsModule import * > else: > from logicModule import * [snip] > everybody know the effect... the import statement in selectProjectType() is > only processed locally! Yep. > But I need it global, like the string import... > > PLEASE: I need a quick solution, and not a code-philosophy-thread :-) > I know, that I can make it better on other ways (and without from...) Yeah, the from is the killer -- else, a simple 'global' for the modulename you're importing should suffice. > BUT is there a obfuscated solution to make this import happen in global > scope??? It's not so much obfuscated as gross, but...: using exec "from logicModule import *" in globals() instead of from logicModule import * should, I think, give you the effect you desire (*shudder*). Or else, if you know you're in a module named 'silly'...: import silly import logicModule silly.__dict__.update(logicModule.__dict__) I hope *this* one is sufficiently obfuscated for you...:-). There are several variations possible on these (bad) ideas, of course. Alex From aleaxit at yahoo.com Tue Nov 21 03:24:08 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Tue, 21 Nov 2000 09:24:08 +0100 Subject: Why is "while" ticking me off??? References: <39DD15A1.442E5A33@ix.netcom.com> <39dd2419.1980055@news.geeksnet.com> Message-ID: <8vdbf701tau@news2.newsguy.com> "Tyler Eaves" wrote in message news:39dd2419.1980055 at news.geeksnet.com... > On Thu, 05 Oct 2000 19:58:25 -0400, Thomas Gagne > wrote: > > This works: > > a=fp.readlines() > for x in a[]: > do something No, it's a syntax error. But if you remove the empty brackets on the for-statement line: for x in a: then it does work fine. Alex From michael at stroeder.com Thu Nov 9 03:05:53 2000 From: michael at stroeder.com (Michael =?iso-8859-1?Q?Str=F6der?=) Date: Thu, 09 Nov 2000 09:05:53 +0100 Subject: C++ and Python References: <8uc274$lmu$1@news.IAEhv.nl> Message-ID: <3A0A5AE1.41872D31@stroeder.com> Hans Brand wrote: > > Check out www.swig.org You might also want to check out Python-SIP developed by the PyQt/PyKDE people. "description: SIP is a tool to generate C++ interface code for Python. It is similar to SWIG, but uses a different interface format. It was used to build PyQt and PyKDE, and has support for the Qt signal/slot mechanism." Ciao, Michael. From robin at alldunn.com Mon Nov 13 14:01:20 2000 From: robin at alldunn.com (Robin Dunn) Date: Mon, 13 Nov 2000 19:01:20 GMT Subject: wxPython: EVT_KEY_DOWN isn't caught References: <8ugpvu$qa5$1@nnrp1.deja.com> Message-ID: <8updpq$a8i$1@nnrp1.deja.com> In article <8ugpvu$qa5$1 at nnrp1.deja.com>, rerwig at my-deja.com wrote: > Issueing the following code (cut and pasted from demo code) doesn't seem > to catch the EVT_KEY_DOWN. What am I doing wrong? > The key events are sent to the window with the focus, and since it is not a "command" event it is not propogated up the containment hierarchy, which is why you are not seeing it in your handler attached to the frame. In your example the focus is problably on on of the text controls. You can hook an event handler to any window just by using it as the first parameter in the EVT_* call. Any callable object can be used, even methods of some other window such as your frame. -- Robin Dunn Software Craftsman robin at AllDunn.com http://wxPython.org Java give you jitters? http://wxPROs.com Relax with wxPython! Sent via Deja.com http://www.deja.com/ Before you buy. From fredrik at effbot.org Mon Nov 13 16:32:46 2000 From: fredrik at effbot.org (Fredrik Lundh) Date: Mon, 13 Nov 2000 21:32:46 GMT Subject: bad python modules References: <8uph05$d64$1@nnrp1.deja.com> Message-ID: <26ZP5.5817$jv2.693024@newsc.telia.net> "sp00fD" wrote: > In perl, the CGI module to be specific, you have cookie capability > built in. Why not with the python cgi module? Why must I get a > seperate (non-standard, not as good) module to handle cookies? python 2.0 ships with a cookie module, documented here: http://www.python.org/doc/current/lib/module-Cookie.html if you have found bugs in that module, please report them via the sourceforge bug tracker: http://sourceforge.net/bugs/?group_id=5470 > Sending mail using the smtp module leaves an empty subject line > and occassional missing characters or extra spaces never seen that. maybe you could post a simple test script? From arildh at stud.cs.uit.no Mon Nov 20 08:37:42 2000 From: arildh at stud.cs.uit.no (Arild Hansen) Date: Mon, 20 Nov 2000 14:37:42 +0100 Subject: How to play back wav files in python References: <3A0FE559.D84AAE85@speech.kth.se> <3A12891F.CA27D0DB@stud.cs.uit.no> Message-ID: <3A192926.543650D5@stud.cs.uit.no> "Jason F. McBrayer" wrote: > >>>>> "AH" == Arild Hansen writes: > > AH> I'm trying to do some simple audio manipulation (play wav files etc.). I > AH> know about the Snack Toolkit, but is there any simpler way to do this? It > AH> seems like an overkill to install a complete toolkit just for playing a wav > AH> file in a small application. I use python 2.0c1 under Linux (RedHat). > > Python 2.0 has a linuxaudiodev module. You can also use PyESD. > > -- > +----------------------------------------------------------------+ > | Jason F. McBrayer jmcbray at carcosa.net | > | The scalloped tatters of the King in Yellow must hide Yhtill | > | forever. R.W. Chambers _The King in Yellow_ | Hmm, the linux audiodev modules (or simply audiomodule) shipped with python 2.0 does not support playback of soundfiles. Or this is at least what I think, but I'm not a sound guru. It seems like the audiodev modules only support manipulating raw audiodata. What I need is a simple way to play back some wav files and I need to do this in a non-graphical environment. This means that I cannot use the Snack toolkit. I would also like to avoid having to use a systemcall and a third-party soundprogram such as "play". I can very well use C-code with a simple python wrapper around it but ultimately I would like to avoid having to install any code. In other words: I need some simple code that I can include directly into a non-gui python application to allow me to play back wav files. I run python 2.0c1 on Linux Redhat 7.0. All help is welcomed, Arild From menno at infinitum.nl Mon Nov 6 08:18:10 2000 From: menno at infinitum.nl (DamageCase) Date: Mon, 6 Nov 2000 14:18:10 +0100 Subject: Zope Login Message-ID: <8u6b5p$dei$1@cyan.nl.gxn.net> Hello, I'm trying to make a login with zope by using a form instead of the prompt you normaly get , where can I find some tutorials on that ? I'm still a pretty newbie when it comes to zope 'n stuff . I hope someone can help me out here thnx, Menno From colin at programmedintegration.com Mon Nov 6 13:09:35 2000 From: colin at programmedintegration.com (Colin Meeks) Date: Mon, 06 Nov 2000 18:09:35 GMT Subject: Getting PIL to work for Windows References: <36qd0t4rhe01c2rhd4agjne27q6qqpn130@4ax.com> Message-ID: Thanks Dale all sorted now. Now to get converting my 300 images to thumbails :-) Colin "Dale Strickland-Clark" wrote in message news:36qd0t4rhe01c2rhd4agjne27q6qqpn130 at 4ax.com... > "Colin Meeks" wrote: > > >Thanks for that, I found the solution at > >http://x65.deja.com/getdoc.xp?AN=657505052&CONTEXT=973512335.2040332299&hit n > >um=3 > > > >however I still have a problem. When I execute the following code : > > > >import Image > > > >outfile = "image10_tn" > >Image.open("image10.jpg").resize(128,128).save(outfile, "JPEG") > > > >I get the following error : > > > >Traceback (innermost last): > > File "C:\python\Pythonwin\pywin\framework\scriptutils.py", line 311, in > >RunScript > > exec codeObject in __main__.__dict__ > > File "C:\test\thumb.py", line 4, in ? > > Image.open("image10.jpg").resize(128,128).save(outfile, "JPEG") > > File "C:\PYTHON\PIL\Image.py", line 629, in resize > > raise ValueError, "unknown resampling filter" > >ValueError: unknown resampling filter > > > >I based my code on the example from the PIL manual. The JPEG is 1024x768. > >Anybody have any ideas? > > > >Colin > > > > Resize takes two arguments, the first should be a tuple, the second a > filter. > > So you should be using something like: > > resize((128, 128), Image.BILINEAR) > > It's all in the doc under resize! > > -- > Dale Strickland-Clark > Out-Think Ltd > Business Technology Consultants > > From tim at degree.ath.cx Tue Nov 21 22:44:23 2000 From: tim at degree.ath.cx (Tim Hammerquist) Date: Wed, 22 Nov 2000 03:44:23 GMT Subject: What is Python? References: <3A17EED5.6E038529@engcorp.com> <0HZR5.15312$%j3.124375@news6.giganews.com> <3A18B6A5.2EFC0C46@alcyone.com> <00fh1tgaludcggor2rigl2d4uuh2dpni5t@4ax.com> Message-ID: Rainer Deyke wrote: > Totally unrelated rhetorical question: When one says "It is raining", to > what is the "it" refering? The same 'it' Spanish-speakers refer to when they say "Lluvia." (Literally: "It rains.") or "Hace calor." (Literally: "It makes heat." ie: "It's hot.") -- -Tim Hammerquist People get annoyed when you try to debug them. -- Larry Wall, 1999 From sholden at holdenweb.com Fri Nov 10 10:54:22 2000 From: sholden at holdenweb.com (Steve Holden) Date: Fri, 10 Nov 2000 10:54:22 -0500 Subject: xml.sax module documentation References: <3a0b1ec4_1@news1.prserv.net> <3a0b2d15_1@news1.prserv.net> Message-ID: <3A0C1A2E.A1288072@holdenweb.com> "S. Hendry" wrote: > > >I'm new to programming, but have successfully created a few working python > >codes. Now I need to process XML files as an input to my program (my data > >is in xml format). However, reading the Python documentation and/or source > >codes on xml.sax (or any xml module) gives me headache. It is as-if they > >were written so newbies cannot understand them (I'm sure it's not > >intentional). Could anyone point me to good articles / docs that can help > >me understand how to use the xml.sax modules please. Working examples > would > >be a Godsend, if you don't mind sharing. > > > >I use ActiveState's Python 2.0 (win95). Many many thanks in advance. > > Actually I should be more specific. I may be confused what a parser is. > Maybe if I understand this, it will help me read the docs and available > articles better. > > Here's what I thought. I have a data file, for example: > .... > > 123 > John Smith > > 1 > 34A > 10 > 2 > ... etc, etc ... > > I was under the impression that I can use a parser to process the data file, > so I can check, for example: > ... > if PO.Approver = "John Smith": > special_discount = 10 > ... > > Am I far off? If not, then how do I use the xml modules to do what I intend > to do? Thanks in advance. > Well, SAX on its own won't encourage you to do this. There are a couple of schools of thought about the "best" way to process XML. SAX leans towards the event-driven approach, where the Parser interacts with a DocumentHandler, calling its methods when certain events occur. A dcoument handler is therefore a bit liek a stream-of-consciousness handler for the Parser, whcih sort of mumbles to itself by means of DocumentHandler method calls. E.g.: "This is the start of a document" "Here's the start of an 'A' element with attributes 'HREF' (whose value is '...') and "OnMouseOver" (whose value is '...')" "Here's some character data, '...'" "Here's some more character data, '...'" "Here's a processing instruction whose target and data are '...' and '...'" "Here's an ending 'A' element" The advantage of this approach is that you can process large documents without the Parser having to build a complete parse tree. Of course, the disadvantage is you end up writing special-purpose processing rather than using XSLT and XPath to transform the XML into the form you want. Hope this helps. I found the SAX documentation a little opaque the first time I read it (and the second, and the third...) but it does make sense in the end. regards Steve > - Slamet -- Helping people meet their information needs with training and technology. 703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/ From mfletch at tpresence.com Sat Nov 4 12:05:16 2000 From: mfletch at tpresence.com (Mike Fletcher) Date: Sat, 4 Nov 2000 12:05:16 -0500 Subject: GUID Generators for non-Windows systems? Message-ID: The remote-server approach is not appropriate in my particular case, as I need complete distribution (i.e. there can't be any single points of failure in the network), but might be useful for others. Incidentally, the PYRO package has a "random" GUID generator (uses IP address + random number instead of the MAC hardware ID number). The E2FSProgs solution looks like the "right" way to go. Does every Linux/Unix system have it (or is it really easy for people to install)? If so, doing an os.system under a sys.platform check sounds fine (I'm not going to try and wrap it as a python module on a platform to which I have no access :o) ). Thanks all, Mike -----Original Message----- From: jay.krell at cornell.edu [mailto:jay.krell at cornell.edu] Sent: Saturday, November 04, 2000 11:33 AM To: Mike Fletcher; Python List (E-mail) Subject: Re: GUID Generators for non-Windows systems? I've long been hoping for someone to host a guid generator on a web page, or nowadays via xml-rpc/soap. Maybe at some point I'll get around to setting up a Windows server somewhere with a static ip addres... - Jay ... From speed at ?.com Tue Nov 14 11:09:16 2000 From: speed at ?.com (Jake Speed) Date: Tue, 14 Nov 2000 16:09:16 -0000 Subject: STDIO Questions. References: <8upq18$le1$1@nnrp1.deja.com> <9e_P5.4926$QH2.536706@newsb.telia.net> <8uq0fs$qvm$1@nnrp1.deja.com> <3A10B6E6.803AFAE9@engcorp.com> Message-ID: mwh21 at cam.ac.uk (Michael Hudson) wrote in : > >That's probably not a bad idea for a library module. I guess the >problem comes with trying to find the suitable lowest common >denominator functionality - you could easily end up reimplementing >curses (which would be pointless!) (Can Python work with curses on >Windows?). You might like to look at Perl's "Term::ReadKey" module. -Speed! From tismer at tismer.com Sat Nov 25 11:38:40 2000 From: tismer at tismer.com (Christian Tismer) Date: Sat, 25 Nov 2000 18:38:40 +0200 Subject: ANN: wxDesigner 1.3 commercial RAD tool References: Message-ID: <3A1FEB10.5A7FFB0B@tismer.com> Robert Roebling wrote: > > Hello, > > wxDesigner is a dialog editor and RAD tool for the wxWindows > C++ library and its Python wrapper wxPython. It allows its > users to visually create dialogs using a simple point and click > interface as well as add new classes, handlers and getters to > these dialogs. The output produced by wxDesigner can be either > of C++ code, Python code or XML, making co-development with > wxWindows and wxPython much easier than before. Great! I love to see new GUI tools pop up like mushrooms, suddenly. For the users who are undecided whether to use a free tool or your professional one: Would you mind to do a comparison against Boa Constructor? http://boa-constructor.sourceforge.net/ cheers - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com From rjroy at takingcontrol.com Sun Nov 19 10:35:26 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Sun, 19 Nov 2000 15:35:26 GMT Subject: how to delete multiple elements from a list References: <8usjl6$vea$1@nnrp1.deja.com> Message-ID: <3a17f24d.324934718@news1.on.sympatico.ca> On Tue, 14 Nov 2000 23:59:39 GMT, etsang at my-deja.com wrote: >Hi, > >I have a List X with N number of items in it. I have another List Y >which contains the postion of the elements to be deleted from List X. >I cannot do a for loop to delete that because for each iteration, List >X will be changed and there will be sliperage. > >How can I delete all the items as specified by the positions in Y at >one time? Also both List X and List Y are known in run time only. >Thanks > > >Sent via Deja.com http://www.deja.com/ >Before you buy. In one of your posts you said that the positions in Y are unique. Are the items in X unique? If so you might do something like this (at the cost of a list copy): X2 = X[:] # make a copy of X for index in Y: X.remove[X2[index]] X2=[] # deallocate X2 If not then : Y.sort() Y.reverse() for index in Y: del X[index] is probably the best solution. Bob From aheusel at aixterm7.urz.uni-heidelberg.de Mon Nov 13 18:40:16 2000 From: aheusel at aixterm7.urz.uni-heidelberg.de (Alexander Heusel) Date: 13 Nov 2000 23:40:16 GMT Subject: connecting listener to gladepyc obj: how? Message-ID: <8upu50$pvs$1@news.urz.uni-heidelberg.de> Hi there! I am trying to write a user interface with Glade and gladepyc on Linux. I have some problems to connect the listener object to the object created by the gladepyc output. The problem is my script does simply nothing, so it is hard for me to find my mistake. As i am new to the concepts of python, i would appreciate it very much if someone could help me out with a simple example on how to write and connect a object method to the appropriate UI object signals. Thanx in advance Alexander From cfelling at iae.nl Fri Nov 3 14:01:06 2000 From: cfelling at iae.nl (Carel Fellinger) Date: 3 Nov 2000 20:01:06 +0100 Subject: syntax error?why? References: <8tt9hb$1rrf$1@news.cz.js.cn> <8tu4u8$1e0$1@animus.fel.iae.nl> <8tucm501f83@news2.newsguy.com> Message-ID: <8tv21i$p4$1@animus.fel.iae.nl> Alex Martelli wrote: > "Carel Fellinger" wrote in message >> A this abundunce of information you give us:) > Presumably the same amount the Python compiler gave him. ...snipped complains about Pythons sparse error messages I couldn't agree more:) So what happened to those friendly and informative error messages for which a patch was posted awile ago? -- groetjes, carel From nospam.newton at gmx.li Mon Nov 20 15:31:46 2000 From: nospam.newton at gmx.li (Philip 'Yes, that's my address' Newton) Date: Mon, 20 Nov 2000 21:31:46 +0100 Subject: Ruby and Python References: <8v0nr4$i32$1@news.nuri.net> <8v0uv4$jh$1@panix3.panix.com> <3A1410C4.915F6029@letterror.com> <8v73jl0hfr@news1.newsguy.com> <8v83v301g0n@news1.newsguy.com> <8v9lr9$2h8$1@nnrp1.deja.com> Message-ID: On Sun, 19 Nov 2000 21:45:36 -0500, graham wrote: > Jeremy Hylton > > The normal definition of "first class" is an object that can be named > > and treated as data at runtime. A first class object can be bound to a > > variable name, passed as an argument to a function, or returned from a > > function. The term has nothing to do with scoping rules. > > So by this definition C has first class functions. Does it? No. You can only do all the above with pointers to functions, not with functions themselves. Cheers, Philip -- Philip Newton If you're not part of the solution, you're part of the precipitate. From tbryan at python.net Wed Nov 1 06:47:46 2000 From: tbryan at python.net (Thomas A. Bryan) Date: Wed, 01 Nov 2000 06:47:46 -0500 Subject: function with a lot of parameters --maintainability issue References: <200010302330.PAA31667@mail2.bigmailbox.com> Message-ID: <3A0002E2.B2F24058@python.net> William Park wrote: > > On Mon, Oct 30, 2000 at 03:30:19PM -0800, First Name Last Name wrote: > > William, thanks for your help. One more quesiton about your solution. > > Since I would like that dictionary to contain a whole set of default values of different types. Can I do something like this: > > > > In file blarblar.py where func is definied, I also define the dictionary. > > That is: > > configDict = {'a': 1, 'b': TRUE, 'c': "Default Val", 'd': "1.245", ...} > > > > def func(sid, args): > > for i in args.keys(): > > setVariable(sid, ..., args[i]) > > > > In the file that will call the function > > from blarblar import * > > > > def callYou(): > > # assume sid is got from somewhere > > newConfigDict = configDict > > # want to change some of the default values > > newconfigDict['a'] = 2 > > newConffigDict['b'] = FALSE > > func(sid,newConfigDict) > > ???? > > Yes, something like that. But, since you already have the dictionary > defined in 'blarblar.py', there is no need to pass it to > 'blarblar.func()'. Also, 'newConfigDict' is not necessary. > > In 'blarblar.py', > configDict = {'a': 1, 'b': TRUE, ...} > > def func(sid): > for i in configDict.keys(): > setVariable(sid, ..., configDict[i]) > > And in your main script, > from blarblar import * > > def callYou(): > ... > configDict['a'] = 2 > configDict['b'] = FALSE > func(sid) The problem with this solution is that if you have a second function (or later *add* a second function) to the main script that calls func(), then the arguments that are used depend on the order of the function calls. For example, In blarblar.py configDict = ['a': 1, 'b': TRUE,...] def func(sid): for i in configDict.keys(): setVariable(sid, ... , configDict[i]) And in the main script, from blarblar import * def callYou(): configDict['a'] = 2 func(sid) def callTwo(): configDict['b'] = FALSE func(sid) # ... a bunch of code that might call callYou() callTwo() # what happens depends on whether callYou() has been called > > Or I am think should I implement this configDict stuff in a class instead??? > > Hmm... try dictionary first. Then, when you are comfortable with > Python, then perhaps class. Either will work. A class might be cleaner, depending on what you're doing. Another approach that might be simpler is to use keyword arguments. In blarblar.py, # Define it here so that func isn't so ugly configDict = ['a': 1, 'b': TRUE,...] def func(sid, dictArg): myDict = configDict.copy() # use a copy to avoid corrupting the global myDict.update(dictArg) # override defaults with values passed to us for i in myDict.keys(): setVariable(sid, ... , myDict[i]) In the main program, from blarblar import * def callYou(): func(sid, {'a': 1, 'b': FALSE}) def callTwo(): func(sid, {'c': 'Non default'}) # Now, it doesn't matter whether callYou() has been called callTwo() ---Tom From tismer at tismer.com Sun Nov 5 09:49:50 2000 From: tismer at tismer.com (Christian Tismer) Date: Sun, 05 Nov 2000 16:49:50 +0200 Subject: a simple example of Stackless Python References: <8tjrn2$esm$1@news.nuri.net> Message-ID: <3A05738E.199DEC24@tismer.com> Evan Simpson wrote: > > "June Kim" wrote in message > news:8tjrn2$esm$1 at news.nuri.net... > > It seems like there are few people who understand Stackless Python > > and the stuffs, and I'm not one of them. Can anyone explain me > > this simple code? The paper was not very helpful for me to understand. > > I'll give it a shot. "this = continuation.current()" creates a continuation > object, and "this.update(n)" does two things: First, it updates the > continuation object so that calling it will cause program execution to > continue at that line, as though "this.update(n)" had just returned the > value passed in the call. Second, it evaluates to n, so that the line acts > as though it were "k = n". ... Thanks a lot for this perfect explanation. Note that the .update() stuff is quite a hack, born from syntactic problems to get "at that point in the code below". Continuations should be immutable snapshots of program state by concept. I'm breaking it here just to keep a handle for the "=" position, while passing a value. This is one of the weakest concepts of Python's continuations, and it is quite likely to vanish. Passing continuations explicitly as parameters, or grabbing them from caller functions via caller() is the desired way of the still non-existing API. Back from Turkey I see the Stackless gang did a good job, thanks again to you all - chris -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com From randy at teamkern.net Sun Nov 5 21:25:03 2000 From: randy at teamkern.net (Randall Kern) Date: Sun, 5 Nov 2000 18:25:03 -0800 Subject: lambda & scope Message-ID: <005701c04798$c5404ae0$58fe1018@teamkern.net> try this: def fred(scale): v = [1, 2, 3] v = map(lambda x, scale=scale: x * scale, v) the lambda function has it's own scope, just like a normal def function. -Randy ----- Original Message ----- From: "Johannes Zellner" Newsgroups: comp.lang.python To: Sent: Sunday, November 05, 2000 6:03 PM Subject: lambda & scope > Hi, > > this fails: > > def fred(scale): > v = [1, 2, 3] > v = map(lambda x: x * scale, v) > > NameError: There is no variable named 'scale' > > how can I make it working ? > > -- > Johannes > -- > http://www.python.org/mailman/listinfo/python-list From pisel at opencan.cc Tue Nov 14 11:35:32 2000 From: pisel at opencan.cc (Pisel) Date: Tue, 14 Nov 2000 17:35:32 +0100 Subject: Simple HTML to XML parser? References: <8uq132$rek$1@nnrp1.deja.com> Message-ID: <3a1169f6$0$7492@SSP1NO25.highway.telekom.at> jsantaniello at my-deja.com wrote: > Hi Everyone, > > Does anyone have or know of a simple HTML to XML parser? The sax package > is too much for me to handle. What I'm looking for is the ability to > grab some html with urllib for example and then access an object like: > > page = urlopen(url) > the_value = page.body.form[0].hidden_element_name.value > > Or something similar. What I'm doing now is just grabbing the page as a > string and searching for tokens and then doing some slicing. But this is > all so hard coded, and subject to the vagaries of web-designers that I > don't trust it. > > Anyone have any suggestions? If you simply want to transform html to xml you could call tidy (http://www.w3.org/People/Raggett/tidy/) with its -asxml option. It has the advantage to repair broken html. Pisel From db3l at fitlinxx.com Mon Nov 13 15:49:15 2000 From: db3l at fitlinxx.com (David Bolen) Date: 13 Nov 2000 15:49:15 -0500 Subject: os.system() and path problems References: <3a0fdd9b.229869414@news.pnl.gov> Message-ID: robert_j_roberts at rl.gov (Robert Roberts) writes: > ... I find that the cwd is exactly what I set it to. However, if I do > a > > os.system('dir') > > ...and pause it in time, I find that the dir was done on > > c:\winnt > > ...hence, the cwd as seen by Python versus the cwd seen by os.system() > are two different things. > > Any suggestions? Yes, don't set your current directory to a UNC path, or don't run a command that uses the CMD interpreter. I'm not sure how it used to work for you previously, but CMD can't handle having the current directory be a UNC path, and if it finds it that way it'll switch back to the main system directory before executing it's command. It's hard to test this from the command line if you've only got CMD around (since it doesn't let you cd to a UNC), but here's an example from my environment using a Cygnus Unix emulation with bash (the error message is wrapped for readability): ~/src> cd //ctwh01/sitedata //ctwh01/sitedata> cmd dir a '\\ctwh01\sitedata' is an invalid current directory path. UNC paths are not supported. Defaulting to Windows directory. Volume in drive C is SOE Volume Serial Number is DC33-CF3E Directory of C:\WINNT File Not Found I'm not sure where the warning message goes, so I'm not sure if you should be seeing it in your environment or not, but I'm betting that's what is happening behind the scenes. So you probably need to structure your setup so that you pass the UNC location in as arguments rather than depending on it being your current directory. Either that or set up a permanent mapping to some local drive and then use that for your current directory. -- -- David -- /-----------------------------------------------------------------------\ \ David Bolen \ E-mail: db3l at fitlinxx.com / | FitLinxx, Inc. \ Phone: (203) 708-5192 | / 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \ \-----------------------------------------------------------------------/ From peter at engcorp.com Sat Nov 18 15:06:48 2000 From: peter at engcorp.com (Peter Hansen) Date: Sat, 18 Nov 2000 15:06:48 -0500 Subject: P*rl in Latin, whither Python? References: <3A0B62B7.59A43E13@gte.net> <3A0C8258.4217A1C@alcyone.com> <3A0D7321.29BE1264@engcorp.com> <874s1ei02a.fsf@fangorn.stofanet.dk> <3A0DEA72.7F8A2868@alcyone.com> <3A0E0E00.50B7A1E1@engcorp.com> <871ywhmiis.fsf@fangorn.stofanet.dk> <87snowl5f0.fsf@fangorn.stofanet.dk> Message-ID: <3A16E158.A8DB692@engcorp.com> Jim Richardson wrote: > > Martin Christensen wrote: > >Yes, but I get 'they're' and 'their' right _every_ time. How many > >natives do that? > > ooh! ooh! me, me! > > what do I win? (hopes for new Sony Vaio) > well? Sorry, you're disqualified. It should have been: ooh! ooh! I, I! because after "How many natives do that?" the answer is "I [do that]", not "me [do that]". Stupid English language. :-) (But the prize was actually a Palm IIIc anyway, so take solace in that.) From dalke at acm.org Mon Nov 13 23:09:40 2000 From: dalke at acm.org (Andrew Dalke) Date: Mon, 13 Nov 2000 21:09:40 -0700 Subject: Proposal: default __init__ References: <8uotmc$uo4$1@slb7.atl.mindspring.net> <3A0FFFB3.8C385594@holdenweb.com> Message-ID: <8uqdr3$96n$1@slb3.atl.mindspring.net> Steve Holden wrote: >However, when using other people's code, a default null __init__() might >be helpful. Although, of course, you would still get similar problems >if you later decided that the __init__() method of an object you had >defined yourself needed to change its interface, for example adding >parameters: all calls to __init__() would then need to be edited. That isn't always a problem. For example, suppose you extended the number of parameters but added them after the existing parameters and used appropriate default arguments for those new ones. Then you can change the API but keep backwards compatibility. On the other hand, if the interface is not backwards compatible, I would like code to break. As it stands now, if you have class A: pass class B(A): def __init__(self, data): self.data = data and replaced A with class A: def __init__(self, username, password): self.username = username self.password = password you can still make a B(), even though I would like it to fail, unless told otherwise. The problem is that the current style of "not calling __init__ because it doesn't exist" is written the same as the "not told otherwise" case. Instead, if I could call A's __init__ even when it doesn't have an explicit __init__, then I could write class B(A): def __init__(self, data): A.__init__(self) self.data = data and be safe in the knowledge that if A's __init__ changed then my code would break at the point, and not latter due to some secondary, consequential effect. Andrew dalke at acm.org From SBrunning at trisystems.co.uk Thu Nov 16 06:30:25 2000 From: SBrunning at trisystems.co.uk (Simon Brunning) Date: Thu, 16 Nov 2000 11:30:25 -0000 Subject: The PSA (Was - Is Starship being hosted at BeOpen once again?) Message-ID: <31575A892FF6D1118F5800600846864D5B1472@intrepid> > From: Christian Tismer [SMTP:tismer at tismer.com] > I've changed DNS to DC by the beginning of the week. What is the current status of the PSA? According to the PSA FAQ (last updated in '97), it appears to be a CNRI thing. So, I have four questions: * Does the PSA still exist? * If so, is it run by CNRI? * Is it worth joining? * OK, three then. Cheers, Simon Brunning TriSystems Ltd. sbrunning at trisystems.co.uk He uses statistics the way a drunken man uses a lamp post; more for support than for illumination. - Andrew Lang ----------------------------------------------------------------------- The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution, or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot accept liability for statements made which are clearly the senders own. From phd at phd.russ.ru Fri Nov 10 03:36:06 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Fri, 10 Nov 2000 11:36:06 +0300 (MSK) Subject: How to kill a thread from another thread ? In-Reply-To: <3A0AD392.4776F708@ina.fr> Message-ID: On Thu, 9 Nov 2000, Richard Gruet wrote: > Actually, I'm using a thread to execute a function call asynchronously, to avoid > getting stuck is something goes wrong. To execute the call, I create a thread and > delegate the actual function call to it. Then, in the main thread, I wait for the > end of the thread (ie the return of the function called) with a timeout (using a > join). > The problem is that if a timeout occurs because the function doesn't return, I > have no way to kill the thread and sometimes it appears to prevent the program to > exit correctly (it hangs because there is still living threads). Use forking. It is pretty perfect way to timeout subprocesses. Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From stevecanfield at my-deja.com Sat Nov 4 14:37:15 2000 From: stevecanfield at my-deja.com (stevecanfield at my-deja.com) Date: Sat, 04 Nov 2000 19:37:15 GMT Subject: mylab() in DISLIN Message-ID: <8u1ohb$q2u$1@nnrp1.deja.com> I've been playing with DISLIN plotting some bar charts in Python and I am having trouble with custom X-axis labels (using the mylab call). The documentation says only 20 user-defined labels are allowed. I've made a couple of sample graphs and confirmed that it does not print any labels after the 20th tick. Can anybody suggest a workaround? I have some charts that need approximately 30 bars and DISLIN seems to do pretty much exactly what I want, except for the labels problem. Thanks, Steve Sent via Deja.com http://www.deja.com/ Before you buy. From josh at open.com Wed Nov 15 21:36:31 2000 From: josh at open.com (Joshua Muskovitz) Date: Wed, 15 Nov 2000 21:36:31 -0500 Subject: how to delete multiple elements from a list References: <8usjl6$vea$1@nnrp1.deja.com> <8uv1cn$uj1$1@nnrp1.deja.com> Message-ID: <3a134693_2@corp.newsfeeds.com> This will force ListY to be in order from highest to lowest, and so the del's will not interfere with each other. ListY.sort() ListY.reverse() -- josh -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From dijkhuis at my-deja.com Tue Nov 14 03:04:17 2000 From: dijkhuis at my-deja.com (dijkhuis at my-deja.com) Date: Tue, 14 Nov 2000 08:04:17 GMT Subject: calculator.py help Message-ID: <8uqrlv$f5b$1@nnrp1.deja.com> Hello, Can someone please help me with the following code? I found this example somewhere but it won't work. It is supposed to be a calculator. Thanks, Dijkhuis ------ from Tkinter import * from math import * def evaluate(event): label['text']="result: " + str(eval(expression.get())) frame = Frame(None) entry = Entry(frame) entry['textvariable'] = expression = StringVar() entry.bind("",evaluate) label = Label(frame) button = Button(frame, text = "Submit", command = evaluate) frame.pack() entry.pack() label.pack() button.pack() frame.mainloop() Sent via Deja.com http://www.deja.com/ Before you buy. From olivierS.dagenaisP at canadaA.comM Fri Nov 3 00:10:56 2000 From: olivierS.dagenaisP at canadaA.comM (Olivier Dagenais) Date: Fri, 03 Nov 2000 05:10:56 GMT Subject: syntax error?why? References: <8tt9hb$1rrf$1@news.cz.js.cn> Message-ID: I bet the line before it is not indented the same as this one or that you might have forgotten a ':' after a "for" or "if", etc... The "syntax error" means it's not expecting an identifier at that point. -- ---------------------------------------------------------------------- Olivier A. Dagenais - Software Architect and Developer "Someone called 'Type your name here' is impersonating me on the internet and is posting exactly the same things I am posting!" "Jack Tiger" wrote in message news:8tt9hb$1rrf$1 at news.cz.js.cn... > admin(8181): File "../Mailman/Cgi/oz_sub.py", line 71 > results = results + "Can not subscribe itself!
" > ^ > SyntaxError: invalid syntax > > > From tyler at tylereaves.com Mon Nov 6 23:57:52 2000 From: tyler at tylereaves.com (Tyler Eaves) Date: Mon, 06 Nov 2000 23:57:52 -0500 Subject: CODING and CROSS PLATFORM References: <3a078743@mega.ultra.net.au> Message-ID: I just must say this: VISUAL BASIC IS NOT HIGH PREFORMANCE! --- Tyler Eaves Visit Ultra Coaster Central! The internet's largest repository of Ultra Coaster Tracks! http://www.ultracoastercentral.com -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World! -----== Over 80,000 Newsgroups - 16 Different Servers! =----- From skip at mojam.com Sun Nov 19 05:36:54 2000 From: skip at mojam.com (Skip Montanaro) Date: Sun, 19 Nov 2000 04:36:54 -0600 (CST) Subject: Confused about "standard" top-level structure of a Tk app Message-ID: <14871.44358.696637.682683@beluga.mojam.com> I don't do much GUI programming, so every time I decide to write such a program I have to relearn it all. I'd like to create a Tkinter application consisting of a top-level application window with a menubar at the top and a frame beneath it into which I will insert most/all of my application widgets. Once I get to the point where I have a handle on the frame into which I can insert my widgets, I'm fine. It's the relationship between the widgets at the outermost level (the toplevel widget, the menu and its elements, and the main application frame) that confuse me. Every example I've looked at in either the Python source tree or the references found on the Tkinter page of the Python web site seems to construct this basic functionality differently. This is such a common idiom I would have thought there was a single preferred way of doing it. Does someone have a bit of skeleton code for this top-level structure? Thanks, -- Skip Montanaro (skip at mojam.com) Support the Mojam.com Affiliates Program: http://www.mojam.com/affl/ (847)971-7098 From tdelaney at avaya.com Mon Nov 20 23:16:57 2000 From: tdelaney at avaya.com (Delaney, Timothy) Date: Tue, 21 Nov 2000 15:16:57 +1100 Subject: ANN.: Beta 1.0 of Weak Reference Extension Module is now avai lable Message-ID: This is one of the major advantages of weak references ... You grab your data, and store it in the cache. Next time you need it, you go look in the cache. If it's there, use it. If it's not, then the weak reference was garbage collected because we were running out of memory, and you then go and get it from wherever again. Weak references can give you a qucik-and-dirty cache which will *not* grow forever, but will occasionally chuck out some data, forcing you to go get it again. It's a very useful technique. A good example of where weak references are used now is in Java images. In earlier versions of Java, a Hashtable was used to store references to every image loaded, in order to be able to quickly redisplay it. Unfortunately, this meant the memory requirements of an application could grow enormously. So instead the implementation now used weak references in the Hashtable (actually, is uses a WeakHashMap). This means that *most* of the time the image will already be in memory, but sometimes it may need to be reloaded from disk. Weak references should nearly always be hidden behind a facade which *always* gives you the data it needs, and behind the scenes it takes care of whether that data is in memory already or not. It's basically lazy evaluation, where the evaluation *may* need to occur multiple times. Tim Delaney Avaya Australia +61 2 9532 9079 > -----Original Message----- > From: Johann Hibschman [mailto:johann at physics.berkeley.edu] > Sent: Friday, 17 November 2000 12:07 AM > To: python-list at python.org > Subject: Re: ANN.: Beta 1.0 of Weak Reference Extension Module is now > available > > > Courageous writes: > > >>> Looks neat! But maybe you could answer me a quick > question, since I > >>> really don't understand weak references. > > > Suppose you are designing a cache. > > It's still not obvious to me. Say I had a database that I was > caching. Then > > x = database.get('RECORD_ID') > > would only get the file from disk once, etc. But the cache itself is > invisible; it's entirely under the hood. Once you have the data > object, you have it. > > Are you saying that once you have the object, something weird might > happen elsewhere that means you no longer have it? That seems like a > sign that you don't really have the object at all, or that you don't > have synchronization working quite right. > > -- > Johann Hibschman johann at physics.berkeley.edu > -- > http://www.python.org/mailman/listinfo/python-list > From sholden at holdenweb.com Mon Nov 6 11:24:37 2000 From: sholden at holdenweb.com (Steve Holden) Date: Mon, 06 Nov 2000 11:24:37 -0500 Subject: installer for 2.0 References: Message-ID: <3A06DB45.239F50EF@holdenweb.com> Gordon recently replied "Real Soon Now" to another similar posting. So, it should be real soon now ;-) just-finished-waiting-for-mxODBC-ly y'rs - steve Pete Shinners wrote: > > the mcmillan installer stuff (which is great, btw) doesn't > seem to be updated for python 2. i've hacked at the source > for awhile and it now runs, but none of the output works. > > http://www.mcmillan-inc.com/install1.html > > i wan't really expecting it to work well since i was > commenting out assertions that were failing ;] > > is there an updated version for 2.0? if not, what does > the schedule look like for something like this? -- Helping people meet their information needs with training and technology. 703 967 0887 sholden at bellatlantic.net http://www.holdenweb.com/ From jackxh at my-deja.com Thu Nov 2 13:02:24 2000 From: jackxh at my-deja.com (jackxh at my-deja.com) Date: Thu, 02 Nov 2000 18:02:24 GMT Subject: Question regarding serial port communication with python. Message-ID: <8tsa77$fbj$1@nnrp1.deja.com> Hi everyone: I got following piece code from newsgroup and made some small modification. It runs, but in order to determine how many bye to read, the script has to search for '\n'. I don't like this because a lot of times the serial port give you back a lot of "\n" in the data. I was wondering if there is an function that is simular to os.read() but doesn't require you to input a number for the byte to read. In stead, it will through back the data or message back like a telnet session. Thanks a lot. Jack Xie # Actual Code -------------------------- import os, termios import FCNTL, TERMIOS class SerialPort: """Basic serial port class. This simply encapsulates a file descriptor for the desired serial port. """ def __init__(self, dev): print dev fd = self.fd = os.open(dev, FCNTL.O_RDWR) self.original_state = termios.tcgetattr(fd) L = termios.tcgetattr(fd) iflag, oflag, cflag, lflag, ispeed, ospeed, chars = L ispeed = ospeed = TERMIOS.B9600 cflag = (cflag & ~TERMIOS.CSIZE) | TERMIOS.CS8 | TERMIOS.CSTOP cflag = (cflag | TERMIOS.CLOCAL | TERMIOS.CREAD) & ~TERMIOS.CRTSCTS iflag = TERMIOS.IGNBRK lflag = 0 oflag = 0 chars[ TERMIOS.VMIN ] = 1 chars[ TERMIOS.VTIME ] = 5 iflag = iflag & ~(TERMIOS.IXON | TERMIOS.IXOFF | TERMIOS.IXANY) cflag = cflag & ~(TERMIOS.PARENB | TERMIOS.PARODD) L = [iflag, oflag, cflag, lflag, ispeed, ospeed, chars] termios.tcsetattr(fd, TERMIOS.TCSANOW, L) L = termios.tcgetattr(fd) def write(self, string): "Write a string to the port" os.write(self.fd, string) # termios.tcdrain(self.fd) # termios.tcflush(self.fd, TERMIOS.TCOFLUSH) def read(self, N=1): "Read a string from the port" return os.read(self.fd, N) def close(self): termios.tcsetattr(self.fd, TERMIOS.TCSANOW, self.original_state) if self.fd is None: return os.close( self.fd ) self.fd = None def test(args = None): x.write('ls\n') while 1: c = x.read(5) print c if c == '\n': break x.close() if __name__ == '__main__': test() Sent via Deja.com http://www.deja.com/ Before you buy. From jon+python-list at unequivocal.co.uk Sun Nov 5 18:21:48 2000 From: jon+python-list at unequivocal.co.uk (Jon Ribbens) Date: Sun, 5 Nov 2000 23:21:48 +0000 Subject: Security Concerns In-Reply-To: <3A05DB6C.2E409AA3@san.rr.com>; from dnew@san.rr.com on Sun, Nov 05, 2000 at 10:13:00PM +0000 References: <8tnr4i$fht$1@panix6.panix.com> <3A05DB6C.2E409AA3@san.rr.com> Message-ID: <20001105232148.B5281@snowy.squish.net> Darren New wrote: > Actually, I think Tcl has the nicest solution I've seen of all of these. I'd > have to do some serious thinking about Python to figure out how to restrict > someone to only doing what I wanted them to do. Ah, this isn't really what I meant. I was talking about writing programs (such as CGIs for web servers) such that their behaviour is predictable, you're talking about safely running untrusted code. Python has a facility for this, but I haven't needed it personally (in Python or any other language). Cheers Jon From aleaxit at yahoo.com Fri Nov 3 17:28:34 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Fri, 3 Nov 2000 23:28:34 +0100 Subject: conditionals in lambdas? References: <8tv48r$kn8$1@bmerhc5e.ca.nortel.com> Message-ID: <8tveau01do5@news1.newsguy.com> "Michael P. Soulier" wrote in message news:8tv48r$kn8$1 at bmerhc5e.ca.nortel.com... > Hey people. If I want to put conditions in a lambda function, how would > I go about that? Carefully; Python doesn't have built-in 'conditions' as expressions (only as statements, which can't live inside a lambda). But you can fake it, much of the time, with indexing or other tricks. E.g.: def foobar(whop): if whop>"pohrw": return "foox" else: return "barbar" == foobar = lambda whop: ("foox", "barbar")[whop<="pohrw"] > def test(string): > if string[:3] == 'yes: > return 1 > else: > return 0 > > I'd like to make something like this a lambda function. Is that possible? Hey, is this a Brainbench test...?-) test = lambda string: return string.startswith('yes') Alex From phd at phd.russ.ru Thu Nov 16 12:46:18 2000 From: phd at phd.russ.ru (Oleg Broytmann) Date: Thu, 16 Nov 2000 20:46:18 +0300 (MSK) Subject: mmap - how to use ? In-Reply-To: Message-ID: On Thu, 16 Nov 2000, Grzegorz Makarewicz wrote: > My python on windows works - test file attached. With little modification your test passed on Pentium Linux. Oleg. ---- Oleg Broytmann http://phd.pp.ru/ phd at phd.pp.ru Programmers don't die, they just GOSUB without RETURN. From dnew at san.rr.com Fri Nov 3 16:36:27 2000 From: dnew at san.rr.com (Darren New) Date: Fri, 03 Nov 2000 21:36:27 GMT Subject: Method or function? References: <1E8M5.152239$g6.69207599@news2.rdc2.tx.home.com> <8trblu01bl0@news1.newsguy.com> <9js40t8t9tcc0cqtg8h4lkg79kheqp6fca@4ax.com> <8tu9ga01d3l@news2.newsguy.com> Message-ID: <3A032FDC.8AAD4167@san.rr.com> Quinn Dunkan wrote: > Or maybe 'join' is ok... arghh, they both sorta work. Actually, I was thinking that when it's a method of string, it should be "reduce". When you reduce a list of integers with addition, you get 1 + 2 + 3 + 4 When you reduce a list of words with a "," string, you get one,two,three,four ;-) -- Darren New / Senior MTS & Free Radical / Invisible Worlds Inc. San Diego, CA, USA (PST). Cryptokeys on demand. The tragedy of the commons applies to monitizing eyeballs, too. From rjroy at takingcontrol.com Tue Nov 7 14:43:29 2000 From: rjroy at takingcontrol.com (Robert Roy) Date: Tue, 07 Nov 2000 19:43:29 GMT Subject: Binary trees storing huge amounts of data in nodes References: Message-ID: <3a0858aa.256973828@news1.on.sympatico.ca> On Tue, 7 Nov 2000 16:22:02 +0100, "Thomas Weholt" wrote: >Hi, > >I need to build a customized full-text search engine ( Yes, I've asked about >this before ) and I'd like to use something that's well supported in Python, >either gdm or Berkley DB. I want to store a word as key and data about >occurences in the value-part. My problem is that the amount of data in the >node can be huge. ( The amount of data to be scanned is a collection of >programming articles and source code, documents etc. ). > >How can I best do this? Could I use Berkley DB for storing words and >pointers to someplace the data was stored? How should I organize the data >for best response time? The generated index is pretty static, ie. data are >appended, not often removed or moved. > >I've looked at Ransacker but it doesn't seem to fit the amount of data I >need to scan. I'm using a PostgreSQL-database to store my data in so if >anybody know how I best could make a full-text search engine in Python using >PostgreSQL as back-end, that would be just great. > >Thanks. > >Best regards, >Thomas > > Full text search engines are non-trivial. You might be better off taking a look at some of the projects out there and seeing if you can adapt them or use them as-is for your needs. For example SWISH++ is a GPL'd full text indexer that while primarily intended for HTML, can index many other text (and some binary) file formats. It can run as a search server where it listens to a unix domain socket for queries. You could easily build a python interface to this. http://www.best.com/~pjl/software/swish/ related to the above is: http://sunsite.berkeley.edu/SWISH-E/ Bob From aleaxit at yahoo.com Sat Nov 11 10:52:30 2000 From: aleaxit at yahoo.com (Alex Martelli) Date: Sat, 11 Nov 2000 16:52:30 +0100 Subject: Confused. References: <8ubfv8$nth$1@plutonium.compulink.co.uk> <8ujmg5$t3j$1@troll.powertech.no> Message-ID: <8ujqao029t5@news1.newsguy.com> "Syver Enstad" wrote in message news:8ujmg5$t3j$1 at troll.powertech.no... > > wrote in message > news:8ubfv8$nth$1 at plutonium.compulink.co.uk... > > Is that what you wanted, then? Here's how I'd do it: > > > > import pywintypes, time > > comtime = pywintypes.Time(time.time()) > > > To make the two methods equivalent, take float(comtime) > Sorry, I don't understand what you're saying in the line above. Which two > methods? The approach you proposed was: > def MakeComTime(ctime): > return (ctime / 86400.0) + 25569.0 gbreed's alternative suggestion was: > > import pywintypes, time > > comtime = pywintypes.Time(time.time()) These are no doubt the two alternatives he was referring to as "the two methods" in his sentence: > > To make the two methods equivalent, take float(comtime) > Take float(comtime) I don't follow you. Consider, for example: >>> ctime=time.time() >>> (ctime / 86400.0) + 25569.0 36841.659544907408 >>> pywintypes.Time(ctime)