ANN: Circe 0.0.3b1 released
=== Announcing Circe 0.0.3b1 === Circe Mainpage: http://circe.nick125.com/ Circe Download Page: http://circe.nick125.com/node/2 === New features/bug fixes === We have added several bug fixes, and new features, such as unicode, into the 0.0.3 beta 1 release. === Whats Circe? === Circe is a multiplatform IRC client written in the Python language that utilizes the wxpython library for the graphical interface. Circe features Unicode, Scripting, and many other features. -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
ANN: eric3 3.8.0 released
Hi, this is to inform you about the release of eric3 3.8.0. It is available via http://www.die-offenbachs.de/detlev/eric3.html The list below summarizes the difference between eric3 3.7.x and 3.8.x - too long list of bugfixes to mention here - these usability enhancements DEBUGGER -- added possibility for path translation for passive debugging and remote debugging (Configuration Dialog - Debugger - General) -- added support for project specific debugger settings (see Project menu - Debugger) -- added support for special watchpoint conditions (variable is created, variable is changed) DOCUMENTATION GENERATOR: -- added capability to generate source documentation using CSS style sheets to the eric3-doc utility (including the default style and a style with reversed headers) (Note: eric3-helpviewer cannot show the styles due to the limited HTML support in QTextBrowser) -- added the flag '-t' to eric-doc and eric-api to tell them to look for additional files EDITOR: -- added additional lexers (CSS files, TeX files, Diff files, Make Files, Properties Files and Batch Files) (QScintilla 1.5.x is required) GENERAL: -- some interface cleanups and little reorganization of the configuration dialog -- added action to open multiple files -- added the capability to use %-codes for entering command line arguments. Supported codes are: %D directory of the current editor %F filename of the current editor %H home directory of the current user %U user name of the current user %% the percent sign This functionality is available in the following dialogs: configuration dialog, Debugger-General page version control system, Command Options cvs, Execute Command subversion, Execute Command mercurial, Execute command Tools Configuration -- added a configuration option to set the default encoding for files, that don't contain an encoding marker GRAPHICS: -- added the capability to delete shapes to the graphics dialogs PROJECT MANAGEMENT -- some optimisations and additions in the project browsers -- added configurable filetype associations for projects -- changed Add file dialog to allow the addition of multiple files to the project RUBY: -- enhanced Ruby support (thanks to Richard Dale) SHELL: -- changed the shell completion to use the Scintilla userlist. It is activated by pressing the TAB key and deactivated by pressing the ESC key (without selection) or the TAB or ENTER key (with selection). TASKS -- extended task management with categorization and a colorized display TEMPLATES: -- added a templates system TOOLS: -- added support for cx_Freeze (FreezePython) -- added support for PyLint USER INTERFACE: -- added the commandline option --nokde to disable usage of the KDE dialogs -- switching the editor will highlight the current file in the project browser -- added a context menu for the Listspace view manager -- added an incremental quicksearch to the search toolbar VERSION CONTROL: -- added support for Mercurial VCS What is it? --- eric3 is a Python and Ruby IDE with batteries included. For details see the eric3 home page. Regards, Detlev -- Detlev Offenbach [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
ANN: python-ldap-2.0.11
Find a new release of python-ldap: http://python-ldap.sourceforge.net/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g. processing LDIF, LDAPURLs and LDAPv3 schema). Released 2.0.11 2005-11-07 Changes since 2.0.10: Lib/ * Class ldap.ldapobject.LDAPObject: Each method returns a result now * Class ldap.ldapobject.ReconnectLDAPObject: Some methods called the wrong methods of LDAPObject. Fixed. * Added new class ldap.async.Dict * Slightly cleaned up ldap.schema.subentry.attribute_types() * New sub-module ldap.resiter which simply provides a mix-in class for ldap.ldapobject.LDAPObject with a generator method allresults(). Obviously this only works with Python 2.3+. And it's still experimental. -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
ANN: logintools Critical Update
http://www.voidspace.org.uk/python/logintools.html Critical Bugfix in logintools (which also affects jalopy) The new release is 0.6.2 http://www.voidspace.org.uk/cgi-bin/voidspace/downman.py?file=jalopy_login.zip What's New = I recently updated logintools and jalopy to be compatible with the new pythonutils code. This was the 0.6.0 releases. Embarrassingly, I didn't update the email calls to use the new function signature in cgiutils. New user sign-ups have been thoroughly broken since. sigh The application I use logintools for doesn't allow new user signups. It only has administrator created accounts, so I didn't notice the broken code. This is now fixed and anyone who wants jalopy or logintools to work should download the new release. What is logintools = logintools is a full framework to do user authentication and account management with CGI. It provides you with a full system for restricting access to pages and your applications, including administration features, new user sign-ups, and the facility for users to edit their account details. Even better - you can add it to a Python CGI with as little as two lines of code (really). Configurable in terms of behaviour nad appearance, it also provides a mechanism for storing details of the user account. See the documentation at http://www.voidspace.org.uk/python/logintools.html -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
ANN : ConfigObj 4.0.1 Config File Reader/Writer
Version 4.0.1 of ConfigObj is now available. This includes one bugfix and two new features. http://www.voidspace.org.uk/python/configobj.html What's New ? == Fixed bug in ``Section.walk`` when transforming names as well as values. Added the ``istrue`` section method. (Fetches the boolean equivalent of a string value). Fixed ``list_values=False`` - single line values are not quoted or unquoted. See http://www.voidspace.org.uk/python/weblog/arch_d7_2005_11_05.shtml#e129 for a description of these changes. List values are written as ``item, item`` rather than ``item,item``. What is ConfigObj ? === ConfigObj is a simple but powerful config file reader and writer: an ini file round tripper. It's main feature is that it is very easy to use, with a straightforward programmer's interface and a simple syntax for config files. It has lots of other features though. This module is used in most Voidspace projects. See the ConfigObj Home Page for full documentation. It's features include : * Nested sections (subsections), to any level * List Values * Multiple Line Values * String interpolation (substitution) * Integrated with a powerful validation system o including automatic type checking/conversion o repeated sections o and allowing default values * All comments in the file are preserved * The order of keys/sections is preserved * No external dependencies -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
[ANN] ASTNG 0.13.1
Hi there ! I'm pleased to announce a new bug fix release of ASTNG. This release fixes a lot of bugs detected by pylint users, the most popular application built on top of this package. What's new ? * fix bug on building from living module the same object in encountered more than once time (eg builtins.object) (close #10069) * fix bug in Class.ancestors() regarding inner classes (close #10072) * fix .self_resolve() on From and Module nodes to handle package precedence over module (close #10066) * locals dict for package contains __path__ definition (close #10065) * astng provide GenExpr and GenExprFor nodes with python = 2.4 (close #10063) * fix python2.2 compatibility (close #9922) * link .__contains__ to .has_key on scoped node to speed up execution * remove no more necessary .module_object() method on From and Module nodes * normalize parser.ParserError to SyntaxError with python 2.2 What is ASTNG - The aim of this module is to provide a common base representation of python source code for projects such as pychecker, pyreverse, pylint... Well, actually the development of this library is essentialy governed by pylint's needs. It extends class defined in the compiler.ast [1] module with some additional methods and attributes. Instance attributes are added by a builder object, which can either generate extended ast (let's call them astng ;) by visiting an existant ast tree or by inspecting living object. Methods are added by monkey patching ast classes. Home page - http://www.logilab.org/projects/astng Download ftp://ftp.logilab.org/pub/astng Mailing list mailto://[EMAIL PROTECTED] LOGILAB provides services in the fields of XML techniques and advanced computing (implementation of intelligent agents, knowledge management, natural language processing, statistical analysis, data mining, etc.), and also trainings on Python, XML, UML, Object Oriented design, design patterns use and other cutting edge topics. To know more about Logilab, visit http://www.logilab.com/. Logilab is also a strong supporter of the Free Software movement, and an active member of the Python and Debian communities. Logilab's open source projects can be found on http://www.logilab.org/. Enjoy! -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: Class Variable Access and Assignment
Op 2005-11-04, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Except when your default is a list class foo: x = [] # default a = foo() a.x += [3] b = foo() b.x This results in [3]. So in this case using a class variable x to provide a default empty list doesn't work out in combination with augmented operators. This has nothing to do with namespacing at all, Yes it has. it's the Python idiosyncracy about operations on mutable types. In this case, += mutates an object, while + returns a new one -- as by definition, for mutables. It is the combination of the two. If python had chosen for an approach like function namespaces, the problem wouldn't have occured either. What would have happened then is that the compilor would have noticed the a.x on the right hand side and based on that fact would then have deciced that all a.x references should be instance reference (at least in that function block). The a.x += ... would then result in an AttributeError being raised. You may prefer the current behaviour over this, but that is not the point. The point is that resolution of name spaces does play its role in this problem. It also has little to do with mutable vs immutable types. Someone could implement an immutable type, but take advantage of some implemtation details to change the value inplace in the __iadd__ method. Such an immutable type would show the same problems. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Is mod_python 3.1 good for commercial blogging/CMS?
I am writing a web application that is comparable to a content management system used in blogging. I really want to use Python after having done some evaluation coding using Python 2.3.5 with mod_python 3.1.4 running on Apache 2.0 with the Publisher handler. However, I am still very hesitant to settle on Python. All my research brings up the same collection of scant articles and old mailing list messages that reference each other. I am not interested in using frameworks, partly because I am confused by them, but mostly because I don't want to add another layer of software complexity on top of my code since I already am expecting a hard time finding low-cost dedicated hosting with Apache 2 and mod_python 3 support. I have made a few assumptions regarding Python and mod_python's value. Hopefully the experts here can help correct any of my assumptions and give me some more comfort in committing to Python. 1. I want to use CGI through Publisher handler, instead of CGI handler or PSP. Despite the speed increase mod_python gives me, there is a problem of persistence that can be a problem when dealing with a site that will hosts potentially hundreds of simultaneous users. 2. I have found nothing to quantify the stability and reliability of mod_python 3, and in the absence of a list of major commercial sites that use mod_python, I am left feeling as is there might be technical (read as stability/security) reasons to favor mod_perl over mod_python. 3. I am not very attracted to PSP because I want to separate the logic from the presentation as completely as possible, and PHP and other template languages including PSP seem difficult to do that in. Learning template systems like PyMeld is an unattractive option for me since I don't understand their benefit. Why can't I just use req.write() to output my markup, relying completely on external CSS after the fact? My thought is that HTML templates provide a minimum set of static code that doesn't require extra processing, thus keeping performance up. However, if I minimize my use of req.write() will it make a difference? 4 A final question, is mod_python 2.7 suitable for use in a commercial production system? All I'm doing is text processing, string manipulation, database calls, and some very minor mathematics. If the Apache 1.3 series mod works fine, can I relieve myself of some stress and go with that combo? I'd appreciate some practical advise on this. I am funding this myself on a small budget with no hard deadline, so it is critical to me that I choose a language that will minimize my costs. Are my assumptions correct, or am I falling prey to FUD? Anthony -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 09:03:56 +, Antoon Pardon wrote: Op 2005-11-03, Steven D'Aprano schreef [EMAIL PROTECTED]: On Thu, 03 Nov 2005 13:01:40 +, Antoon Pardon wrote: Seems perfectly sane to me. What would you expect to get if you wrote b.a = b.a + 2? I would expect a result consistent with the fact that both times b.a would refer to the same object. class RedList(list): colour = red L = RedList(()) What behaviour would you expect from len(L), given that L doesn't have a __len__ attribute? Since AFAICT there is no single reference to the __len__ attribute that will be resolved to two different namespace I don't see the relevance. Compare: b.a += 2 Before the assignment, instance b does not have an attribute a, so class attribute a is accessed. You seem to be objecting to this inheritance. I object to the inheritance in a scope where b.a also refers to the instance. If there is no problem that a reference can refer to different objects in the same scope, then the following should work too. a = 0 def f(): a += 2 One can reason just the same that before the assignment f doesn't have a local variable yet, so the global should be accessed. People who don't agree don't want functions to have access to outer scope variables. Do you object to import searching multiple directories? Why do you object to attribute resolution searching multiple namespaces? I don't. I don't see the relevance of these pieces of code. In none of them is there an occurence of an attribute lookup of the same attribute that resolves to different namespaces. Look a little more closely. In all three pieces of code, you have a conflict between the class attribute 'ls' and an instance attribute 'ls'. No you look a little more clearly. In the first scenario, that conflict is resolved by insisting that instances explicitly define an attribute, in other words, by making instance attribute ONLY search the instance namespace and not the class namespace. No it isn't. You seem unable to make a difference between a resolution in general, and a resolution in a scope where an assignment has been made. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Well I wonder. Would the following code be considered a name binding operation: b.a = 5 Try it, it's not. Python 2.2.3 (#1, Nov 12 2004, 13:02:04) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-42)] on linux2 Type help, copyright, credits or license for more information. a Traceback (most recent call last): File stdin, line 1, in ? NameError: name 'a' is not defined b = object() b.a Traceback (most recent call last): File stdin, line 1, in ? AttributeError: 'object' object has no attribute 'a' Once it's attached to an object, it's an attribute, not a base name. So? It is still a name and it gets bound to an object. Sure the name is bound within a specific namespace but that is IMO a detail. unified for Py3k, but in cases like this the distinction is important. But part of this dicussion is about the sanity of making these kind of distinctions. Since they apparantly plan to get rid of them in Py3k, I guess I'm not the only one questioning that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Magnus Lycka schreef [EMAIL PROTECTED]: Antoon Pardon wrote: I have looked and didn't find it in the language reference. This is what I have found: An augmented assignment expression like x += 1 can be rewritten as x = x + 1 to achieve a similar, but not exactly equal effect. It's just a little further down. I'll post the quote once more (but this is the last time ;^): I appreciate you quoting the documentation. But I would appreciate a URL even more. It isn't necessary now any more but it would have been usefull the first time you quoted this material. For targets which are attribute references, the initial value is retrieved with a getattr() and the result is assigned with a setattr(). Notice that the two methods do not necessarily refer to the same variable. When getattr() refers to a class variable, setattr() still writes to an instance variable. For example: class A: x = 3# class variable a = A() a.x += 1 # writes a.x as 4 leaving A.x as 3 I'd say it's documented... Well then I guess they have documented awkward behaviour. That doesn't change the fact that the current behaviour is on occasions awkward or whatever you want to call it. I fear that this has to do with the way reality works. Perhaps it's due to Gödel's incompleteness theorems... :) Sure, Python has evolved and grown for about 15 years, and backward compatibility has always been an issue, but the management and development of Python is dynamic and fairly open-minded. If there had been an obvious way to change this in a way that solved more problems than it caused, I suspect that change would have happened already. Fine I can live with that. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Data Type Problem in Python / COM
I'm trying to use Python / COM to do some drawing automation. Here is a simple code example: This code uses a object made by the Opendwg-org. Autocad has a similar object with the same methods - and the same result. --- import win32com.client odaHost=win32com.client.dynamic.Dispatch(DWGdirectX.OdaHostApp) odaApp = odaHost.Application point = (0,0,0) #x,y,z filename= r'c:\temp\test.dwg' odaDoc = odaApp.Documents.Add(filename) odaDoc.ModelSpace.AddPoint(point) -- Traceback (most recent call last): File C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File F:\dom-users\Autoproject\makedwg.py, line 13, in ? odaDoc.ModelSpace.AddPoint(a) File C:\Python24\Lib\site-packages\win32com\gen_py\2D1051CA-C44F-4206-A86D-45E24A10ABC7x0x2x0.py, line 9516, in AddPoint ret = self._oleobj_.InvokeTypes(1562, LCID, 1, (9, 0), ((12, 1),),Point com_error: (-2147352567, 'Exception occurred.', (0, 'DWGdirectX', 'The parameter is incorrect.\r\n', None, 0, -2147024809), None) --- I have tried both early and late binding but with the same result. I have seen the same code in VB, and the code looks like this: This works. Sub Example_AddPoint() ' This example creates a point in model space. Dim pointObj As AcadPoint Dim location(0 To 2) As Double ' Define the location of the point location(0) = 5#: location(1) = 5#: location(2) = 0# ' Create the point Set pointObj = ThisDrawing.ModelSpace.AddPoint(location) It seems to me that this error is related to the data-type conversation. Any help would be much appreciated Thanks Olav -- http://mail.python.org/mailman/listinfo/python-list
Re: gmpy 1.01 rc near... anybody wanna test
Alex Martelli wrote: I have fixed almost all of the outstanding bugreports and feature request for gmpy: divm doesn't leak memory any more, truediv and floordiv are implemented for all types, etc -- in the current CVS version (one thing I must still look at is divm's behavior when its args are not mutually prime). It currently compiles w/o warnings, and passes all of its 1040+ tests, w/the current release of GMP (4.1.4), Python (2.4.2), MacOSX (10.4.3), XCode (2.1), gcc (4.0).\\ gmpy users able to download and build from sourceforge's cvs are encouraged to test the current CVS version. This is a great time to send me any bug reports or (minor;-) feature requests, since I hope to release a 1.01 release candidate of gmpy ASAP. I'm currently unable to build any Windows version -- any volunteer for THAT task is doubly welcome;-). I tried compiling it with the MS free toolkit but the C compile complains about the absence of gmp.h. Since I see such a header in my Cygwin installation I presume it's something that a full VC7 installation could expect to be present. Unfortunately modifying the build to use the Cygwin include directory gave errors, I suspect because other Cygwin headers were also being picked up in error (I just added /cygwin/usr/include to include_dirs. Compilation ran to completion with the header files from both Cygwin and the GNU gmp-static library, but then of course in both cases I was missing the gmp library to link it against. So I'm afraid you might need someone with access to VC to test this on Windows for you, sorry. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list
RE: connect to a remote web server upload data from Python using sshand scp
[Swarna Pulavarty] I need to upload data ( text image data ) to a remote web server from python. I came to know that i could do it using ssh and scp.but am not sure of how to do it. Well, the only difference between server and web server is that the latter is guaranteed to be listening, probably on port 80, to HTTP requests. If you want to avoid CGI (and, I assume, any other web-interface means of transferring files) then you need to know what *other* services the remote server is running. ssh/scp is one possibility, FTP is another. There are others (rsync or WebDAV, for example). It all depends on what's on offer. If you know the server in question will accept an ssh connection, then one simple solution is to call scp (or pscp from the Putty suite if you're on Win32) from the command line to copy the files you want. If you want to do it from within Python, then you could use os.system or os.popen or one of its cousins to do the same. eg, scp my_local_file.txt [EMAIL PROTECTED]: If you only mean: I know it's theoretically possible to copy files to servers using ssh/scp but I don't about this particular server then you'll need to determine whether the server in question will accept ssh connections, and whether you have the right to create such a connection. Try the above, and see if it works. TJG This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- http://mail.python.org/mailman/listinfo/python-list
pls help me with strange result
hi i defined a func db = Sybase.connect(DSN) ... def x_dml(SQL,conn): ''' Connects to database specified, exec the SQL and returns value''' try: c = conn.cursor() try: c.execute(SQL) res = c.rowcount conn.commit() return res except : return -1 except: return -2 stmt = update table1 set col = '%s' where col = '%s' update table2 set col = '%s' where col = '%s' % ( blah, blah ,blah,blah) try: r = x_dml(stmt,db) if r 0: print r except: print some error Whenever i execute x_dml , it raise the exeception, even though my r is value of 1 and i checked the database tables, they are updated with what i want. somehow the condition r0 did not work..any advice ? thanks -- http://mail.python.org/mailman/listinfo/python-list
Notes 6.X not accessible with Python?
Hi Since my upgrade from Notes 5.X to Notes 6.X I can't access Notes anymore. The third line of the following code is already a show stopper in my case: from win32com.client import Dispatch session = Dispatch('Lotus.NotesSession') session.Initialize('my_secret_passwort') When started, ends: File C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py, line 310, in RunScript exec codeObject in __main__.__dict__ File C:\temp\notes_init.py, line 3, in ? session.Initialize('my_secret_passwort') File c:\Python24\lib\site-packages\win32com\client\dynamic.py, line 489, in __getattr__ raise AttributeError, %s.%s % (self._username_, attr) AttributeError: Lotus.NotesSession.Initialize It worked before though with Version 5.x of Notes. In Notes Version 6.X they introduced the session.Initialize() - that was the point, when I couldn't create an instance anymore. I found no hint on the net... Do you have any idea what is going wrong here? Regards, Marco -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 08:08:42 +, Antoon Pardon wrote: One other way, to implement the += and likewise operators would be something like the following. Assume a getnsattr, which would work like getattr, but would also return the namespace where the name was found. The implementation of b.a += 2 could then be something like: ns, t = getnsattr(b, 'a') t = t + 2 setattr(ns, 'a') I'm not arguing that this is how it should be implemented. Just showing the implication doesn't follow. Follow the logical implications of this proposed behaviour. class Game: current_level = 1 # by default, games start at level one def advance(self): self.current_level += 1 py antoon_game = Game() py steve_game = Game() py steve_game.advance() py steve_game.advance() py print steve_game.level 3 py print antoon_game.level What will it print? Hint: your scheme means that class attributes mask instance attributes. So? This proposal was not meant to replace the current behaviour. It was meant to contradict your assertion that some particular behaviour implied mutable numbers. My proposal was an example that showed the particular behaviour and didn't require mutable numbers, so it showed your assertion false. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 09:07:38 +, Antoon Pardon wrote: Now the b.a on the right hand side refers to A.a the first time through the loop but not the next times. I don't think it is sane that which object is refered to depends on how many times you already went through the loop. [snip] Look at that: the object which is referred to depends on how many times you've already been through the loop. How nuts is that? It is each time the 'x' from the same name space. In the code above the 'a' is not each time from the same namespace. I also think you new very well what I meant. I'm supposed to be a mindreader now? After you've spent multiple posts ranting that, quote, I don't think it is sane that which object is refered to depends on how many times you already went through the loop, I'm supposed to magically read your mind and know that you don't actually object to what you say you object to, but to something completely different? No I meant object when I wrote object. But it is not about the object, it is about the being refered to. And how do you refer to objects, by names in namespace or variables. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Christopher Subich schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Well maybe because as far as I understand the same kind of logic can be applied to something like lst[f()] += foo In order to decide that this should be equivallent to lst[f()] = lst[f()] + foo. But that isn't the case. Because, surprisingly enough, Python tends to evaluate expressions only once each time they're invoked. Well but once can consider b.a as an expression too. An expression that gets evaluated twice in case of b.a += 2 In this case, [] is being used to get an item and set an item -- therefore, it /has/ to be invoked twice -- once for __getitem__, and once for __setitem__. But we are here questioning language design. One could question a design where it is necessary to invoke the [] operator twice, even when it is only mentioned once in the code. Likewises, lst appears once, and it is used once -- the name gets looked up once (which leads to a += 1 problems if a is in an outer scope). f() also appears once -- so to evaluate it more than one time is odd, at best. No more or less than [] or . is to be invoked twice. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-06, Steve Holden schreef [EMAIL PROTECTED]: Steven D'Aprano wrote: [...] But I can't understand the position of folks who want inheritance but don't want the behaviour that Python currently exhibits. instance.attribute sometimes reading from the class attribute is a feature of inheritance; instance.attribute always writing to the instance is a feature of OOP; instance.attribute sometimes writing to the instance and sometimes writing to the class would be, in my opinion, not just a wart but a full-blown misfeature. I ask and I ask and I ask for some use of this proposed behaviour, and nobody is either willing or able to tell me where how or why it would be useful. What should I conclude from this? You should conclude that some readers of this group are happier designing languages with theoretical purity completely disconnected from users' needs. But of course we pragmatists know that practicality beats purity :-) But explicit is better than implicit. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Print to printer
avnit wrote: Do you know if there's a way to print a file? I'm trying to print an HTML file, so your solution is good, but doesn't really work for me. Just reading the HTML file and the printing the content obviously wouldn't work. I also tried: printer.write(file('path/to/file.ext')) but apparently this function only takes strings as parameters. Unless you have a strong desire to waste time and memory by opening the file reading the content into a string and then call printer.write, you could simply do something along the lines of this: fn = 'path/to/file.ext' printer = 'ps' print_cmd = 'lpr -P %s %s' os.system(print_cmd % (printer, fn)) -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-04, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 10:48:54 +, Antoon Pardon wrote: Please explain why this is illegal. x = 1 def f(): x += 1 Because names in function namespaces don't have inheritance. Your quibling about words. This certainly works. x = 1 def f(): a = x + 1 So you could say that function namespaces do inherit from outer scopes. Whether you want to name it inheritance or not, is not the issue. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: how to present Python's OO feature in design?
Kay Schluehr wrote: pcmanlin wrote: because i have a problem that python's oo feature is so great, but maybe when the project become larger, python's no-declaration cannot mapping the design to practice? I am not sure about it. I don't know if there are any tools that convert UML to Python code, but that doesn't stop you working with UML diagrams if you choose, and then hand-coding the classes later. Just remember that one of the major purposes of using UML for big up-front design is to save you from having to do a lot of refactoring later, but in Python this is rarely a difficult task. -- Ben Sizer -- http://mail.python.org/mailman/listinfo/python-list
Re: pls help me with strange result
[EMAIL PROTECTED] wrote: db = Sybase.connect(DSN) ... def x_dml(SQL,conn): ''' Connects to database specified, exec the SQL and returns value''' try: c = conn.cursor() try: c.execute(SQL) res = c.rowcount conn.commit() return res except : return -1 except: return -2 stmt = update table1 set col = '%s' where col = '%s' update table2 set col = '%s' where col = '%s' % ( blah, blah ,blah,blah) try: r = x_dml(stmt,db) if r 0: print r except: print some error Whenever i execute x_dml , it raise the exeception what exception? to see what really happens in there, temporarily change *all* except: clauses to except foo: and run your script again, and let us know what it prints. when you've done that, change the except clauses to except Sybase.Error: (you should only use catch-all except clauses if you report the error in some other way; e.g. by inspecting sys.exc_info, or by using the traceback module. using catch-all to hide errors from yourself is a rather lousy idea) if you want to do things in a more pythonic way, remove *both* try-except clauses from the x_dml function, and leave it to the caller to use try-except to look for errors: import Sybase as DB conn = DB.connect(DSN) def x_dml(SQL,conn): c = conn.cursor() c.execute(SQL) res = c.rowcount conn.commit() return res ... try: r = x_dml(stmt,db) except DB.Error, v: print some error, v else: print r, rows updated /F -- http://mail.python.org/mailman/listinfo/python-list
Re: pls help me with strange result
hi thanks! i used your method to rearrange the try,except clauses, and the problem is solved. I also redefined my funcs to get rid of the try/except clauses and leave it to the caller to do the job of try/except. -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-05, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 12:10:11 +, Antoon Pardon wrote: There are good usage cases for the current inheritance behaviour. I asked before what usage case or cases you have for your desired behaviour, and you haven't answered. Perhaps you missed the question? Perhaps you haven't had a chance to reply yet? Or perhaps you have no usage case for the behaviour you want. There are good use cases for a lot of things python doesn't provide. There are good use cases for writable closures, but python doesn't provide it, shrug, I can live with that. Use cases is a red herring here. Is that a round-about way of saying that you really have no idea of whether, how or when your proposed behaviour would be useful? I am not proposing specific behaviour. Because if I do, you will just try to argue how much worst my proposed behaviour is. Whether or not I can come up with a better proposal is irrelevant to how sane the current behaviour is. Personally, I think that when you are proposing a major change to a language that would break the way inheritance works, there should be more benefits to the new way than the old way. How many times do I have to repeat myself. I'm not proposing a change to the language. Some things are a matter of taste: should CPython prefer or != for not equal? Some things are a matter of objective fact: should CPython use a byte-code compiler and virtual machine, or a 1970s style interpreter that interprets the source code directly? The behaviour you are calling insane is partly a matter of taste, but it is mostly a matter of objective fact. I believe that the standard model for inheritance that you call insane is rational because it is useful in far more potential and actual pieces of code than the behaviour you prefer -- and the designers of (almost?) all OO languages seem to agree with me. I didn't call the model for inheritance insane. Antoon, I've been pedanted at by experts, and you ain't one. The behaviour which you repeatedly described as not sane implements the model for inheritance. The fact that you never explicitly said the standard OO model of inheritance cuts no ice with me, not when you've written multiple posts saying that the behaviour of that standard inheritance model is not sane. I haven't written that once. You may think that you can imply it from what I wrote, but then that is your inferance and not my words. The standard behaviour makes it easy for code to do the right thing in more cases, without the developer taking any special steps, and in the few cases where it doesn't do the right thing (e.g. when the behaviour you want is for all instances to share state) it is easy to work around. By contrast, the behaviour you want seems to be of very limited usefulness, and it makes it difficult to do the expected thing in almost all cases, and work-arounds are complex and easy to get wrong. Please don't make this about what I *want*. I don't want anything. I just noted that one and the same reference can be processed multiple times by the python machinery, resulting in that same reference referencing differnt variables at the same time and stated that that was unsane behaviour. Unsane now? Heaven forbid that I should criticise people for inventing new words, but how precisely is unsane different from insane? In standard English, something which is not sane is insane. Well maybe English works differently from dutch, but I thought there were a whole lot of gradation between sane and insane. And not being sane IMO just means not being at one end of the extreme while being insane meant to be at the other end of the extreme. So when something doesn't make complete sense, instead of it making no sense at all, I would think that wording it as unsane instead of insane resembles best what I intended to mean. If you're just trolling, you've done a great job of it because you fooled me well and good. But if you are serious in your criticism about the behaviour, then stop mucking about and tell us what the behaviour should be. Otherwise your criticism isn't going to have any practical effect on the language at all. I wasn't trolling. I just threw in an off hand remark. That you got so heated up about that remark is not my responsibility. I'm not trolling because I'm willing to defend my remark and I don't intend to get people to get heated up about it. I just don't hold back because people may get heated up about it. If you are serious about wanting the behaviour changed, and not just whining, then somebody has to come up with an alternative behaviour that is better. If I would be whining I would want the behaviour changed. I would just keep complaining about it until someone else would have changed it. Sure I would prefer it changed, but it is not that I *want* it to change. I'll happily continue with python if it doesn't change. Maybe when someone
web interface
Hi, I have a stand alone application which does some scientific computations. I want to provide a web interface for this app. The app is computationally intensive and may take long time for running. Can someone suggest me a starting point for me? (like pointers to the issues involved in this, or even better any of the existing tools for doing this...) Ajar -- http://mail.python.org/mailman/listinfo/python-list
Re: strange sockets
Sion Arrowsmith wrote: conn.sendall(struct.pack(!i, len(data)) + data) or after creating conn conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) to disable Nagle. Sion, thank you for your help, it works but... it works when client server is in python i tried both solutions and they work when client is client.py they both don't work when client is java client when i tried to connect python's server by java client i have the same: % java Loader server.py server.py server.py init 29 server.py reading 631 1 server.py reading 631 40 server.py reading 631 41 why? thanks, skink. -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFLTK - an underrated gem for GUI projects
PyFLTK is not a debian package - yet. Is nobody interested, or is there a more specific reason ? -- Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991 -- http://mail.python.org/mailman/listinfo/python-list
help-I am new to python, I have some query could sombody help me out.
I am very new to python , I have small query could some one help me. every time I get a new load i need to do few things like creating some dir, changing some file contents and moving some files , i would like to know if i can write a python script to do all these operation . -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFLTK - an underrated gem for GUI projects
On Mon, 07 Nov 2005 12:25:49 +0100, egbert wrote: PyFLTK is not a debian package - yet. Is nobody interested, or is there a more specific reason ? AFAIK, the maintainer feels it's still at release-candidate stage. When he's happy with it, I'm sure he could be persuaded to make arrangements to .deb it, or get someone else to. In the meantime, it does build ok on Debian, provided you build/install libfltk from source, and set the FLTK_HOME env var to point into it before running the pyfltk setup.py, as per the instructions in pyfltk tarball. -- Cheers David -- http://mail.python.org/mailman/listinfo/python-list
Re: how to present Python's OO feature in design?
Ben Sizer [EMAIL PROTECTED] writes: I don't know if there are any tools that convert UML to Python code, but that doesn't stop you working with UML diagrams if you choose, and Umbrello helps starting things using as a base UML diagrams. You'll probably have to draw your diagrams on it, though... -- Jorge Godoy [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
can i tar and untar using python
can i tar and untar using python -- http://mail.python.org/mailman/listinfo/python-list
Re: can i tar and untar using python
sumi [EMAIL PROTECTED] wrote: can i tar and untar using python http://docs.python.org/lib/module-tarfile.html /F -- http://mail.python.org/mailman/listinfo/python-list
Re: PyFLTK - an underrated gem for GUI projects
aum [EMAIL PROTECTED] writes: What I'm saying is that there are many basic projects being written for these toolkits, whose functionality could be completely supported by PyFLTK. When only a smaller set of widgets is needed, there's a stronger case for using lighter widget libraries - especially FLTK, because you'll get way more functionality per line of code, and finish your project faster, than if using the bigger toolkits with their application-level red tape - the extra lines of code you have to write to get things done. At least on Linux world, it is easier to find Qt or GTK than FLTK. Not having to deploy new base libraries for another project when there are other available is a big plus, IMHO. Specially if you have no control over the politics of updating servers, installing extra software, etc. And it would sound really weird asking the admin to install new software on the server or on workstations to provide a GUI layer for a more complex project just after using a lighter one... Why not using the same stuff for both? is the question I hear from them. Installing things mean, usually: - checking licenses - checking vulnerabilities - convincing admin / IT staff that it is needed and there's no already installed alternative - maintenance - tests on upgrading the environment - tests on deployment (who knows if there's something that might cause a clash or interfere with other apps?) and a few more stuff. Doing all that just because one app might use a lighter toolkit doesn't look interesting. On the other hand, if the environment requires lighter libs -- the software will be embedded in something --, then it is fine doing all these because of that. If travelling off-road for a few weeks and driving over minefields in enemy territory, take the Hummer. But for ordinary use, like commuting to work, visiting friends, shopping etc, using anything more than the Honda 4-cylinder sedan is IMHO a waste of resources. You can choose only one vehicle and you don't know where you'll be sent. Which will you pick? Similarly, coding something in wx when FLTK will suffice is a waste of time, effort, disk space, CPU cycles and memory. If wx is already there, installing FLTK starts being a waste of resources, disk space, CPU cycles, memory (it won't be shared with other apps...), etc. -- Jorge Godoy [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: web interface
Ajar [EMAIL PROTECTED] writes: I have a stand alone application which does some scientific computations. I want to provide a web interface for this app. The app is computationally intensive and may take long time for running. Can someone suggest me a starting point for me? (like pointers to the issues involved in this, or even better any of the existing tools for doing this...) For the long running task you might get some idea from cvsmonitor (Perl code). It has a long running task that is updating some repositories and giving feedback from time to time to the user. One thing is: detach all what is possible from user interface and give feedback from time to time to avoid browser timeout and the user thinking the app hanged. Be seeing you, -- Jorge Godoy [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
ANN: eric3 3.8.0 released
Hi, this is to inform you about the release of eric3 3.8.0. It is available via http://www.die-offenbachs.de/detlev/eric3.html The list below summarizes the difference between eric3 3.7.x and 3.8.x - too long list of bugfixes to mention here - these usability enhancements DEBUGGER -- added possibility for path translation for passive debugging and remote debugging (Configuration Dialog - Debugger - General) -- added support for project specific debugger settings (see Project menu - Debugger) -- added support for special watchpoint conditions (variable is created, variable is changed) DOCUMENTATION GENERATOR: -- added capability to generate source documentation using CSS style sheets to the eric3-doc utility (including the default style and a style with reversed headers) (Note: eric3-helpviewer cannot show the styles due to the limited HTML support in QTextBrowser) -- added the flag '-t' to eric-doc and eric-api to tell them to look for additional files EDITOR: -- added additional lexers (CSS files, TeX files, Diff files, Make Files, Properties Files and Batch Files) (QScintilla 1.5.x is required) GENERAL: -- some interface cleanups and little reorganization of the configuration dialog -- added action to open multiple files -- added the capability to use %-codes for entering command line arguments. Supported codes are: %D directory of the current editor %F filename of the current editor %H home directory of the current user %U user name of the current user %% the percent sign This functionality is available in the following dialogs: configuration dialog, Debugger-General page version control system, Command Options cvs, Execute Command subversion, Execute Command mercurial, Execute command Tools Configuration -- added a configuration option to set the default encoding for files, that don't contain an encoding marker GRAPHICS: -- added the capability to delete shapes to the graphics dialogs PROJECT MANAGEMENT -- some optimisations and additions in the project browsers -- added configurable filetype associations for projects -- changed Add file dialog to allow the addition of multiple files to the project RUBY: -- enhanced Ruby support (thanks to Richard Dale) SHELL: -- changed the shell completion to use the Scintilla userlist. It is activated by pressing the TAB key and deactivated by pressing the ESC key (without selection) or the TAB or ENTER key (with selection). TASKS -- extended task management with categorization and a colorized display TEMPLATES: -- added a templates system TOOLS: -- added support for cx_Freeze (FreezePython) -- added support for PyLint USER INTERFACE: -- added the commandline option --nokde to disable usage of the KDE dialogs -- switching the editor will highlight the current file in the project browser -- added a context menu for the Listspace view manager -- added an incremental quicksearch to the search toolbar VERSION CONTROL: -- added support for Mercurial VCS What is it? --- eric3 is a Python and Ruby IDE with batteries included. For details see the eric3 home page. Regards, Detlev -- Detlev Offenbach [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: help-I am new to python, I have some query could sombody help me out.
sumi [EMAIL PROTECTED] writes: I am very new to python , I have small query could some one help me. every time I get a new load i need to do few things like creating some dir, changing some file contents and moving some files , i would like to know if i can write a python script to do all these operation . You can... Creating directories, processing file contents and moving files is not hard with Python (if the processing part is simple, then it all becomes easy). :-) Take a look at the tutorial and the documentation on the website. -- Jorge Godoy [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Circe
Sargun Dhillon [EMAIL PROTECTED] writes: Me and my friends are working on a project, Circe we'd like some people to test it: I guess you weren't aware of this. http://www.emacswiki.org/cgi-bin/wiki/Circe -- Björn Lindström [EMAIL PROTECTED] Student of computational linguistics, Uppsala University, Sweden -- http://mail.python.org/mailman/listinfo/python-list
Re: can i tar and untar using python
On Nov 7, 2005, at 3:00 AM, sumi wrote: can i tar and untar using python The standard library does it again: http://docs.python.org/lib/module-tarfile.html Jay P. -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
First of all, I've still not heard any sensible suggestions about a saner behaviour for augmented assignment or for the way Python searches the class scope after the instance scope. What do you suggest? Today, x += n acts just as x = x + n if x is immutable. Do you suggest that this should change? Today, instance.var will look for var in the class scope if it didn't find it in the instance scope. Do you propose to change this? Or, do you propose that we should have some second order effect that makes the combination of instance.var += n work in such a way that these features are no longer orthogonal? Paul Rubin wrote: Steven D'Aprano [EMAIL PROTECTED] writes: A basic usage case: class Paper: size = A4 def __init__(self, contents): # it makes no sense to have class contents, # so contents go straight into the instance self.contents = contents So add: self.size = Paper.size and you've removed the weirdness. What do you gain here by inheriting? class LetterPaper(Paper): size = Letter class LegalPaper(Paper): size = Legal This is what you gain. Subclassing it extremely simple, if all you want is that the subclass differs in data. You could also have __init__ pick up the class variable and set an instance variable, but why make things difficult if it's trivial now? Considering how __init__ works in Python class hierachies, where you need to manually call __init__ in ancestor classes if you've overridden them, the fact that a simple self.size picks up a class variable is particularly useful if you use MI. For instance I could imagine a FirstPageMixin class in this case, and a FancyFirstPageMixin that subclasses that. There, we might want to pick up certain margin values or other positions etc. The spirit of Python is to make it easy to do things right, not make it difficult to make mistakes. If you want a language that tries to prevent you from making mistakes, use Ada. When developing code in a dynamic language such as Python, it's really important to have a decent set of automated tests. If you have, you'll hopefully notice bugs like these. Making changes in the language that forces you to write more code will in general not reduce the total number of bugs, but rather increase them. I've been involved with high reliability design long enough to know the problems involved fairly well. I mainly worked with electronic design then, but the problem is the same: The more safety gadgets you add, the more stuff you have that can break. The details are a bit difference, but in principle the problem is the same. Ever wondered why Russian and Chinese rocket launchers have a better reliability than the American? Simply put, they're simpler. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to present Python's OO feature in design?
pcmanlin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] As I know java has many UML tools to design for its OO feature, is there any tools or good concept for Python project Modeling? Check out EnterpriseArchitect (http://www.sparxsystems.com.au ). They have a very good UML tool that has a Python plugin. I'd recommend the Professional Edition - the code reverse-engineering is like magic. Not open source or free, though. EA Pro is US$199, Academic license is US$105. But compare to Rational at $US000's, it is a great value for the money. -- Paul McGuire (not associated wth SparxSystems, just a happy customer) -- http://mail.python.org/mailman/listinfo/python-list
Re: gmpy 1.01 rc near... anybody wanna test
[EMAIL PROTECTED] (Alex Martelli) writes: gmpy users able to download and build from sourceforge's cvs are encouraged to test the current CVS version. Oh cool, I wondered whether any gmpy maintenance was still going on. I'll see if I can give the new version a try. -- http://mail.python.org/mailman/listinfo/python-list
Re: Using Which Version of Linux
[EMAIL PROTECTED] wrote: ok, i m going to use Linux for my Python Programs, mainly because i need to see what will these fork() and exec() do. So, can anyone tell me which flavour of linux i should use, some say that Debian is more programmer friendly, or shold i use fedora, or Solaris. Because these three are the only ones i know of that are popular and free. Maybe you've already figured it out, but Ubuntu is your distro. See http://www.ubuntulinux.com/ It's based on Debian, but while standard Debian is a bit daunting to get up and running the first time, Ubuntu is one of the easiest Linux distros. Ubuntu is also much more up-to-date than the stable Debian, but still very stable. If you just want to try it out, and don't want to repartition your disk (or install a second disk), you can try the Ubuntu Live CD. Ubuntu has good support for modern hardware and a polished user interface, and it's very much focused on Python. You'll find a lot of Python modules that are maintained in the Ubuntu repositiories and will be kept up-to-date with something similar to Windows Update, all very convenient if you're on the net. Naturally, you can install Python source packages and run 'python setup.py install' the normal way, but then you won't get this auto-update feature. Mark Shuttleworth's projects, such as Ubuntu and School Tool, are also investing good money in Python development. You can even get Ubuntu CDs sent to you for free! Order ten and give out to your friends! I think it's a good way to promote Python. I've used Linux since Slackware 2.3. (Or 2.2?1994?) I'm certainly computer literate, but never had the stamina to get the normal Debian distro to work. After Slackware, I've tried Red Hat, SuSE and Mandrake etc, and I mainly use Red Hat Enterprise Linux at work, but given a choice I prefer Ubuntu these days. -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Antoon Pardon wrote: Op 2005-11-05, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 12:10:11 +, Antoon Pardon wrote: There are good usage cases for the current inheritance behaviour. I asked before what usage case or cases you have for your desired behaviour, and you haven't answered. Perhaps you missed the question? Perhaps you haven't had a chance to reply yet? Or perhaps you have no usage case for the behaviour you want. There are good use cases for a lot of things python doesn't provide. There are good use cases for writable closures, but python doesn't provide it, shrug, I can live with that. Use cases is a red herring here. Is that a round-about way of saying that you really have no idea of whether, how or when your proposed behaviour would be useful? I am not proposing specific behaviour. Because if I do, you will just try to argue how much worst my proposed behaviour is. Whether or not I can come up with a better proposal is irrelevant to how sane the current behaviour is. If you can't provide a superior alternative then you have little right to be questioning the present behavior. Honestly, you are like a child with a whistle who keeps blowing the whistle to the annoyance of all around it simply because it likes being able to make the noise, and causing the annoyance. Personally, I think that when you are proposing a major change to a language that would break the way inheritance works, there should be more benefits to the new way than the old way. How many times do I have to repeat myself. I'm not proposing a change to the language. So you have a clear impression that Python's current behavior is unsatisfactory enough to be called unsane which, when challenged, you insist simply means not at the extreme end of some imaginary sanity scale you have constructed for the purpose if bending English to your will. And you refuse to propose anything further towards the sane end of the scale because people will try to argue that your proposal would be worse than the existing behavior. Good grief, I though I was dealing with an adult here, but I must be mistaken. Some things are a matter of taste: should CPython prefer or != for not equal? Some things are a matter of objective fact: should CPython use a byte-code compiler and virtual machine, or a 1970s style interpreter that interprets the source code directly? The behaviour you are calling insane is partly a matter of taste, but it is mostly a matter of objective fact. I believe that the standard model for inheritance that you call insane is rational because it is useful in far more potential and actual pieces of code than the behaviour you prefer -- and the designers of (almost?) all OO languages seem to agree with me. I didn't call the model for inheritance insane. Well you are repeatedly call one aspect of the Python inheritance model insane. You appear to feel that repetition of an argument will make it more true, which is sadly not the case. Antoon, I've been pedanted at by experts, and you ain't one. The behaviour which you repeatedly described as not sane implements the model for inheritance. The fact that you never explicitly said the standard OO model of inheritance cuts no ice with me, not when you've written multiple posts saying that the behaviour of that standard inheritance model is not sane. I haven't written that once. You may think that you can imply it from what I wrote, but then that is your inferance and not my words. Nonsense. The standard behaviour makes it easy for code to do the right thing in more cases, without the developer taking any special steps, and in the few cases where it doesn't do the right thing (e.g. when the behaviour you want is for all instances to share state) it is easy to work around. By contrast, the behaviour you want seems to be of very limited usefulness, and it makes it difficult to do the expected thing in almost all cases, and work-arounds are complex and easy to get wrong. Please don't make this about what I *want*. I don't want anything. I just noted that one and the same reference can be processed multiple times by the python machinery, resulting in that same reference referencing differnt variables at the same time and stated that that was unsane behaviour. But you clearly don't perceive this as being related to Python's inheritance mechanism, presumably because you aren't prepared to accept that an instance inherits names from its class just like a class inherits names from its superclass. Unsane now? Heaven forbid that I should criticise people for inventing new words, but how precisely is unsane different from insane? In standard English, something which is not sane is insane. Well maybe English works differently from dutch, but I thought there were a whole lot of gradation between sane and insane. And not being sane IMO just means not being at one end of the extreme while being insane meant to be at the
Re: strange sockets
Skink wrote: Sion Arrowsmith wrote: conn.sendall(struct.pack(!i, len(data)) + data) or after creating conn conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) to disable Nagle. Sion, thank you for your help, it works but... it works when client server is in python i tried both solutions and they work when client is client.py they both don't work when client is java client when i tried to connect python's server by java client i have the same: % java Loader server.py server.py server.py init 29 server.py reading 631 1 server.py reading 631 40 server.py reading 631 41 why? Seems to me that should probably be a question for comp.lang.java. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list
Python and PL/SQL
Does Pyton PL/SQL programming language of Oracle support? Thx -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading- Stopping
Op 2005-11-04, Tuvas schreef [EMAIL PROTECTED]: Is there a way to stop a thread with some command like t.stop()? Or any other neat way to get around it? Thanks! What do you mean with stop? Pauze it or make it finish. In the latter case, if you really want it you could use the following. It requires ctypes. It also wont stop a thread while it is in a C extention. In that case the exception will be raised when it returns from the extention. import os import ctypes from time import sleep from random import randint class TimeOut(Exception): pass class Alarm(Exception): pass import threading class Xthread(threading.Thread): def start(self): self.__original_run = self.run self.run = self.__run threading.Thread.start(self) def __run(self): self.__thrd_id = threading._get_ident() try: self.__original_run() finally: self.run = self.__original_run def raize(self, excpt): Nr = ctypes.pythonapi.PyThreadState_SetAsyncExc(self.__thrd_id, ctypes.py_object(excpt)) while Nr 1: ctypes.pythonapi.PyThreadState_SetAsyncExc(self.__thrd_id, None) sleep(0.1) Nr = ctypes.pythonapi.PyThreadState_SetAsyncExc(self.__thrd_id, ctypes.py_object(excpt)) def alarm(self, tm): alrm = threading.Timer(tm, self.raize, (TimeOut,)) alrm.start() return alrm if __name__ == __main__: class Continue(Xthread): def run(self): self.id = os.getpid() print self.id, Begin i = 0 try: for _ in xrange(randint(0,20)): for e in xrange(4 * 10): i = i + e print self.id, Finished except Alarm: print self.id, Interupted lst = [Continue() for _ in xrange(10)] for T in lst: T.start() try: sleep(10) finally: for T in lst: T.raize(Alarm) -- http://mail.python.org/mailman/listinfo/python-list
Re: Threading- Stopping
[Tuvas] Is there a way to stop a thread with some command like t.stop()? Or any other neat way to get around it? Thanks! Good question. And one that gets asked so often, I ask myself why it isn't in the FAQ? http://www.python.org/doc/faq/library.html It really should be in the FAQ. Isn't that what FAQs are for? Maybe the FAQ needs to be turned into a wiki? -- alan kennedy -- email alan: http://xhaus.com/contact/alan -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
vb_bv wrote: Does Pyton PL/SQL programming language of Oracle support? Thx PL/SQL is only supported *inside* Oracle databases. Python can be used to call PL/SQL procedures (I recommend the cx_Oracle module), but you can't run Python inside the database like PL/SQL. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
vb_bv wrote: Does Pyton PL/SQL programming language of Oracle support? Python supports calling Oracle PL/SQL procedures. Here's an example using the cx_Oracle database adapter: import cx_Oracle con = cx_Oracle.connect(outlinetest/[EMAIL PROTECTED]) cur = con.cursor() cur.execute( ... BEGIN ... PKG_Test.Test; ... END; ... ) cx_Oracle also works with all types I needed, including passing ARRAYs to stored procedures, and getting REFCURSORs back. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Python gui
Philippe C. Martin wrote: Thanks, Tkinter it is. It really depends on what you want to achieve. If you want to make any advanced GUI application, you'll probably want some third party extension to Tkinter anyway, and then you might as well choose another tool kit from the beginning, whether it's wxPython, PyGtk or PyQt. It's not more inconvenient to rely on wxPython than to rely on e.g. Pmw (2 years since last release). -- http://mail.python.org/mailman/listinfo/python-list
Re: strange sockets
Steve Holden wrote: Skink wrote: Sion Arrowsmith wrote: conn.sendall(struct.pack(!i, len(data)) + data) or after creating conn conn.setsockopt(socket.SOL_TCP, socket.TCP_NODELAY, 1) to disable Nagle. Sion, thank you for your help, it works but... it works when client server is in python i tried both solutions and they work when client is client.py they both don't work when client is java client when i tried to connect python's server by java client i have the same: % java Loader server.py server.py server.py init 29 server.py reading 631 1 server.py reading 631 40 server.py reading 631 41 why? Seems to me that should probably be a question for comp.lang.java. ok, my falt. again... ;) i forgot to use Buffered[Input|Output]Stream regards Steve -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
infidel wrote: vb_bv wrote: Does Pyton PL/SQL programming language of Oracle support? PL/SQL is only supported *inside* Oracle databases. Python can be used to call PL/SQL procedures (I recommend the cx_Oracle module), but you can't run Python inside the database like PL/SQL. If one is really really really insisting on running Python code inside an Oracle database, I think it could be done: you can write Oracle stored procedures in C libraries, Java libraries and even .NET libraries (10g on win32). And there are Python implementations for C, Java and .NET. So much for the theory. In my not so humble opinion, instead of all this fancy stuff, you will be better off writing your stored procedures in PL/SQL, which is a very good language for manipulating data, and writing portable, efficient and maintainable server-side database code. -- Gerhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
Gerhard Häring [EMAIL PROTECTED] writes: In my not so humble opinion, instead of all this fancy stuff, you will be better off writing your stored procedures in PL/SQL, which is a very good language for manipulating data, and writing portable, efficient and maintainable server-side database code. And if Python is the requirement, but not Oracle, one can write stored procedures (functions is the name) in Python with PostgreSQL. ;-) -- Jorge Godoy [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Tkinter and X11
Hi, Is there anything that prevents tkinter from running prior to login to an X11 session: as the X server is already up ? Regards, Philippe -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
Op 2005-11-07, Steve Holden schreef [EMAIL PROTECTED]: Antoon Pardon wrote: Op 2005-11-05, Steven D'Aprano schreef [EMAIL PROTECTED]: On Fri, 04 Nov 2005 12:10:11 +, Antoon Pardon wrote: There are good usage cases for the current inheritance behaviour. I asked before what usage case or cases you have for your desired behaviour, and you haven't answered. Perhaps you missed the question? Perhaps you haven't had a chance to reply yet? Or perhaps you have no usage case for the behaviour you want. There are good use cases for a lot of things python doesn't provide. There are good use cases for writable closures, but python doesn't provide it, shrug, I can live with that. Use cases is a red herring here. Is that a round-about way of saying that you really have no idea of whether, how or when your proposed behaviour would be useful? I am not proposing specific behaviour. Because if I do, you will just try to argue how much worst my proposed behaviour is. Whether or not I can come up with a better proposal is irrelevant to how sane the current behaviour is. If you can't provide a superior alternative then you have little right to be questioning the present behavior. Nonesense. Unable to produce a superior alternative doesn't make one unable to evaluate. Personally, I think that when you are proposing a major change to a language that would break the way inheritance works, there should be more benefits to the new way than the old way. How many times do I have to repeat myself. I'm not proposing a change to the language. So you have a clear impression that Python's current behavior is unsatisfactory enough to be called unsane which, You are generalizing my words to the point they no longer reasonably resemble what I wrote. If you're just trolling, you've done a great job of it because you fooled me well and good. But if you are serious in your criticism about the behaviour, then stop mucking about and tell us what the behaviour should be. Otherwise your criticism isn't going to have any practical effect on the language at all. I wasn't trolling. I just threw in an off hand remark. That you got so heated up about that remark is not my responsibility. I'm not trolling because I'm willing to defend my remark and I don't intend to get people to get heated up about it. I just don't hold back because people may get heated up about it. The defense of your original remark implies very strongly that it wasn't offhand, and that you are indeed trolling. Hence the reduction in the frequency of my replies. You make it more and more difficult to take you seriously. Fine that goes both ways. I don't mind not being taken serious by people I have trouble taking serious my self. No doubt that goes for you too. So I propose we don't react to each other any longer, since there would be very little purpose in it. Particularly since you have now resorted to a defense which involves refusing to define a non-existent word in any but the vaguest terms - you are trying to specify a position on the imaginary continuum of sanity, but you don't say how close to which end you are trying to specify. This puts you somewhere between barmy and crackpot on my own personal scale. If you are serious about wanting the behaviour changed, and not just whining, then somebody has to come up with an alternative behaviour that is better. If I would be whining I would want the behaviour changed. I would just keep complaining about it until someone else would have changed it. Instead you just keep complaining about it, full stop. No I don't keep complaining about. I just defend my claim. Since we are all now fully aware of your opinions, couldn't you just shut up, or do we have to send you to your room without any supper? Whine, whine, whine. Well since you are aware of my opinion, why don't you just ignore any new articles of mine in this thread and go on, instead of whining about the fact that I care to defend what I wrote but won't put more fuel on the fire by starting my idea about superior behaviour which would only make this thread live longer without any chance of coming to a shared conclusion. Every time I reply to you my spell checker looks at your name and shows me a dialog with an ignore all button on it. I have this increasing suspicion that it's trying to tell me something. Well maybe you should listen to it. It seems damn obvious neither of us has anything interresting to say to the other. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
Thanks for your answers. I would like to document with Python PL/SQL of programs, so similarly as javadoc for Java. I do not know whether it is possible. If yes, I would like to know how. Thx -- http://mail.python.org/mailman/listinfo/python-list
need help extracting data from a text file
Hey there, i have a text file with a bunch of values scattered throughout it. i am needing to pull out a value that is in parenthesis right after a certain word, like the first time the word 'foo' is found, retrieve the values in the next set of parenthesis (bar) and it would return 'bar' i think i can use re to do this, but is there some easier way? thanks -- http://mail.python.org/mailman/listinfo/python-list
[ANN] ASTNG 0.13.1
Hi there ! I'm pleased to announce a new bug fix release of ASTNG. This release fixes a lot of bugs detected by pylint users, the most popular application built on top of this package. What's new ? * fix bug on building from living module the same object in encountered more than once time (eg builtins.object) (close #10069) * fix bug in Class.ancestors() regarding inner classes (close #10072) * fix .self_resolve() on From and Module nodes to handle package precedence over module (close #10066) * locals dict for package contains __path__ definition (close #10065) * astng provide GenExpr and GenExprFor nodes with python = 2.4 (close #10063) * fix python2.2 compatibility (close #9922) * link .__contains__ to .has_key on scoped node to speed up execution * remove no more necessary .module_object() method on From and Module nodes * normalize parser.ParserError to SyntaxError with python 2.2 What is ASTNG - The aim of this module is to provide a common base representation of python source code for projects such as pychecker, pyreverse, pylint... Well, actually the development of this library is essentialy governed by pylint's needs. It extends class defined in the compiler.ast [1] module with some additional methods and attributes. Instance attributes are added by a builder object, which can either generate extended ast (let's call them astng ;) by visiting an existant ast tree or by inspecting living object. Methods are added by monkey patching ast classes. Home page - http://www.logilab.org/projects/astng Download ftp://ftp.logilab.org/pub/astng Mailing list mailto://[EMAIL PROTECTED] LOGILAB provides services in the fields of XML techniques and advanced computing (implementation of intelligent agents, knowledge management, natural language processing, statistical analysis, data mining, etc.), and also trainings on Python, XML, UML, Object Oriented design, design patterns use and other cutting edge topics. To know more about Logilab, visit http://www.logilab.com/. Logilab is also a strong supporter of the Free Software movement, and an active member of the Python and Debian communities. Logilab's open source projects can be found on http://www.logilab.org/. Enjoy! -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org -- http://mail.python.org/mailman/listinfo/python-list
[ANN] pylint 0.8.1
Hi there ! I'm pleased to announce a new bug fix release of PyLint. Notice that a lot of other bugs will be fixed by updating the logilab-astng package to 0.13.1. Almost all bugs noticed by pylint users since the 0.8 is out should be corrected by updating pylint and astng :) What's new ? * fix deprecated module false positive when the code imports a module whose name starts with a deprecated module's name (close #10061) * fix module has no name __dict__ false positive (close #10039) * fix access to undefined variable __path__ false positive (close #10065) * fix explicit return in __init__ false positive when return is actually in an inner function (close #10075) What is pylint ? Pylint is a python tool that checks if a module satisfy a coding standard. Pylint can be seen as another pychecker since nearly all tests you can do with pychecker can also be done with Pylint. But Pylint offers some more features, like checking line-code's length, checking if variable names are well-formed according to your coding standard, or checking if declared interfaces are truly implemented, and much more (see http://www.logilab.org/projects/pylint/ for the complete check list). The big advantage with Pylint is that it is highly configurable, customizable, and you can easily write a small plugin to add a personal feature. The usage it quite simple : $ pylint mypackage.mymodule This command will output all the errors and warnings related to the tested code (here : mypackage.mymodule), will dump a little summary at the end, and will give a mark to the tested code. Pylint is free software distributed under the GNU Public Licence. Home page - http://www.logilab.org/projects/pylint Download ftp://ftp.logilab.org/pub/pylint Mailing list mailto://[EMAIL PROTECTED] Enjoy! -- Sylvain Thénault LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
vb_bv wrote: Thanks for your answers. I would like to document with Python PL/SQL of programs, so similarly as javadoc for Java. I do not know whether it is possible. If yes, I would like to know how. Is it possible - yes. Has it been done? I doubt it. You can fetch the sourcecode of oracle packages through sql-statements (google for how to do it), and then process it with whatever tool you like. But you will have to write your own parser and generator for that, pydoc or epydoc won't be of much use here. However, implementing such a thingy in python is certainly a good idea. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: How to read all files in a directory
Hello Larry, Thanks a lot for your response. It helps me a lot. I used your suggestion and got an error: path=r'C:\datafiles\' ^SyntaxError: EOL while scanning single-quoted string Then, I changed just a little bit and it works fine. I set path='C:\\datafiles\\' instead of path=r'C:\datafiles\' Again Larry, I appreciate your suggestion Hung Vo.Larry Bates [EMAIL PROTECTED] wrote: Not tested:import globimport ospath=r'C:\datafiles\'for fileName in glob.glob(os.path.join(path,'*.DAT')):dataFile=open(fileName, 'r').readlines().. Continue yur code here.-Larry Bateshungbichvo wrote: Dear All, My python application is small. It reads data from a file. My code is: fileName = '900128.DAT' dataFile = open(fileName, 'r').readlines() I have to run 100 input files .DAT. Each time I run application, I have to change code fileName to a new one. For example, fileName = 'NewFile.DAT'. I do not know how I can process all file with extension .DAT in a specific directory once only. Any suggestion will be appreciated, Thank you. Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
ANN: python-ldap-2.0.11
Find a new release of python-ldap: http://python-ldap.sourceforge.net/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g. processing LDIF, LDAPURLs and LDAPv3 schema). Released 2.0.11 2005-11-07 Changes since 2.0.10: Lib/ * Class ldap.ldapobject.LDAPObject: Each method returns a result now * Class ldap.ldapobject.ReconnectLDAPObject: Some methods called the wrong methods of LDAPObject. Fixed. * Added new class ldap.async.Dict * Slightly cleaned up ldap.schema.subentry.attribute_types() * New sub-module ldap.resiter which simply provides a mix-in class for ldap.ldapobject.LDAPObject with a generator method allresults(). Obviously this only works with Python 2.3+. And it's still experimental. -- http://mail.python.org/mailman/listinfo/python-list
Re: need help extracting data from a text file
[EMAIL PROTECTED] wrote: Hey there, i have a text file with a bunch of values scattered throughout it. i am needing to pull out a value that is in parenthesis right after a certain word, like the first time the word 'foo' is found, retrieve the values in the next set of parenthesis (bar) and it would return 'bar' i think i can use re to do this, but is there some easier way? thanks well, you can use string.find with offsets, but an re is probably a cleaner way to go. I'm not sure which way is faster - it'll depend on how many times you're searching compared to the overhead of setting up an re. start = textfile.find(foo() + 4 # 4 being how long 'foo(' is end = textfile.find(), start) value = textfile[start:end] Iain -- http://mail.python.org/mailman/listinfo/python-list
RAW_INPUT
I am having trouble with the following example used in a tutorial: print "Halt !" s = raw_input ("Who Goes there? ") print "You may pass,", s I run this and get the following: Halt! Who Goes there? --thats itif I hit enter again "You may pass," appears... In the example after running you should get: Halt! Who Goes there? Josh You may pass, Josh I'm assuming s=Josh...but that is not included in the statement at all I don't know how you put "Josh" in or how you got it to finish running w/o hitting enter after "Who goes there?" What am I doing wrong? thanks, -xray- Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list
Re: gmpy 1.01 rc near... anybody wanna test
[EMAIL PROTECTED] wrote: I downloaded and tried the CVS version. Division still didn't work as expected. Now that's truly interesting... import gmpy gmpy.version() '1.01' gmpy.mpz(9)//gmpy.mpz(4) Traceback (most recent call last): File stdin, line 1, in ? TypeError: unsupported operand type(s) for //: 'mpz' and 'mpz' while, on my machine: Helen:~/gmpy/test alex$ python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type help, copyright, credits or license for more information. import gmpy gmpy.mpz(9)//gmpy.mpz(4) mpz(2) etc, etc. The CVS commit which I did before the post you're replying to gave me: ... Checking in src/gmpy.c; /cvsroot/gmpy/gmpy/src/gmpy.c,v -- gmpy.c new revision: 1.14; previous revision: 1.13 done Mailing [EMAIL PROTECTED] Generating notification message... Generating notification message... done. and the logfile should be...: Helen:~/gmpy alex$ cvs log src/gmpy.c | head -20 [EMAIL PROTECTED]'s password: RCS file: /cvsroot/gmpy/gmpy/src/gmpy.c,v Working file: src/gmpy.c head: 1.14 branch: locks: strict access list: symbolic names: import_release: 1.1.1.1 import_vendor: 1.1.1 keyword substitution: kv total revisions: 15;selected revisions: 15 description: revision 1.14 date: 2005/11/07 05:29:24; author: aleax; state: Exp; lines: +83 -2 Add floordiv and truediv implementations to mpz, mpq, mpf (unittests still need to be added). revision 1.13 ... Unfortunately, I didn't have a CVS $Id$ in gmpy.c (silly me!) so checking that you have the right version was hard. I have now added it, and an accessor to it from Python: Helen:~/gmpy/test alex$ python Python 2.4.1 (#2, Mar 31 2005, 00:05:10) [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin Type help, copyright, credits or license for more information. import gmpy gmpy._cvsid() '$Id: gmpy.c,v 1.15 2005/11/07 15:43:24 aleax Exp $' Can you cvs update again and check what's going on? Thanks! Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: gmpy 1.01 rc near... anybody wanna test
Paul Rubin http://[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Alex Martelli) writes: gmpy users able to download and build from sourceforge's cvs are encouraged to test the current CVS version. Oh cool, I wondered whether any gmpy maintenance was still going on. Only when I get guilt-tripped into working a bit on it;-). gmpy as it stands mostly meets my modest personal needs, but I'd still like to keep it useful to others, too, of course. I'll see if I can give the new version a try. Thanks. The floordiv and truediv still need tests, and there's a mysterious report of them not working at all (which I suspect is due to a cvs update somehow going awry -- I've now added a gmpy._cvsid() accessor to return the CVS $Id$ string to facilitate checking for such issues); divm shouldn't leak memory any more, but still fails when arguments aren't mutually prime (haven't looked into that yet). I will be working on these issues presently. I haven't even looked at what's new in GMP 4.1.4 to see if there's anything there which I should wrap in gmpy (or use to reimplement some of gmpy's existing functionality in a more optimized way...). I'm open to suggestions for any such minor features or optimizations, although my main goal for 1.01 is to remove bugs and leaks -- any _major_ new feature will have to wait for a future 1.1 or whatever... Current gmpy's biggest single issue right now is that I can't build it on Windows, having no Windows machine, and even less any GMP 4.1.4 for Windows... Alex -- http://mail.python.org/mailman/listinfo/python-list
A Tcl/Tk programmer learns Python--any advice?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm a Tcl/Tk developer who has been dabbling with Python for some time, but had not seen a compelling reason to really learn the language. Programming in Tkinter seemed redundant to me since I already have direct access to that toolkit via Tcl, and the other Python GUI toolkits I tried--PyQt and wxPython--were frustrating with their learning curve. Well, I have finally found a good reason to learn Python in more depth: the language already directly supports things that I want to do in my next project (specifically the Carbon modules in Mac OS X), whereas Tcl would require a lot of extending in C before I could get started. I've decided that it's probably less work to learn the Python way of doing things, and if I stick with Tkinter, then the learning curve will be reduced. I've gotten all the approropriate resources for learning Python (docs, books, tutorials), so my question is this: are there any gotchas that Tcl programmers often encounter in learning Python? I'm thinking specifically about habits that may require unlearning, for instance, such as grokking object orientation (Tcl procedures are now embedded deep in my brain). Any advice, particularly from other programmers with a lot of experience in Tcl, is appreciated. - -- Cheers, Kevin Walzer, PhD WordTech Software - Tame the Terminal http://www.wordtech-software.com sw at wordtech-software.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.1 (Darwin) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDb3sLJmdQs+6YVcoRAq5xAJoCbDYeMO58yRPqid4K5WTd1+PbcgCbBATL 0UppdVmVdcb+AfFUIsvrdrY= =Hk8w -END PGP SIGNATURE- -- http://mail.python.org/mailman/listinfo/python-list
Re: need help extracting data from a text file
this is cool, it is only going to run about 10 times a day, the text is not written out like foo(bar) its more like foo blah blah blah (bar) the thing is , every few days the structure of the textfile may change, one of the reasons i wanted to avoid the re. thanks for the tip, -- http://mail.python.org/mailman/listinfo/python-list
Re: gmpy 1.01 rc near... anybody wanna test
Steve Holden [EMAIL PROTECTED] wrote: ... I tried compiling it with the MS free toolkit but the C compile complains about the absence of gmp.h. Since I see such a header in my Cygwin installation I presume it's something that a full VC7 installation could expect to be present. gmp.h is the header of GMP, the GNU library that gmpy wraps. It appears to be preinstalled on Cygwin, from what you mention, but I'm pretty sure Microsoft doesn't preinstall GPL-covered libraries from GNU with THEIR stuff... a suitable Windows version need to be procured and installed in some other way (having no Windows around I'm hard put to suggest what is the best way to do this these days). So I'm afraid you might need someone with access to VC to test this on Windows for you, sorry. Tx for the attempt, but I don't think VC per se will suffice -- somebody needs to build or find a suitable version of GMP for Windows, too. Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter and X11
There should be no problem with this. After all, even the greeter is just an X application. Depending on which login manager you use (xdm/kdm/gdm/whatever) the details of getting your Tkinter app to actually be run will vary, though. In gdm, it looks like adding it to the file /etc/X11/gdm/Init/default may be the ticket. It is probably best to run app.tk.call(rename, send, ) in your program, for the reasons outlined in the send(n) manpage: SECURITY The send command is potentially a serious security loophole. On Unix, any application that can connect to your X server can send scripts to your applications. These incoming scripts can use Tcl to read and write your files and invoke subprocesses under your name. Jeff pgpboAbTGH8cL.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Sending email in utf-8?
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485, in data * Module smtplib, line 312, in send * Module socket, line 1, in sendall UnicodeEncodeError: 'ascii' codec can't encode characters in position 263-264: ordinal not in range(128) any suggestions on how I can approach this so that the email can be sent without raising errors? -- http://mail.python.org/mailman/listinfo/python-list
Re: need help extracting data from a text file
[EMAIL PROTECTED] wrote: this is cool, it is only going to run about 10 times a day, the text is not written out like foo(bar) its more like foo blah blah blah (bar) then I guess you worked this out, but just for completeness: keywordPos = textfile.find(foo) start = textfile.find((, keywordPos) end = textfile.find(), start) value = textfile[start:end] Iain -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter and X11
Thanks jeff, I actually want that Tkinter application to be the greater: replace gdm Still feasible as far as Tkinter is conserned ? Thanks and regards, Philippe [EMAIL PROTECTED] wrote: There should be no problem with this. After all, even the greeter is just an X application. Depending on which login manager you use (xdm/kdm/gdm/whatever) the details of getting your Tkinter app to actually be run will vary, though. In gdm, it looks like adding it to the file /etc/X11/gdm/Init/default may be the ticket. It is probably best to run app.tk.call(rename, send, ) in your program, for the reasons outlined in the send(n) manpage: SECURITY The send command is potentially a serious security loophole. On Unix, any application that can connect to your X server can send scripts to your applications. These incoming scripts can use Tcl to read and write your files and invoke subprocesses under your name. Jeff -- http://mail.python.org/mailman/listinfo/python-list
Re: need help extracting data from a text file
um, wait. what you are doing here is easier than what i was doing after your first post. thanks a lot. this is going to work out ok. thanks again. sk -- http://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
On Mon, 2005-11-07 at 07:57 -0800, john boy wrote: I am having trouble with the following example used in a tutorial: print Halt ! s = raw_input (Who Goes there? ) print You may pass,, s at this print line you need to do print you may pass, %s % s this will allow you to enter the string s into the output sentence I run this and get the following: Halt! Who Goes there? --thats itif I hit enter again You may pass, appears... In the example after running you should get: Halt! Who Goes there? Josh You may pass, Josh I'm assuming s=Josh...but that is not included in the statement at all I don't know how you put Josh in or how you got it to finish running w/o hitting enter after Who goes there? What am I doing wrong? thanks, -xray- __ Yahoo! FareChase - Search multiple travel sites in one click. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: Python, COM Servers, and Multi-Threading
Hi, you get best performance if you make your servers local servers, since then every interpreter runs in ist own process. If you make it an inproc server you synchronize all threads/CPUs with the GIL. Even better multithreading support you will get if you mark your server to run in an multithreaded apartment (MTA). e.g. class COMClass: _public_methods_ = [ 'Method', ... ] _reg_verprogid_ = COMServer.COMClass.1 _reg_progid_ = COMServer.COMClass _reg_desc_ = COMServer COMClass _reg_clsid_ = {30BD3490-2632-11cf-AD5B-524153480001} _reg_class_spec_ = win32com.servers.COMServer.COMClass _reg_threading_ = free # --- Threading model _reg_clsctx_ = pythoncom.CLSCTX_LOCAL_SERVER # -- own exe Stefan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carl Waldbieser Sent: Tuesday, October 11, 2005 12:46 AM To: python-list@python.org Subject: Python, COM Servers, and Multi-Threading I have been considering using Python and the Reportlab library for generating PDF reports for the back-end of a web based application. The application runs most of its background tasks on a dedicated server that is Windows based (Win2K or Win2k3). The program that launches the tasks requires a COM-based interface, so I wrote a Python COM server using Mark Hammond's PythonCom libraries and import and run the reporlab modules from there. I had been reading up on Python and it's handling of the multiple threads, specifically the Global Interpreter Lock (GIL). I got to wondering if a multi-processor machine machine would be able to take advantage of its extra processing power using this setup. I am guessing that the GIL is global with respect to each instance of a running Python interpreter, so if say 4 interpreters were running, a 4 processor machine would be able to take advantage of this. However, I am not quite sure how launching my reports via COM behaves-- if I launched 4 reports this way, would that be like launching 4 seperate instances of the Python interpreter, or would it be just a single instance, and therefore run into the limitations of the GIL? If so, can anybody offer suggestions as to a design that would be better able to take advantage of a multi-processor machine? Thanks, Carl Waldbieser -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
[OT] Map of email origins to Python list
We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net/maps/map.do?group=668 This represents emails sent to the group since October 27. Would like to hear what you think of it. Thanks for listening. Claire -- Claire McLister [EMAIL PROTECTED] 1684 Nightingale Avenue Suite 201 Sunnyvale, CA 94087 408-733-2737(fax) http://www.zeemaps.com -- http://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
On Mon, 07 Nov 2005 12:14:15 -0600, A D [EMAIL PROTECTED] wrote: On Mon, 2005-11-07 at 07:57 -0800, john boy wrote: I am having trouble with the following example used in a tutorial: print Halt ! s = raw_input (Who Goes there? ) print You may pass,, s at this print line you need to do print you may pass, %s % s this will allow you to enter the string s into the output sentence No, this is totally irrelevant. The print in the original code will work just fine. I run this and get the following: Halt! Who Goes there? --thats itif I hit enter again You may pass, appears... In the example after running you should get: Halt! Who Goes there? Josh You may pass, Josh I'm assuming s=Josh...but that is not included in the statement at all I don't know how you put Josh in or how you got it to finish running w/o hitting enter after Who goes there? What am I doing wrong? Did you try typing Josh and then enter? Or any other name, for that matter... Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
RE: when and how do you use Self?
Well, thanx for all the ... useful information. I thought that I would try, but this has turned out to be a waist of my time. Have fun playing with your egos -Original Message- From: Bruno Desthuilliers [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 9:29 PM To: python-list@python.org Subject: Re: when and how do you use Self? Steven D'Aprano a écrit : On Thu, 03 Nov 2005 20:19:03 +0100, bruno at modulix wrote: Steven D'Aprano wrote: On Thu, 03 Nov 2005 10:14:23 +0100, bruno at modulix wrote: Tieche Bruce A MSgt USMTM/AFD wrote: I am new to python, Could someone explain (in English) how and when to use self? Don't use self. Use other. Are you serious? Are you seriously wondering if I am serious ? Well, you are either serious, or you're guilty of giving extremely bad advice to a newbie who will probably have even less ability to recognise an in-joke than I do. Guilty. I thought the pun would be obvious (even if very bad). -- http://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
john boy wrote: --thats itif I hit enter again You may pass, appears... ... What am I doing wrong? raw_input accepts, that's right, input. So, when you get the line Who goes there? You don't hit enter; you type whatever you want to be printed with You may pass,. Then you hit enter. -- http://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
The raw_input('Who Goes there?') function writes out the arg and then waits for *user input* , and that is considered terminated when you hit return. Since you only hit return without typing 'Josh' first you get an empty string which is then printed to screen... ('You may pass,'+) Type something and it will appear NOTE: the string variable (print you may pass, %s % s ) is uncalled for... Good luck! -- http://mail.python.org/mailman/listinfo/python-list
Re: Sending email in utf-8?
morphex [EMAIL PROTECTED] wrote: I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485, in data * Module smtplib, line 312, in send * Module socket, line 1, in sendall UnicodeEncodeError: 'ascii' codec can't encode characters in position 263-264: ordinal not in range(128) any suggestions on how I can approach this so that the email can be sent without raising errors? looks like you're confusing Unicode (character set) and UTF-8 (encoding). smtplib only deals with 8-bit character streams; if you want to use a specific encoding, you have to apply it yourself *before* you call the library: HOST = ... FROM = ... TO = ... BODY = u... server = smtplib.SMTP(HOST) server.sendmail(FROM, [TO], BODY.encode(utf-8)) server.quit() /F -- http://mail.python.org/mailman/listinfo/python-list
Re: need help extracting data from a text file
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey there, i have a text file with a bunch of values scattered throughout it. i am needing to pull out a value that is in parenthesis right after a certain word, like the first time the word 'foo' is found, retrieve the values in the next set of parenthesis (bar) and it would return 'bar' i think i can use re to do this, but is there some easier way? thanks Using string methods to locate the 'foo' instances is by far the fastest way to go. If your requirements get more complicated, look into using pyparsing (http://pyparsing.sourceforge.net). Here is a pyparsing rendition of this problem. This does three scans through some sample data - the first lists all matches, the second ignores matches if they are found inside a quoted string, and the third reports only the third match. This kind of context-sensitive matching gets trickier with basic string and re tools. -- Paul data = i have a text file with a bunch of foo(bar1) values scattered throughout it. i am needing to pull out a value that foo(bar2) is in parenthesis right after a certain word, like the foo(bar3) first time the word 'foo' is found, retrieve the values in the next set of parenthesis foo(bar4) and it would return 'bar' do we want to skip things in quotes, such as 'foo(barInQuotes)'? from pyparsing import Literal,SkipTo,quotedString pattern = Literal(foo) + ( + SkipTo()).setResultsName(payload) + ) # report all occurrences of xxx found in foo(xxx) for tokens,start,end in pattern.scanString(data): print tokens.payload, at location, start print # ignore quoted strings pattern.ignore(quotedString) for tokens,start,end in pattern.scanString(data): print tokens.payload, at location, start print # only report 3rd occurrence tokenMatch = {'foo':0} def thirdTimeOnly(strg,loc,tokens): word = tokens[0] if word in tokenMatch: tokenMatch[word] += 1 if tokenMatch[word] != 3: raise ParseException(strg,loc,wrong occurrence of token) pattern.setParseAction(thirdTimeOnly) for tokens,start,end in pattern.scanString(data): print tokens.payload, at location, start print Prints: bar1 at location 36 bar2 at location 116 bar3 at location 181 bar4 at location 278 barInQuotes at location 360 bar1 at location 36 bar2 at location 116 bar3 at location 181 bar4 at location 278 bar3 at location 181 -- http://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
A D [EMAIL PROTECTED] wrote: print You may pass,, s at this print line you need to do print you may pass, %s % s this will allow you to enter the string s into the output sentence where did you buy your python license ? s = josh print hello,, s hello, josh print hello, %s % s hello, josh /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Python doc problem example: gzip module (reprise)
(gulp! red-in-the-face) yes Steve, I meant gist, sorry if I offended anyone, specially Fredrik since I was referring to the 'substance' of his post...certainly not as if it were a 'joke' . Jean-Marc -- http://mail.python.org/mailman/listinfo/python-list
Re: RAW_INPUT
john boy [EMAIL PROTECTED] : I am having trouble with the following example used in a tutorial: print Halt ! s = raw_input (Who Goes there? ) print You may pass,, s I run this and get the following: Halt! Who Goes there? --thats itif I hit enter again You may pass, appears... In the example after running you should get: Halt! Who Goes there? Josh You may pass, Josh I'm assuming s=Josh...but that is not included in the statement at all I don't know how you put Josh in or how you got it to finish running w/o hitting enter after Who goes there? What am I doing wrong? I think you're supposed to type Josh (or any other name, without the quotes) *before* you hit enter. (raw_input() reads a string of characters from the terminal, and returns them as a string. if you don't type anything, there's nothing to return, and nothing to print) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: gmpy 1.01 rc near... anybody wanna test
Alex Martelli wrote: Steve Holden [EMAIL PROTECTED] wrote: ... I tried compiling it with the MS free toolkit but the C compile complains about the absence of gmp.h. Since I see such a header in my Cygwin installation I presume it's something that a full VC7 installation could expect to be present. gmp.h is the header of GMP, the GNU library that gmpy wraps. It appears to be preinstalled on Cygwin, from what you mention, but I'm pretty sure Microsoft doesn't preinstall GPL-covered libraries from GNU with THEIR stuff... a suitable Windows version need to be procured and installed in some other way (having no Windows around I'm hard put to suggest what is the best way to do this these days). So I'm afraid you might need someone with access to VC to test this on Windows for you, sorry. Tx for the attempt, but I don't think VC per se will suffice -- somebody needs to build or find a suitable version of GMP for Windows, too. Yes indeed. I took a look at the gmplib source distro, but it would mean installing way too much other stuff to be practical right now, unfortunately. As a consolation prize you might like to know that it appears to build and pass all tests happily under Cygwin. Sorry I can't be more help. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC www.holdenweb.com PyCon TX 2006 www.python.org/pycon/ -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT] Map of email origins to Python list
Claire McLister [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net/maps/map.do?group=668 This represents emails sent to the group since October 27. Would like to hear what you think of it. -- sigh Another sleepless camera pointed at the fishbowl that is my online life. I guess it's a great way to find where there might be Python jobs to be found, or at least kindred souls (or dissident Python posters in countries where Internet activity is closely monitored...) To me, it's either cool in a creepy sort of way, or creepy in a cool sort of way. -- Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: help-I am new to python, I have some query could sombody help me out.
sumi wrote: I am very new to python , I have small query could some one help me. every time I get a new load i need to do few things like creating some dir, changing some file contents and moving some files , i would like to know if i can write a python script to do all these operation . Sure, that's something Python shines at. If you are very new, you will probably want to look at some general tutorial first. The specific functions you need are in some standard modules though, and when you start to feel comfortable with how Python works in general, read these: http://docs.python.org/lib/builtin.html http://docs.python.org/lib/module-os.path.html http://docs.python.org/lib/module-os.html (file stuff) http://docs.python.org/lib/module-shutil.html -- http://mail.python.org/mailman/listinfo/python-list
Re: how to present Python's OO feature in design?
pcmanlin wrote: As I know java has many UML tools to design for its OO feature, is there any tools or good concept for Python project Modeling? My favourite is whiteboard and digital camera. I don't generate any code from that though... ;) It's the approach suggested in Scott Ambler's Agile Modeling, and I think it's just just the right approach. Don't forget a good set of automated tests. We use TextTest, but ymmv. It fits our type of applications. -- http://mail.python.org/mailman/listinfo/python-list
Lie Hetland book: Beginning Python..
I am reading Beginning Python from Novice to Professional and the book is really awesome. Nonetheless on ch 13 Database Support I found this code to import data (in a txt file) into a SQLite Database: #this was corrected because original import sqlite does not work from pysqlite2 import dbapi2 as sqlite #this function strips the txt file from special chars def convert(value): if value.startswith('~'): return value.strip('~') if not value: value = '0' return float(value) conn = sqlite.connect('food.db') curs = conn.cursor() curs.execute(''' CREATE TABLE food ( id TEXT PRIMARY KEY, desc TEXT, water FLOAT, kcal FLOAT, proteinFLOAT, fatFLOAT, ashFLOAT, carbs FLOAT, fiber FLOAT, sugar FLOAT ) ''') field_count = 10 #following is the line I suspect mistyped markers = ', '.join(['%s']*field_count) query = 'INSERT INTO food VALUES (%s)' % markers for line in open('ABBREV.txt'): fields = line.split('^') vals = [convert(f) for f in fields[:field_count]] #the following line raises error curs.execute(query,vals) conn.commit() conn.close The error was Traceback (most recent call last): File C:\Python24\food.py, line 39, in ? curs.execute(query,vals) pysqlite2.dbapi2.OperationalError: near %: syntax error After two hours of trying (did I say I am a beginner?) and after some documentation about PySqlite I suspect the error is in: markers = ', '.join(['%s']*field_count) I think Magnus intended: markers = ', '.join(['?']*field_count) Did I found an errata or my Python is still too green? -- http://mail.python.org/mailman/listinfo/python-list
python server
Hello I`m writing a program (server in future) in python. I would like to write it in such a way that I will be able to write gui in any language and connect to my python program and use functionality included with it. are there any libraries that I could use? I dont know if i wrote it understandably but maybe picture will explain it: || | python | || - module in python - - connection (???) - -gui in any language (java, c++, python, etc). | server | |---| what could I use as http? mqseries? webservices? what are the possibilites? thx for answers linuxfan -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
On Mon, 07 Nov 2005 12:05:40 +0100, Magnus Lycka [EMAIL PROTECTED] wrote: First of all, I've still not heard any sensible suggestions about a saner behaviour for augmented assignment or for the way Python searches the class scope after the instance scope. A nit, but a sizeable one: For new-style classes, the class scope is searched first for a descriptor that may trump the instance logic. What do you suggest? Today, x += n acts just as x = x + n if x is immutable. Do you suggest that this should change? A descriptor allows you to make it do as you like, so it's a matter of discussing default behavior, not what you are locked into (although costs re optimization could be a topic). Today, instance.var will look for var in the class scope if it didn't find it in the instance scope. Do you propose to change this? It is already changed, for new-style classes. It is only if a data descriptor is NOT found in the class hierarchy that an existing instance variable is accessed as usual. Or, do you propose that we should have some second order effect that makes the combination of instance.var += n work in such a way that these features are no longer orthogonal? I don't think he is proposing anything, just defending against what he considers misinterpretations of what he is saying. Given how hard it is to say ANYTHING and be understood EXACTLY, this tends towards a pursuit of quantum nits ;-) I suspect we all experience the emotions relevant to being misunderstood; we just stop at different nit granularities (modulo horn locking ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Tkinter- Building a message box
I've been trying to build a fairly simple message box in tkinter, that when a button is pushed, will pop up a box, that has a line of text, an entry widget, and a button, that when the button is pushed, will return the value in the line of text. However, while I can read the value of the button, I want to wait till the button is pushed to return the value. Any ideas of how I could do this? -- http://mail.python.org/mailman/listinfo/python-list
Re: when and how do you use Self?
Tieche Bruce A MSgt USMTM/AFD [EMAIL PROTECTED] wrote: Well, thanx for all the ... useful information. I thought that I would try, but this has turned out to be a waist of my time. did you perhaps miss that at least three people wrote proper replies to your post? http://article.gmane.org/gmane.comp.python.general/429472 http://article.gmane.org/gmane.comp.python.general/429703 http://article.gmane.org/gmane.comp.python.general/429858 (if you read the newsgroup in a threaded reader, spotting them should be relatively easy). /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and PL/SQL
Thanks for your answers. I would like to document with Python PL/SQL of programs, so similarly as javadoc for Java. I do not know whether it is possible. If yes, I would like to know how. All of the source code for procedures and packages in an oracle database can be retreived from the USER_SOURCE view. It's just plain text, though, and one record per line. Parsing it for documentation would be up to you. There are other views that might be useful too, like USER_TABLES, USER_TAB_COLUMNS, USER_OBJECTS, USER_PROCEDURES, USER_ARGUMENTS, etc etc etc -- http://mail.python.org/mailman/listinfo/python-list
Re: Class Variable Access and Assignment
On 7 Nov 2005 08:38:49 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: Op 2005-11-04, Magnus Lycka schreef [EMAIL PROTECTED]: [...] Sure, Python has evolved and grown for about 15 years, and backward compatibility has always been an issue, but the management and development of Python is dynamic and fairly open-minded. If there had been an obvious way to change this in a way that solved more problems than it caused, I suspect that change would have happened already. Fine I can live with that. Amen ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter- Building a message box
Tuvas wrote: I've been trying to build a fairly simple message box in tkinter, that when a button is pushed, will pop up a box, that has a line of text, an entry widget, and a button, that when the button is pushed, will return the value in the line of text. However, while I can read the value of the button, I want to wait till the button is pushed to return the value. Any ideas of how I could do this? The way I do it is to set self.result in the dialog to the return value just before closing and exiting. And then instead of openiug the dialog directly I use a function to pass and sometimes modify the values to the dialog and then return the dialog.result value after it's closed. Something like... def domydialog(*args, **kwds): # # Check and modify args or kwds here if needed. # mydialog(*args, **kwds) return mydialog.result Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list