From sdfadfsa at sdfasdfasdfa.invalid Fri Dec 20 03:18:20 2002 From: sdfadfsa at sdfasdfasdfa.invalid (Jive Dadson) Date: Fri, 20 Dec 2002 00:18:20 -0800 Subject: semaphores and Rlocks References: <3E02B0BC.E5C9D52E@sdfasdfasdfa.invalid> Message-ID: <3E02D24C.56633347@sdfasdfasdfa.invalid> Replying to my own message... Now I am even confuseder than I was. I found threading.py, which looks like it implements semaphores and condition variables using polling and sleeping. Yes? No? If yes, I don't think I can use it. But I also found thread.c in the C sources, which appears to define semaphores and locks by means of the MS Windows API. If I had Python locks (like CRITICAL_SECTION in win32 land) and true non-polling semaphores (like Win32 CreateSemaphore, WaitForSingleObject, and ReleaseSemaphore), I could roll my own condition variables portably in Python. But I look in the thread module per se and all I find is allocate_lock, no semaphores. It takes a "LockType" parameter, but the documentation I found on the Python web site doesn't say what those types are. I also found a module called "mutex". It's not yet clear to me exactly what it does or how to use it. I don't want to do a C extension, in part because I don't currently have access to UNIX or Mac development systems, but I would probably do that rather than abandoning the idea of doing this project in Python. Is there a Rossetta Stone for all this stuff? BTW, where I'm coming from ... I've been doing realtime programming since the 70's, but I am (obviously) a Python newbie. Jive From aahz at pythoncraft.com Fri Dec 20 22:47:58 2002 From: aahz at pythoncraft.com (Aahz) Date: 20 Dec 2002 22:47:58 -0500 Subject: semaphores and Rlocks References: <3E02B0BC.E5C9D52E@sdfasdfasdfa.invalid> <3E03A3F7.2AD7A028@sdfasdfasdfa.invalid> <3E03C7D5.1285B21A@sdfasdfasdfa.invalid> Message-ID: In article <3E03C7D5.1285B21A at sdfasdfasdfa.invalid>, Jive Dadson wrote: >Aahz wrote: >> In article <3E03A3F7.2AD7A028 at sdfasdfasdfa.invalid>, >> Jive Dadson wrote: >>> >>>Yeah. Win32 CRITICAL_SECTION is implemented the same way, with >>>an interlocked increment wrapped around a win32 Mutex. But >>>CRITICAL_SECTION allows a thread to acquire the a lock repeatedly. >>> >>>By the way, I noticed some comments about not having >>>InterlockedIncrement or something like that available on Win98. I can >>>furnish an assembly language version in a C "__asm" thingy if anyone is >>>interested. It would be just about as "portable" as the win32 API. >> >> Someone in the past year on either c.l.py or python-dev was talking >> about writing some improvements to thread_nt.h, but I can't find it in a >> few minutes of Googling. If you can find that person and talk with him, >> that might be a good first step. > >Improving that stuff wouldn't do the trick. The problem is that no >Python synchronization primitive has a timeout. You can't fix your problem without fixing thread_nt.h. Python's higher-level synch constructs are all built on a virtual lock() construct that doesn't have a timeout. Python uses a virtual lock() so that there's relatively little platform-specific code -- and none in threading.py or Queue.py. That virtual lock() needs to change in order to implement the feature you want. If you want the standard library to get updated, you'll also need to make sure that Posix threads get a similar fix. BTW, would you please fix your Netscape so that lines are 75 columns or less? -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ "To me vi is Zen. To use vi is to practice zen. Every command is a koan. Profound to the user, unintelligible to the uninitiated. You discover truth everytime you use it." --reddy at lion.austin.ibm.com From juanm.casillas at eresmas.com Tue Dec 10 17:01:17 2002 From: juanm.casillas at eresmas.com (Juan M. Casillas) Date: Tue, 10 Dec 2002 23:01:17 +0100 Subject: Palm programming with python Message-ID: Hi folks! I'm poking arround trying to write a simple program for the Palm environment, and I want to do it in python, of course :) I see pippy, but my question is... can I write some application using python, just like I can do it using C (with the gcc cross compiler) ? Also, I see some palm ports of tk ... Is tk supported in some way under python ? (just like a _tkinter wrapper for the palm ...) Thanks to all >>> myself = '"%s" <%s>' % ('Juan M. Casillas', 'juanm.casillas at eresmas.com') From ngps at netmemetic.com Sun Dec 1 22:47:27 2002 From: ngps at netmemetic.com (Ng Pheng Siong) Date: 2 Dec 2002 03:47:27 GMT Subject: Is there a bright future for open software projects? References: <3DE783EF.16478.4666187@localhost> Message-ID: According to Matthew Sherborne : > As a programmer get several clients who want a simular program written For a programmer who knows little of and is possibly disdainful of sales and marketing, this is far easier said than done. -- Ng Pheng Siong * http://www.netmemetic.com From nospam at bigfoot.com Thu Dec 26 13:37:48 2002 From: nospam at bigfoot.com (Gillou) Date: Thu, 26 Dec 2002 19:37:48 +0100 Subject: Console I/O References: Message-ID: "Simon Turvey" a ?crit dans le message de news: U2HO9.12292$6o3.869097 at newsfep2-win.server.ntli.net... > Hi all, > I've had a look round but cannot find a satisfactory answer to the > following question: What's the best way of doing non-trivial (but not > complex) console I/O in Python? > > Cheers, > Simon > > Perhaps the standard packages readline, rlcompleter and curses will be of some help. --Gilles From nospam at bigfoot.com Tue Dec 24 06:49:42 2002 From: nospam at bigfoot.com (Gillou) Date: Tue, 24 Dec 2002 12:49:42 +0100 Subject: USing XML in Python... References: <3e07e82c$1_1@news.iprimus.com.au> Message-ID: "Joel" a ?crit dans le message de news: 3e07e82c$1_1 at news.iprimus.com.au... > Hey, > > I've looked around but I haven't come across a tutorial as an introduction > to using XML in Python... and I don't mean an introduction into using XML > itself.. I want to use Python and XML to display my website. > Does anyone know where I can find some good XML/Python tutorials?? > > Thanks, > > Joel Falconer-Try > Get Python-XML from sourceforge (resources are fresher than the ones from the Python standard distro) http://pyxml.sourceforge.net/ The best doc for playing with this is the book mentioned by dsavitsk --Gilles From CousinStanley at HotMail.com Mon Dec 2 11:59:41 2002 From: CousinStanley at HotMail.com (Cousin Stanley) Date: Mon, 2 Dec 2002 09:59:41 -0700 Subject: late bindings ??? References: <1038835357.23842.42.camel@localhost.localdomain> Message-ID: || ... || If method names would, you can use getattr. || getattr(obj, 'xxx') is equivalent to obj.xxx || ... Thanks to Peter Hansen, I've found that using the getattr method seems to work well for using a list of defined method names in a list as a simple way to combine those methods into different programs ... Python code and a few short .WAV files that it plays ... http://fastq.com/~sckitching/Python/xMethods.zip [ 295 KB ] Cousin Stanley --------------------------------------------------------------------- """ xMethods.py Invokes methods of aClass on anObject of aClass where the methods are referenced thru a String variable, actually in this demo program, a list of strings ... The method reference mRef is obtained thru the getattr() method NewsGroup Reference Peter Hansen comp.lang.python 2002-06-06 Modified Stanley C. Kitching 2002-06-08 Added applyMethods Added xProgram Lists Added Sounds """ import sys import winsound class aClass : def Method_0( self ) : print '\n\t ... Greetings ... ' print '\t ... huMon ... ' def Method_1( self ) : print '\n\t ... eenGa baZeenGa ... ' print '\t ... rinGa da dinGa ... ' xSound( 'Ding.wav' ) def Method_2( self ) : print '\n\t ... imA baZimeA ... ' print '\t ... rinGa yo chimeA ... ' xSound( 'WindChime.wav' ) def Method_3( self ) : print '\n\t ... onGo baZonGO ... ' print '\t ... bonGo da gonGo ... ' xSound( 'Gong.wav' ) def Method_4( self ) : print '\n\t ... Adios ... ' print '\t ... huMon ... ' nSnorts = 3 for i in range( 1 , nSnorts ) : xSound( 'Snort.wav' ) xSound( 'Meep_Meep.wav' ) def xSound( xFile ) : sFolder = 'Sounds/' sFile = sFolder + xFile winsound.PlaySound( sFile , winsound.SND_FILENAME ) # ------------------------------------------------------- def applyMethods( xObject , methodList ) : for xMethod in methodList : mRef = getattr( xObject , xMethod ) mRef() anObject = aClass() aProgram = [ 'Method_0' , 'Method_1' , 'Method_2' , 'Method_3' ] bProgram = [ 'Method_3' , 'Method_3' ] cProgram = [ 'Method_2' , 'Method_1' , 'Method_4' ] applyMethods( anObject , aProgram ) applyMethods( anObject , bProgram ) applyMethods( anObject , cProgram ) From dubal at khimjiramdas.com Tue Dec 10 06:15:20 2002 From: dubal at khimjiramdas.com (J Dubal) Date: 10 Dec 2002 03:15:20 -0800 Subject: Solved: How to make informixdb work with python 2.2.1 on Redhat Message-ID: Hello. As mentioned in my previous posting of 5th September 2002, I was not able to make it work and had no clue whatsoever why import informixdb in py221 should produce ImportError: Cannot locate C core module for informix db interface. I had given up on py221 and started using BeOpen's python 2.0 rpm with which informixdb worked. However, one lucky day last week, out of the blue, a kind soul named Eduard Weisgerber (ew at bogs.NOSPAM.de) sent me the following mail that made it work: quote Hi, just saw your Informix problem in the newsgroup, hope you solved it allready. If not make this: cd $INFORMIXDIR/lib/esql mkdir tmp cp libifgen.so orig_libifgen.so cp libifgen.a tmp cd tmp ar x libifgen.a gcc -shared -o libifgen.so *.o cp libifgen.so .. cd .. rm -rf tmp su - root ldconfig This few lines will do the job... hope to have helped you... unquote Dubal From fredrik at pythonware.com Sun Dec 15 06:13:03 2002 From: fredrik at pythonware.com (Fredrik Lundh) Date: Sun, 15 Dec 2002 11:13:03 GMT Subject: python is growing bigger and bigger! References: <7h3d6o7gyb0.fsf@pc150.maths.bris.ac.uk> Message-ID: <3tZK9.1586$FF4.87718@newsb.telia.net> Michael Hudson wrote: > > > i'd like to use python as a toolkit. but from version 1.52 to 2.22, it > > has become much bigger. > > In what way? The binaries are bigger, the library is bigger? you're part of the python-dev team, so you should know the answer to that: yes and yes. binaries, on windows: python 1.5.2: 557568 bytes DLL python 2.2: 886272 bytes DLL + about 291328 bytes in PYD files library files (subset; just the PY files in Lib): python 1.5.2: 1099790 bytes python 2.2: 2013794 bytes pythonware installers (python, tkinter, pil, etc): py14-19980126.exe: 1378780 bytes py15-19990326.exe: 1502419 bytes py152-20000606.exe: 1633504 bytes py20-20010402.exe: 2164042 bytes py21-20010906.exe: 2781359 bytes py22-20020318.exe: 2571065 bytes From noaddress at nope-none.com Thu Dec 26 23:58:14 2002 From: noaddress at nope-none.com (Company Man) Date: Thu, 26 Dec 2002 20:58:14 -0800 Subject: Licence question Message-ID: <3E0BDDE6.4E24071B@nope-none.com> Suppose a commercial company is building a new appliance or tool of some type, packaged in a sealed black box. This hypothetical company would like for the appliance to have a standard Python interpretter embedded in it. The users of the appliance, customers of the company, could send Python instructions to the appliance via a data link. Those instructions might be function definitions to be stored on the appliance for execution later, or they might be simple commands to be executed right away and then discarded. What obligations would this place on the company that sells the appliance? From pyth at devel.trillke.net Mon Dec 2 05:02:45 2002 From: pyth at devel.trillke.net (holger krekel) Date: Mon, 2 Dec 2002 11:02:45 +0100 Subject: Is there a bright future for open software projects? In-Reply-To: ; from jkraska@san.rr.com on Sun, Dec 01, 2002 at 09:18:37PM +0000 References: <918bc22f.0212011020.396962e4@posting.google.com> Message-ID: <20021202110245.G11257@prim.han.de> Courageous wrote: > > >Open source is a tremendous opportunity from didactic point of view. Most > >educational programs address only "toy" problems, small projects with few > >people for a short time (months). Real world problems involve 100+ manyears > >of software, which introduces many other concerns than the "toy" problems. > >By realizing functionality in an open source environment you can confront > >students with this 100+ manyear world. Results which are "good enough" could > >flow back to the open source environment. > > I agree with this. I am extreme in my beliefs. For example, it is normal and > routine for government to allow contractors to keep rights to software that > they produce on the public dollar. I view this as a betrayal of the public > trust. What they people pay for should belong to the people. I don't think it's that extreme an oppinion. But as politics are still moving towards making more and more things 'ownable' our view of the world is more and more regarded as 'extreme'. holger From syver-en+usenet at online.no Thu Dec 12 10:03:34 2002 From: syver-en+usenet at online.no (Syver Enstad) Date: 12 Dec 2002 16:03:34 +0100 Subject: win32com question References: Message-ID: Uwe Schmitt writes: > Hi, > > I'm writing some code which should be available for import and as > a com object. Now I want to distinguish if the script is run as > com server or via import. Are there any flags/... available for this > ? The not wanting to see the problem solution to this: class A: def setRunningUnderNormalImport(self): self._isRunningUnderNormalImport = True when importing and using A under normal import, call the method above. Write the class so that it checks the flag and changes its behaviour accordingly. -- Vennlig hilsen Syver Enstad From glc at well.com Fri Dec 13 10:40:34 2002 From: glc at well.com (Greg Chapman) Date: Fri, 13 Dec 2002 15:40:34 GMT Subject: problem in using metaclasses to inspect Python code References: <2259b0e2.0212110908.7ad64e90@posting.google.com> <60ahvuo3vrru0u9etkdoismti9op5pkel9@4ax.com> <2259b0e2.0212121136.730ee7c9@posting.google.com> Message-ID: On 12 Dec 2002 11:36:37 -0800, mis6 at pitt.edu (Michele Simionato) wrote: >If I write > >class Meta(type): > def __init__(cls,name,bases,dict): > print "%s called me!" % name > >class C(object): > __metaclass__=Meta > >then the output of this program is what you expect: > >C called me! > >However, if I write > >class D(object): > pass > >D.__metaclass__=Meta > >I DON'T obtain what I expect, i.e. "D called me!": the metaclass >Meta is not automatically called. How do I invoke Meta explicitly ? Ignoring metaclasses for the moment, suppose we had: class C(object): pass class D(C): pass c = C() Now suppose you want to change the __class__ of c from C to D. You can do this in Python: c.__class__ = D but you certainly wouldn't expect c's __init__ method to be called again (at least I hope you ouldn't). The case is just the same for metaclasses: class D(object): pass The above class statement creates D as an instance of the metaclass 'type.' The metaclass is determined by looking at the 'object' class and discovering that its __class__ is 'type'. When you include a __metaclass__ attr in a class declaration, you override this to say you want to use the given metaclass as the __class__ of the class which is being created (the __metaclass__ attr has no effect once the new class is created). Just as when you create an instance of an object you call the object's class (i.e., c = C()), to create an instance of a class, Python calls the class's class (the metaclass). And just as when you call a class to create an instance, the call goes through the class's __new__ and __init__ methods, when you call a metaclass to create a class, the call goes through the metaclass's __new__ and __init__ methods. class Meta(type): def sayHi(cls): print 'hi from Meta' print 'class instance is', cls.__name__ The above class statement creates a subtype of the 'type' metaclass. D.__class__ = Meta D.sayHi() #prints 'hi from Meta\nclass instance is D' The above changes the metaclass of the type instance D from type to Meta Anyway, just as for instances, you would not expect D's __init__ (as defined in its metaclass) to be called again when you change its __class__. I hope I'm not belaboring this too much, but you could do away with the class statement entirely if you wanted. E.g.: >>> D = type('D', (object,), {}) >>> def sayHi(cls): ... print 'hi from Meta' ... print 'class instance is', cls.__name__ ... >>> Meta = type('Meta', (type,), {'sayHi': sayHi}) >>> D.__class__ = Meta >>> D.sayHi() hi from Meta class instance is D >>> E = Meta('E', (), {}) >>> E.sayHi() hi from Meta class instance is E >>> e = E() >>> e.__class__ >>> e.__class__.__class__ --- Greg Chapman From patrickw106 at yahoo.com.au Sun Dec 22 01:27:54 2002 From: patrickw106 at yahoo.com.au (Patrick W) Date: 22 Dec 2002 17:27:54 +1100 Subject: Python as an Object Oriented Programming Language References: <3E02E842.486B7239@alcyone.com> Message-ID: <87lm2ieff9.fsf@key.localdomain> Aaron K. Johnson writes: > I gain satisfaction in knowing that Python is enjoying real-world > success and usage while their pet language dies a slow pathetic > death. And I have nothing against Lisp (ok a couple of things) as a > language. Unless that attitude changes, you'll probably one day find yourself hanging out in comp.lang.flavour.of.the.month saying similar things about Python and its users. The character of a newsgroup changes over time, and very seldom for the better. But the language has nothing to do with the newsgroup, and it's pretty sad to see somebody wishing that one of the genuine highlights in the history of computing would die a slow and pathetic death simply because his feelings were once hurt on usenet. Please do everyone a favour Aaron. Get over c.l.l., and enjoy Python without disparaging Lisp every time you see half a chance. From max at alcyone.com Sun Dec 22 20:48:21 2002 From: max at alcyone.com (Erik Max Francis) Date: Sun, 22 Dec 2002 17:48:21 -0800 Subject: get a self data in a method call References: Message-ID: <3E066B65.49F107AF@alcyone.com> Sean Ross wrote: > # here's a shorter, if less obvious, version > def func(self, data = None): > data = data or self.data This is a bad idea, in my opinion. Depending on the values you rightly expect to pass in for data, this can have unintended side effects, since it prevents you from passing in any data that evaluates to false (or, rather, if you do so, you'll get the results of self.data instead). That includes 0, 0.0, 0L, (), [], {}, and an instance of a custom type which has overloaded __nonzero__ to return something false. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE / \ It's just a day that brings it all about \__/ Sade Sade Deluxe / http://www.sadedeluxe.com/ The ultimate Sade encyclopedia. From bokr at oz.net Sat Dec 14 18:06:48 2002 From: bokr at oz.net (Bengt Richter) Date: 14 Dec 2002 23:06:48 GMT Subject: Another way to spell __metaclass__ ? References: <3DFBA3E7.98AF08BE@alcyone.com> Message-ID: On Sat, 14 Dec 2002 13:34:31 -0800, Erik Max Francis wrote: >Aahz wrote: > >> This will never happen. One of the design goals for Python is >> syntactic >> stability. > >Plus, I might add, in this day and age, if what you're really in is >designing your own custom language, it probably makes more sense to >write your own script -- perhaps even in Python -- which processes the >custom language into some other language (perhaps even Python). > >That is, if what you want is language customizations, it often makes a >lot more sense to just do them yourself and process to some other, >non-customized language, rather than to ask that the customizations be This relationship also applies between a full language and a bootstrapping core subset of the same language. ISTM an interesting question what a bootstrapping core subset for Python would contain. >put a preexisting language. The downside is that this unfortunately can >create debugging problems, but it's often an infinitely better approach >because it doesn't require consent with any other language designers >:-). > I wonder how many people bother to define a grammar for their ad hoc language, or use tools like yacc/lex and their descendants. Regards, Bengt Richter From martin at v.loewis.de Thu Dec 19 02:07:50 2002 From: martin at v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 19 Dec 2002 08:07:50 +0100 Subject: How hard to allocate ALL Python data space (hence offset-based) in a memory mapped file image? References: Message-ID: Impossible. There is also data on the per-thread stack. Regards, Martin From alf at fayauffre.org Tue Dec 24 09:54:10 2002 From: alf at fayauffre.org (Alexandre Fayolle) Date: Tue, 24 Dec 2002 14:54:10 +0000 (UTC) Subject: CPAN Equivalent for Python References: Message-ID: Dans l'article , Peter Wu a ?crit : > Gillou utters: > >> The ppm package in the Activestate distro, not available as a separate >> package AFAIK > > I find that the PPM from ActiveState is quite limited. Say, I don't find any > packages concerning SMTP, NNTP, etc. from ActiveState. Am I missing > anything? SMTP is in module smtplib in the standard library. NNTP is in module nntplib in the standard library. -- Alexandre Fayolle LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org D?veloppement logiciel avanc? - Intelligence Artificielle - Formations From gminick at hacker.pl Sun Dec 15 16:27:21 2002 From: gminick at hacker.pl (Wojtek Walczak) Date: Sun, 15 Dec 2002 21:27:21 +0000 (UTC) Subject: text file References: <0465EAA2F3655044.CB88A02174F946D8.A16F48896356D8EC@lp.airnews.net> Message-ID: Dnia Sun, 15 Dec 2002 15:14:28 -0500, C. Dunlap napisa?(a): > I want to be able to randomly pull four lines of text out of a file and > write those four lines to another file. Take a look at linecache module: -- [ ] gminick (at) underground.org.pl http://gminick.linuxsecurity.pl/ [ ] [ "Po prostu lubie poranna samotnosc, bo wtedy kawa smakuje najlepiej." ] From asmirnov at asmirnov.com Mon Dec 16 09:18:25 2002 From: asmirnov at asmirnov.com (Andrei Smirnov) Date: 16 Dec 2002 06:18:25 -0800 Subject: [Q] pindent improvement Message-ID: hi i just found that pindent.py is usefull program. to make it more usefull i think it would be good to add another mode which inserts #{ #} pairs. E.g. if a == 5: #{ ... 1000 lines of code #} emacs paren location keystrokes is great deal and #{ }# will make it work. did anyone already do that. if yes is it possible to get improved pindent.py from that anyone? regards, Andrei Smirnov P.S: i am not big fan of inserting of 1000 lines in one block. but i know people who would do that and i don't have any chance to explain to them what's wrong with that. From p030286 at cs.com Mon Dec 16 19:57:03 2002 From: p030286 at cs.com (P030286) Date: 17 Dec 2002 00:57:03 GMT Subject: Newbie matter: MySQL connection References: Message-ID: <20021216195703.12117.00000084@mb-bg.news.cs.com> whats an sql? From reidlai at reidlai.com Thu Dec 12 10:59:08 2002 From: reidlai at reidlai.com (Reid Lai) Date: Thu, 12 Dec 2002 23:59:08 +0800 Subject: Run Python script in command line Message-ID: <3DF8B24C.7080806@reidlai.com> Dear All, I am newbie of Python and have installed Python 2.2 and wxPython. When I run "python.exe test.py", an error about MainLoop is not an attribute of "NoneType". While running "pythonw.exe test.py", nothing comes up. Everything works fine under pyShell. Is there any idea? My test.py is as follow: import os, sys from wxPython.wx import * def MyApp(wxApp): def OnInit(self): mainWindow = wxFrame(NULL, -1, "Testing") mainWindow.Show(true) self.setTopWindow(mainWindow) return true app = MyApp(0) app.MainLoop() Regards, Reid Lai From max at alcyone.com Tue Dec 10 22:58:52 2002 From: max at alcyone.com (Erik Max Francis) Date: Tue, 10 Dec 2002 19:58:52 -0800 Subject: Pre-PEP: __hashable__ References: Message-ID: <3DF6B7FC.42FABA1@alcyone.com> "Delaney, Timothy" wrote: > A new builtin function `hashable(obj)` and a new magic method > `__hashable__(self)` are added. > > `hashable(obj)` takes a single object. If the object has a > `__hashable__()` > method it is called, and the result returned, otherwise the object > itself is > returned: > > def hashable (obj): > > try: > return obj.__hashable__() > except AttributeError: > return self If I understand you correctly, you want a function that will return an immutable version of an object. If that's the case, then the default behavior when a __hashable__ is not defined should not be to return the same object, but rather to raise an exception. If the goal is to get an immutable version of an object, then if an object gives no instructions on how to do that (i.e., the __hashable__ method is not defined), then one should assume that the object itself is probably _mutable_, not that it is immutable. -- Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/ __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE / \ Insight -- the titillating knack for hurting! \__/ Colette The laws list / http://www.alcyone.com/max/physics/laws/ Laws, rules, principles, effects, paradoxes, etc. in physics. From donnalcwalter at yahoo.com Wed Dec 25 00:37:40 2002 From: donnalcwalter at yahoo.com (Donnal Walter) Date: Tue, 24 Dec 2002 23:37:40 -0600 Subject: wxPython - PLEASE Help References: <6af8e801.0212240117.d9ffd87@posting.google.com> <6af8e801.0212242056.547c7e67@posting.google.com> Message-ID: "DP" wrote in message news:6af8e801.0212242056.547c7e67 at posting.google.com... > Cliff, Donnal & Anton, > > thank you very much for your help. > > If you have suggestions as to how I might be able to help > myself next time I'm doing something stupid, please let > me knkw. Well, first of all it is no shame to ask for help when you can't see what you think should be obvious after you have tried your best to find it yourself. And second, you were already on the right track by writing a simplified test case. When I have a complicated application that bombs, I try to compose the simplest program that demonstrates the problem to send to a mailing list, and nine times out of ten I discover my own problem in the process. As I said, you were already on the right track; perhaps you just didn't quite simplify it far enough. Also, it obviously worked for you to ask your question here on c.l.p, but as I said above, most of the time you will get a little quicker response from the wxPython-users group. Now to your question. With wxPython, I usually edit my code in IDLE and keep a separate command window open to run the script every time I make (and save) a change in the code. One can test a lot of possiblities in a short amount of time this way. While debugging I liberally use print statements. I also comment/uncomment different lines or blocks of code to see what happens. And if that doesn't work, I just simplify some more. As Anton suggested, sometimes I go the other direction. I start with a small example that I know will work and then add small pieces until I figure out how to get it to do what I want it to. Donnal Walter Arkansas Children's Hospital From usenet at soraia.com Wed Dec 18 23:51:18 2002 From: usenet at soraia.com (Joe Francia) Date: Thu, 19 Dec 2002 04:51:18 GMT Subject: Python GUI for mysql In-Reply-To: References: Message-ID: Many prefer wxPython (http://www.wxpython.org/) over Tkinter for Python GUI stuff. Try both, see which you prefer. Daryl Middleton wrote: > I am trying to assemble a python based gui to access mysql. I would like > to have several preset queries where the user could just click a button to > activate the selected query. Not sure if I should be looking at TKinter or > something else. Thanks > > From mwh at python.net Tue Dec 17 11:08:12 2002 From: mwh at python.net (Michael Hudson) Date: Tue, 17 Dec 2002 16:08:12 GMT Subject: No macros in Python References: <3DFCDAB5.5FBA7730@engcorp.com> <7h33coweo86.fsf@pc150.maths.bris.ac.uk> <3dff4972_3@news. Message-ID: <7h3y96od3x0.fsf@pc150.maths.bris.ac.uk> "Samuele Pedroni" writes: > I would support such a proposal. Ah, you did send this to the list :) Here's what I sent in email. > "Michael Hudson" ha scritto nel messaggio > news:7h33coweo86.fsf at pc150.maths.bris.ac.uk... > > with : > > [snippery] > > 'with' would have to become a keyword, so that implies a __future__ > > statement, even though it's kind of hard to see how you would use it > > as a name. > > maybe we could do with a contextual keyword, and that would also underline > that this is a 'try' form: > > try with : > Maybe. But that looks as if it should have a finally or an except clause -- and not having those is the whole point of the excercise! But if a new keyword is too much, this is an option. > > I don't think this would be hard to implement. I'll do a prototype > > and a proper PEP after 2.3 is out. > > For completeness I think there could be also an option in the design > solution space using generators (a bit along Beni Cherniavsky's idea ) but > avoiding the need to support yield inside try finally - I don't think that > that could ever have a clean semantics -, namely: > > try with : > > > would be equivalent to: > > _x = > _x.next() > try: > > finally: > _x.next() > > So one could write: > > def locked(lock): > lock.acquire() > yield None > lock.release() > yield None > > and use it as such: > > try with locked(lock): > ... > > this does not require do introduce and pick new special names and that would > count as flexibility, has different performance trade-offs :), but the need > for the second yield and in general is a bit obscure. Well, if I'm writing the PEP I'll mention it but I think it's disgusting. What on earth do generators have to do with anything? I agree that my proposal might lead to lots of small classes, but I don't think this is the answer. Cheers, M. -- FORD: Just pust the fish in your ear, come on, it's only a little one. ARTHUR: Uuuuuuuuggh! -- The Hitch-Hikers Guide to the Galaxy, Episode 1 From theller at python.net Thu Dec 5 13:51:22 2002 From: theller at python.net (Thomas Heller) Date: 05 Dec 2002 19:51:22 +0100 Subject: py2exe problem References: <41c203e.0212030814.f46d30@posting.google.com> Message-ID: Wojtek Walczak writes: > Dnia 3 Dec 2002 08:14:02 -0800, Anand napisa?(a): > > RuntimeError: something's wrong > something's wrong ? :) OK, we'll fix it :) Oh, great! So I don't have to do it myself! Thomas From ravard at univ-rennes1.fr Mon Dec 9 09:03:40 2002 From: ravard at univ-rennes1.fr (Olivier Ravard) Date: Mon, 09 Dec 2002 15:03:40 +0100 Subject: What do you think about a spreadsheet with python/tkinter ? References: Message-ID: Rony wrote: > Wow, greay idea. I ONLY use Tkinter > I'm definitifly interrested !! > ONLY is the right word for me too! O.R. > > Olivier Ravard wrote in message > news:... >> Hi everybody, >> >> I developped a spreadsheet with Python/Tkinter based on Tktable. >> Why did I do this ? because my needs where : >> - to create instances of the spreadsheet and "packing" it in a toplevel >> or a frame, >> - to have all (most) of the functionalities of a standard spreadsheet, >> - ploting curves, >> - inserting or geting data from a python script, >> - a totaly modifiable look and feel, >> - mutli os (Windows and Linux) >> - a tool very light. >> >> I had a look to existing products (like wxGrid with WxPython) but I >> didn't find any code which answer all my requests... >> >> I decided to develop my own product based on Tktable and wrapping its >> functions for python and adding functionalities to interpret formulas. >> There is now a first release. >> >> I will probably give this code to make a free software (with sourforge >> for example), but I need your reactions before about this... >> >> Is there someone interested to contribute for the development ? >> >> Thank you for all your remarks. >> >> O.R. From pinard at iro.umontreal.ca Thu Dec 5 19:46:24 2002 From: pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard) Date: 05 Dec 2002 19:46:24 -0500 Subject: (question) HTML pretty printer In-Reply-To: References: Message-ID: [William Park] > I sometime have to deal with HTML file with messy indentation, I once wrote `xxml.el', an Emacs mode specifically to help me out of a lot of messy HTML files I once had to play with. It reasonably takes care of indentation and refilling. Yet, it seems `xxml.el' became mostly popular not for the reason I made it, but merely as an Emacs colorizer. However, `xxml.el' is only usable works on HTML files which are compliant with some DTD, because it builds on top of PSGML. For achieving compliance, I really had to do it the hard way. In case you are (still :-) interested, then check: http://www.iro.umontreal.ca/~pinard/xxml/ -- Fran?ois Pinard http://www.iro.umontreal.ca/~pinard From jkraska at san.rr.com Sun Dec 1 14:12:50 2002 From: jkraska at san.rr.com (Courageous) Date: Sun, 01 Dec 2002 19:12:50 GMT Subject: Why is Python popular, while Lisp and Scheme aren't? References: <3d5b5ad8.0211080454.50bc6128@posting.google.com> <3de1f902$0$695$edfadb0f@dread12.news.tele.dk> <3DE7F792.6040004@nyc.rr.com> <3DEA24CD.7020107@nyc.rr.com> Message-ID: >Most people who tried Lisp didn't like it BECAUSE of the parens. A fairly heavy syntactic-symbolic load to drive away the parsing load, yes. Here's a source of annoyance: (something (something (something))) When editing this code, if you want to conduct a line-append operation in vim, you have a couple of choices. You either go to the _beginning_ paren of the form you want to append after, hit the % key, hit a, hit return, then tab, and start typing, or you manually count parens at the tail, and hit a, hit return, tab, and then start typing. Either way, this is a big annoyance. Of course, you can opt out of this annoyance by using a Lisp-aware editor. That, however, is a further annoyance. Languages which _require_ special editors are essentially dead in the marketplace. Programmers are a finicky lot, and one way to get a lot of them annoyed with you is to tell them they can't use their favorite editor. let-me-use-my-own-fucking-editor-or-i-will-kill-you-ly yrs C// From nsalmi at abo.fi Tue Dec 10 13:22:09 2002 From: nsalmi at abo.fi (Niklas Salmi) Date: Tue, 10 Dec 2002 20:22:09 +0200 Subject: Python editor example with auto-complete? References: Message-ID: On Tue, 10 Dec 2002 18:04:54 +0000, Robert Oschler wrote: > I figured if someone's done the work of the drop-down list and edit > window processing, might save some time, especially when it comes to the > drop-down list GUI handling. What GUI toolkit are you using? In wxPython, wxStyledTextCtrl has an auto-complete dropdown list. From lac at strakt.com Sun Dec 15 03:37:52 2002 From: lac at strakt.com (Laura Creighton) Date: Sun, 15 Dec 2002 09:37:52 +0100 Subject: To Jive: (was Tkinter and wxWindows) In-Reply-To: Message from Jive Dadson of "Sat, 14 Dec 2002 23:19:41 PST." <3DFC2D0D.66D9E15C@isdfssdfasdf.invalid> References: <3DFC2D0D.66D9E15C@isdfssdfasdf.invalid> Message-ID: <200212150837.gBF8bqen002389@ratthing-b246.strakt.com> > What are the pluses and minuses of Tkinter and wxWindows for Python GUI's? > -- > http://mail.python.org/mailman/listinfo/python-list Since I don't have a working email address for you, here is from Prabhu, author of MayaVi about your video Memory problem: Date: Sun, 15 Dec 2002 11:18:10 +0530 To: Laura Creighton From: Prabhu Ramachandran Subject: Re: Prabhu meet Jive, would be MayaVi user Return-Path: prabhu at aero.iitm.ernet.in Delivery-Date: Sun Dec 15 06:48:24 2002 MIME-Version: 1.0 In-Reply-To: <200212150455.gBF4tAen029992 at ratthing-b246.strakt.com> References: <200212150455.gBF4tAen029992 at ratthing-b246.strakt.com> X-Mailer: VM 7.03 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid Sender: Prabhu Ramachandran X-Spam-Status: No, hits=-0.5 required=5.0 tests=IN_REP_TO,REFERENCES,SPAM_PHRASE_02_03 version=2.43 X-Spam-Level: Hi, >>>>> "LC" == Laura Creighton writes: [Jive] Jive> I installed it under Windows 2000. It doesn't work right on Jive> my computer. The window leaves tracers when you move it, and Jive> I got a message saying something about "out of video memory". [snip] LC> Jive, meet Prabhu, author of MayaVi. My conclusion: The only LC> fix is to buy more memory. LC> Correct, Prabhu? Or maybe a better video card? I really dont know too much about Win2k to comment on the error message. If its any help VTK uses OpenGL so its possible that installing MayaVi using the setup.exe file is not optimal. However, I have not had bug reports of this kind. The problem could also have something to do with your color depth. Maybe try to use MayaVi with a 16bpp screen. That way you might have more video memory. So its likely a hardware related issue or a driver related one or a configuration one. BTW, the MayaVi 1.2 win32 installer was built on Win2K. So it does work fine on the few machines that I checked. cheers, prabhu p.s. I'm not sure I have Jive's correct email address, the one in my CC is from bbdb but I have no idea if that works. From grante at visi.com Mon Dec 2 10:19:15 2002 From: grante at visi.com (Grant Edwards) Date: 02 Dec 2002 15:19:15 GMT Subject: Q: serial port transmit pending count References: <3de40f51$1@news.nz.asiaonline.net> <3de415a7$0$22175$a1866201@newsreader.visi.com> <3de6d5c5$1@news.nz.asiaonline.net> Message-ID: <3deb79f3$0$4488$a1866201@newsreader.visi.com> In article <3de6d5c5$1 at news.nz.asiaonline.net>, Colin Brown wrote: > ... >> TIOCOUTQ returns the number of buffered tx chars. For some >> drivers (e.g. 16x50 UARTS) it doesn't appear to include >> characters in the hardware FIFO. For some others, I know it >> does. >> >> import termios,fcntl,struct >> def txCount(fd): >> s = fcntl.ioctl(fd,termios.TIOCOUTQ,TIOCM_zero_str) >> return struct.unpack('I',s)[0] > > I tried to implement but was unable to figure out what > TIOCM_zero_str should be from the different options available > in ioctl or termios. Sorry. TIOCM_zero_str = struct.pack('I',0) -- Grant Edwards grante Yow! Now I am depressed... at visi.com From kkrueger at example.edu Mon Dec 30 16:46:44 2002 From: kkrueger at example.edu (Karl A. Krueger) Date: Mon, 30 Dec 2002 21:46:44 +0000 (UTC) Subject: HELP! Must choose language! References: <20021229230751.24148.00000389@mb-bj.aol.com> <87lm27xw6g.fsf@gvdnet.dk> Message-ID: Nick Vargish