[ANN] Release 0.42 of Task Coach
Hi all, Hi all, I'm pleased to announce release 0.42 of Task Coach. New in this release: Bugs fixed: * Double clicking a task with children in the tree view would open the edit dialog and expand or collapse the task as well. Fixed to not collapse or expand the task when double clicking it. * Adding a subtask to a collapsed parent task now automatically expands the parent task. * Changing the description of a task or effort record wouldn't mark the task file as changed. * Time spent is now updated every second. * Don't try to make a backup when loading the file fails. Reported by Scott Schroeder. * (Windows installer only) Association between .tsk files and Task Coach was broken. Feature changed: * The start date of a task can now be left unset, creating a task that is permanently inactive. This can be useful for activities that you would normally not want to plan, but have to keep a time record for, e.g. sickness. What is Task Coach? Task Coach is a simple task manager that allows for hierarchical tasks, i.e. tasks in tasks. Task Coach is open source (GPL) and is developed using Python and wxPython. You can download Task Coach from: http://taskcoach.niessink.com https://sourceforge.net/projects/taskcoach/ A binary installer is available for Windows XP, in addition to the source distribution. Note that Task Coach is alpha software, meaning that it is wise to back up your task file regularly, and especially when upgrading to a new release. Cheers, Frank -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Roundup Issue Tracker release 0.8.4
Roundup is a simple-to-use and -install issue-tracking system with command-line, web and e-mail interfaces. It is based on the winning design from Ka-Ping Yee in the Software Carpentry Track design competition. This 0.8.4 release fixes some bugs: Fixed: - extra CRs in CSV export files on Windows platform (sf bug 1195742) - activity RDBMS columns were being reported in changes - fix name collision in roundup.cgi script (sf bug 1203795) - fix handling of invalid interval input - search locale files relative ro roundup installation path (sf bug 1219689) - use translation for boolean property rendering (sf bug 1225152) - enabled disabling of REMOTE_USER for when it's not a valid username (sf bug 1190187) - fix invocation of hasPermission from templating code (sf bug 1224172) - have 'roundup-admin security' display property restrictions (sf bug 1222135) - fixed templating menu() sort_on handling (sf bug 1221936) - allow specification of pagesize, sorting and filtering in classhelp popups (sf bug 1211800) - handle dropped properies in rdbms/metakit journal export (sf bug 1203569) - handle missing Subject lines better (sf bug 1198729) - sort/group by missing values correctly (sf bugs 1198623, 1176897) - discard, don't bounce messages to the mailgw when the messages's sender is invalid (ie. when we try to bounce, we get a 550 unknown user account response from the SMTP server) (sf bug 1190906) - removed debugging code from cgi/actions.py - refactored hyperdb.rawToHyperdb, allowing a number of improvements (thanks Ralf Schlatterbeck) - don't try to set a timeout for IMAPS (thanks Paul Jimenez) - present Reject exception messages to web users (sf bug 1237685) If you're upgrading from an older version of Roundup you *must* follow the Software Upgrade guidelines given in the maintenance documentation. Roundup requires python 2.3 or later for correct operation. To give Roundup a try, just download (see below), unpack and run:: python demo.py Source and documentation is available at the website: http://roundup.sourceforge.net/ Release Info (via download page): http://sourceforge.net/projects/roundup Mailing lists - the place to ask questions: http://sourceforge.net/mail/?group_id=31577 About Roundup = Roundup manages a number of issues (with flexible properties such as description, priority, and so on) and provides the ability to: (a) submit new issues, (b) find and edit existing issues, and (c) discuss issues with other participants. The system will facilitate communication among the participants by managing discussions and notifying interested parties when issues are edited. One of the major design goals for Roundup that it be simple to get going. Roundup is therefore usable out of the box with any python 2.3+ installation. It doesn't even need to be installed to be operational, though a disutils-based install script is provided. It comes with two issue tracker templates (a classic bug/feature tracker and a minimal skeleton) and five database back-ends (anydbm, sqlite, metakit, mysql and postgresql). -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Sydney Python Meetup July 21: Python, Perl, and Cold Beverages
Date: Thursday July 21 Time: 6:00pm-8:30pm, with drinks and food during and after. Topics: Graham Dumpleton on The Vampire mod_python extension Paul Fenwick So you want to start a business? Place: James Squires Brewhouse 2 The Promenade, King St Wharf Sydney Fee:$0.00 The Sydney Python meetup group is on this Thursday. The meeting time has been brought forward half an hour, and the formal part of the evening will commence promptly at 6:30pm. The James Squires Brewhouse managed to book the Python Meetup Group and the Perl Mongers in adjoining rooms for the same night. Everybody has promised to be nice and we'll be combining with them to hear from one of their Melbourne gurus. As always, everybody is welcome. Graham Dumpleton, author of Vampire, will be speaking first (6:30-7:30). He describes his presentation thusly: Although I'll talk a bit about the motivations behind writing Vampire and why this extra layer on top of mod_python is useful, what I want to talk about more is what I have learnt from writing Vampire. From that I would like to go on to describe a new and better way of doing this same thing for mod_python that Vampire attempted to do. This new approach moves even further away from the monolithic framework approach towards small building blocks of functionality that can be slotted together to build up a web application how you want it and not how some framework dictates you should do it. More information on Vampire can be found at http://www.dscpl.com.au/projects/vampire/ Paul Fenwick of the Melbourne Perl Mongers will also be speaking (7:30-8:30). His talk, So you want to start a business, will be presented at the SAGE-AU conference later this year, and an abstract can be found online at http://www.sage-au.org.au/conf/sage-au2005/speakers.html#fenwickabs -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: Who uses input()? [was Re: question on input]
Nathan Pinno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I use input() all the time. I know many people say it ain't safe, but whose going to use it to crash their own comp? Only an insane person would, This is usage Guido intended it for, not for production apps distributed to world. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Kay Schluehr wrote: Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? Hello Kay, take this into account: Restrictions like commutativity, associative, distributive and flexibility laws don't belong neither to operands nor to operators themselves. Instead these are properties of fields (set of numbers with respect to a certain operation). For a famous example for a somewhat alternative behaviour look at the Octonions (discovered in 1843 by Graves and 1845 by Cayley), which are not associative with respect to addition and/or multiplication. (http://en.wikipedia.org/wiki/Octonions) or the Quarternions, which are non-commutative (http://en.wikipedia.org/wiki/Quaternion) Obviously, it's not correct to say: addition is associative, or, that multiplication is. With the same right, you could say, multiplication is not associative. With the same reasoning, we can show that it's not easy to generalize sorting, commutation, association or distribution mechanisms. Maybe it would be a very fascinating goal to solve your algorithmic approach in such a limited environment like the Quarternions. A solution for this set of numbers, if achieved in a clean, mathematically abstract way, should hold for most other numbers/fields too, natural and real included. I guess that the approach might be this way: - define/describe the fields which shall be handled - define/describe the rules which shall be supported - find methods to reduce sequences of operations to simple binary or unary operations (tokens) - this may introduce brackets and stacking mechanisms - a weighing algorithm might be necessary to distinguish between plain numbers and place holders (variables) - application of the distributivity (as far as possible) might help to find a rather flat representation and a base for reordering according to the weights of the individual sub-expressions Nevertheless, there are lots of commercial programs which do such sort of symbolic mathematics, and which would badly fail when it would come to such awkward fields like Quarternions/Octonions. Bernhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Efficiently Split A List of Tuples
Oooh.. you make my eyes bleed. IMO that proposal is butt ugly (and looks like the C++.NET perversions.) -- http://mail.python.org/mailman/listinfo/python-list
Re: win32ui CreatePrintDialog
On Fri, 15 Jul 2005 18:08:35 -0400, Chris Lambacher [EMAIL PROTECTED] wrote: Hi, This question has come up a few times on the list with no one giving a public answer. How do you use CreatePrintDialog from win32ui? About a year ago someone posted that: dlg = win32ui.CreatePrintDialog(1538) dlg.DoModal() will give you the window, but the ok button does not work. Here is what I did to make it work: code import win32ui from pywin.mfc import window, dialog class WindowsPrintDialog(window.Wnd): # Numbers for various items in the dialog PROPERTIES_BTN = 1025 PRINTER_NAME= 1139 PRINT_TO_FILE = 1040 PRINT_ALL = 1056 PRINT_PAGES = 1058 PRINT_SELECTION = 1057 FIRST_PAGE = 1152 LAST_PAGE = 1153 FROM_TEXT = 1089 TO_TEXT = 1090 NB_COPIES = 1154 def __init__(self): dlg = = win32ui.CreatePrintDialog(1538) window.Wnd.__init__(self, printDlg) def OnInitDialog(self): ## Initialize dialog itself self._obj_.OnInitDialog() ## Activate all widgets for i in (WindowsPrintDialog.PRINT_ALL, WindowsPrintDialog.PRINT_PAGES, WindowsPrintDialog.FIRST_PAGE, WindowsPrintDialog.LAST_PAGE, WindowsPrintDialog.FROM_TEXT, WindowsPrintDialog.TO_TEXT, WindowsPrintDialog.PRINT_SELECTION): itm = self._obj_.GetDlgItem(i) itm.EnableWindow() ## Disable Properties button: it doesn't work... itm = self._obj_.GetDlgItem(WindowsPrintDialog.PROPERTIES_BTN) itm.EnableWindow(0) def OnOK(self): ## Call on dialog itself self._obj_.OnOK() self._obj_.UpdateData(1) ## Now you can get values entered in dialog via: ## - self.IsDlgButtonChecked(id) pour check-buttons ## - self.GetDlgItemText(id) for textual fields ## - self.GetDlgItemInt(id) for integer fields ## Then use these info. to create your printer DC; for example: printerName = self.GetDlgItemText(WindowsPrintDialog.PRINTER_NAME) dc = win32ui.CreateDC() dc.CreatePrinterDC(printerName) ## And so on... /code Note that the printer properties button is explicitely disabled. If it's not, it seems to be working (it actually opens the printer properties dialog and all options can be modified without any error), but actually doesn't change a thing: the printing will be done with the printer default settings. If anybody has any idea on how this thing works, please let me know: I'm very interested. Diging into the source shows that the 1538 is being loaded as a template resource. The MSDN documentation does not say anything about this being neccessary and in fact, other common dialogs provide this as an option, but not a requirement. Why is this made a requirement? If it was not made a requirement, would the dialog work? I guess it would just be a matter of giving the default value 1538 to the idRes parameter in win32ui.CreatePrintDialog; AFAICT, this is always the id for the default print dialog. Can't figure out why it was not done in the first place... Unfortunately I can't play with this because I don't have Visual Studio. I guess the logical next step, if the above worked, would be to add the GetPrinterDC() method (and maybe some others) so that we can do something useful with the dialog. Yep. See above. Thanks, Chris HTH -- python -c print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-']) -- http://mail.python.org/mailman/listinfo/python-list
Java RMI-like services in Python
Hi, I am wondering if Python has services or frameworks that does the same as Java RMI? What I am seeking is to do pseudo-clustering. That is, a server will contains a program to control what is needed for execution. This will be pretty much like process management. Call this controller, HeadControl.py. What HeadControl.py can do is to expose a SOAP interface. Each client machine will have Executor.py. So when Executor.py is executed, it will connect to HeadControl through SOAP. HeadControl will then spawn a thread to represent the connection. Now, this part is possible in Java, but I am not sure if it is possible in Python. Executor will find out from HeadControl what it can do and downloads the corresponding objects and data from HeadControl and executes it and sends results back to HeadControl. 2 scenarios that this might work. Firstly, Executor can be part of a client program. In this case, temporary files may be written to the client's HDD. Of course, due to security, this method may not be desirable. Secondly, Executor may be made into a web applet kinda thing. In this case, writing to HDD may be impossible. I know something like this had been achieved in Java (http://www-128.ibm.com/developerworks/java/library/j-super.html) but wondering if it is possible in Python. Is so, how? Thanks. Cheers Maurice -- http://mail.python.org/mailman/listinfo/python-list
Re: Django - Rails killer comes...
Rails Killer is a rather high and mighty claim, and as such, it isn't unreasonable to ask for substantial evidence to back it up. Quoting directly from the web site, in the section Meet Django ...Django is well-suited for developing content-management system ... To me, this seems like it places itself in competition with Zope, not Rails. If I'm wrong, could somebody explain why this is a Rails Killer? Thanks, Flab On Sat, 16 Jul 2005 03:26:07 +0200, JZ wrote: http://www.djangoproject.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
hello, I follow somes projects that have a pythonic way to make web site. there's thats projects : http://www.cherrypy.org/ and http://subway.python-hosting.com/ subway aim to be like ruby on rails frameworks , simple and fast developpment. It uses cherrypy and other project like : * http://www.cheetahtemplate.org/ * http://www.formencode.org/ * http://www.sqlobject.org/ -- http://mail.python.org/mailman/listinfo/python-list
Returned mail: Data format error
Dear user of python.org, administration of python.org would like to let you know the following. Your account has been used to send a large amount of junk e-mail messages during the last week. We suspect that your computer was infected by a recent virus and now contains a trojaned proxy server. Please follow instructions in order to keep your computer safe. Have a nice day, The python.org team. -- http://mail.python.org/mailman/listinfo/python-list
Re: Efficiently Split A List of Tuples
[Ron Adam] Currently we can implicitly unpack a tuple or list by using an assignment. How is that any different than passing arguments to a function? Does it use a different mechanism? It is the same mechanism, so it is also only appropriate for low volumes of data: a, b, c = *args # three elements, no problem f(*xrange(100)) # too much data, not scalable, bad idea Whenever you get the urge to write something like the latter, then take it as cue to be passing iterators instead of unpacking giant tuples. Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Admin enlightened us with: Error 404 while looking up your page AND when looking for a suitable 404 page. Sorry! No such file /var/www/www.unrealtower.org/compiled/error404.py You must have caught me editing some stuff, try again ;-) I really need to create another virtual host for when I want to experiment with my scripts and stuff :D Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? Frank Zappa -- http://mail.python.org/mailman/listinfo/python-list
Re: Environment Variable
[Vivek Chaudhary] Is it possible to set an environment variable in python script whose value is retained even after the script exits. There is an indirect approach: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/159462 Raymond -- http://mail.python.org/mailman/listinfo/python-list
Dose someone have installed python on IRIX ?
Hi, everyone, I'm a newbie in python. Does someone have experience about how to install python on IRIX ? I have tried several times but without success. ./configure and make are both ok, but got errors when I run make test. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Java RMI-like services in Python
Maurice LING [EMAIL PROTECTED] wrote in news:dbfmbq$e49$1 @domitilla.aioe.org: I am wondering if Python has services or frameworks that does the same as Java RMI? google for pyro Harald -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
I have to admit that I don't understand what you mean with the 'constant parts' of an expression? From what I percieved of your example it seemed to me that you wanted to evaluate the constants like 7*9 first, so that an expression like a * 7 * 9 * b with variables a,b is evaluated like this: a * 63 * b So my suggestion was simply to make the *-operator more precedent when in between two constants. What I mean with constants here are of course integer/float literals. The concept of a differing operator precedence can be extended to arbitray elements when their types are known - which should be possible when variable values are known at parsing time. The associativity of __mul__ is trivially fullfilled for the dummy class M if an additional __eq__ method is defined by comparing factor lists because those lists are always flat: I don't care about that, as my approach deosn't use python's built-in parser - it can't, as that wouldn't allow to re-define operator precedence. What you do is to simply collect the factors as list. But what you need (IMHO) is a parsing tree (AST) that reflects your desired behaviour by introducing a different precedence thus that the expression a * 7 *9 * b is not evaluated like ((a*7)*9)*b (which is a tree, and the standard way of evaluationg due to built-in parsers precedence rules) but as a*(7*9)*b which is also a tree. The sorting ( or better 'grouping' which can be represented by sorting in a special way ) of factors in question is really a matter of (non-)commutativity. For more advanced expressions also group properties are important: No, IMHO associativity is the important thing here - if (a * 7) * 9 yields a different solution than a *(7*9) your reordering can't be done - in the same way as re-arranging factors a*b to b*a only works if the commute - or, to put in in algebraic terms, the group is abelian. If a,b are in a center of a group G ( i.e. they commute with any element of G ) and G supplies an __add__ ( besides a __mul__ and is therefore a ring ) also a+b is in the center of G and (a+b)*c = c*(a+b) holds for any c in G. It would be nice ( and much more efficient ) not to force expansion of the product assuming distributivity of __add__ and __mul__ and factorization after the transposition of the single factors but recognizing immediately that a+b is in the center of G because the center is a subgroup of G. Well, you don't need to expand that product - the subexpression a+b is evaluated first. If you can sort of cache that evaluation's result because the expressions involved are of a constant nature, you can do so. The rason (a+b) is evaluated first (at least in the standard python parser, and in my proposed special parser) is that the parentheses ensure that. To sum things up a little: I propose not using the python built-in parser which results in you having to overload operators and lose control of precedence, but by introducing your own parser, that can do the trick of re-arranging the operators based on not only the usual precedence (* binds stronger than +), but by a type-based parser that can even change precedence of the same operator between different argument types is's applied to. That might sound complicated, but I think the grammar I gave in my last post shows the concept pretty well. regards, Diez -- http://mail.python.org/mailman/listinfo/python-list
Problem with threads
Hi all, I've got a problem with stopping python-threads. I'm starting a thread with twisteds reactor.deferToThread which start a methodcall in a seperate thread. In this thread a swig-wrapped c++ module is running. Now I want to stop the running thread from the main thread or another one, and have no idea how to do it. I hope it has become clear what I want to do, if not feel free to ask. I'm running python 2.4 Thanks in advance, Stephan -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with threads
You cannot really do that*. Use a flag or something that the thread checks if it should shut down. /Simon * well actually you can, sort of by using int PyThreadState_SetAsyncExc( long id, PyObject *exc) from C API. However, if you do that you swap one problem for a sh*tload of others, because of the *async* part. -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Hello, I never used a web framework using Python modules, but I think cheetah, Karrigel and CherryPy are not good since they allow user to play with the HTML code. IMO, it's not pythonic but phpythonic. Isn't there a python framework inspirated by the Smalltalk framework Seaside? I think it's the way to build a web site like an application and not like an HTML page. CyrilOn 18 Jul 2005 00:52:40 -0700, laurent [EMAIL PROTECTED] wrote: hello,I follow somes projects that have a pythonic way to make web site.there's thats projects : http://www.cherrypy.org/and http://subway.python-hosting.com/subway aim to be like ruby on rails frameworks , simple and fastdeveloppment. It uses cherrypy and other project like : * http://www.cheetahtemplate.org/ * http://www.formencode.org/ * http://www.sqlobject.org/-- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Kay Schluehr wrote: Ron Adam wrote: Kay Schluehr wrote: On a more general note, I think a constrained sort algorithm is a good idea and may have more general uses as well. Something I was thinking of is a sort where instead of giving a function, you give it a sort key list. Then you can possibly sort anything in any arbitrary order depending on the key list. sort(alist, [0,1,2,3,4,5,6,7,8,9]) # Sort numbers forward sort(alist, [9,8,7,6,5,4,3,2,1,0]) # Reverse sort sort(alist, [1,3,5,7,9,0,2,4,6,8]) # Odd-Even sort sort(alist, [int,str,float]) # sort types Seems like you want to establish a total order of elements statically. Don't believe that this is necessary. I want to establish the sort order at the beginning of the sort process instead of using many external compares during the sort process. Using a preprocessed sort key seems like the best way to do that. How it's generated doesn't really matter. And of course a set of standard defaults could be built in. These are just suggestions, I haven't worked out the details. It could probably be done currently with pythons built in sort by writing a custom compare function that takes a key list. Exactly. The advantage of doing it as above would be the sort could be done entirely in C and not need to call a python compare function on each item. It would be interesting to see if and how much faster it would be. I'm just not sure how to do it yet as it's a little more complicated than using integer values. How fine grained the key list is is also something that would need to be worked out. Could it handle words and whole numbers instead of letters and digits? How does one specify which? What about complex objects? In order to handle complex objects one needs more algebra ;) Since the class M only provides one operation I made the problem as simple as possible ( complex expressions do not exist in M because __mul__ is associative - this is already a reduction rule ). Kay I'm played around with your example a little bit and think I see how it should work... (partly guessing) You did some last minute editing so M and Expr were intermixed. It looks to me that what you need to do is have the expressions stored as nested lists and those can be self sorting. That can be done when init is called I think, and after any operation. You should be able to add addition without too much trouble too. a*b - factors [a],[b] - [a,b] You got this part. c+d - sums [c],[d] - [c,d]Need a sums type for this. Then... a*b+c*d - sums of factors - [[a,b],[c,d]] This would be sorted from inner to outer. (a+b)*(b+c) - factors of sums - [[a,b],[c,d]] Maybe you can sub class list to create the different types? Each list needs to be associated to an operation. The sort from inner to outer still works. Even though the lists represent different operations. You can sort division and minus if you turn them into sums and factors first. 1-2 - sums [1,-2] 3/4 - factors [3,1/4] ? hmmm... I don't like that. Or that might be... 3/4 - factor [3], divisor [4] - [3,[4]] So you need a divisor type as a subtype of factor. (I think) You can then combine the divisors within factors and sort from inner to outer. (a/b)*(c/e) - [a,[b],c,[e]] - [a,c,[b,e]] Displaying these might take a little more work. The above could get represented as... (a*c)/(b*e) Which I think is what you want it to do. Just a few thoughts. ;-) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list
wxPython Menu problem
Hi all, I have a problem. I want to add items to a Menu iteratively and I'm stuck. Heres a snippet of my code fileMenuChoices=[('New','Start a New Document',self.onClick), ('Open File...','Open an Existing Document', self.onClick), ('Save','Save Current Document', self.onClick), ('---'), ('Exit','Close Window', self.onClick), ('About','Information', self.onClick)] . . . . fileMenu = wxMenu() for opt in fileMenuChoices: fmID = wxNewId() if(opt[0] != '-'): fileMenu.Append(fmID,opt[0], opt[1]) EVT_MENU(self,fmID,opt[2]) else: fileMenu.AppendSeparator() #Creating the MenuBar menuBar = wxMenuBar() menuBar.Append(fileMenu, File) self.SetMenuBar(menuBar) #Add menubar to the Frame (Window) def onClick(self,e): ... ... The problem is I get an error saying name 'self' not defined... Any help will be appreciated -- http://mail.python.org/mailman/listinfo/python-list
Dictionary, keys and alias
I want to insert a concept of alias in a dict_based class. The idea is to have a facoltative name in the same dict that correspond at the same value. With this alias i can change original value. example: mydict['a'] = 1 I must define an alias example: myFunctAlias( mydict, 'a', 'b') print mydict {'a':1, 'b':1} mydict['b'] = 2 print mydict {'a':2, 'b':2} The only idea i have is to implement two dictionary one for convert name, alias in two keys with the same value (eg.numeric) in the first dict. The second for store only one time the k, v . Any suggestion ? Glauco -- \\\|/// \\ - - // ( @ @ ) +-oOOo-( )-oOOo--+ || | I have a dream that one day this nation will rise up and | | live out the true meaning of its creed: We hold these | | truths to be self-evident:that all men are created equal.| | I have a dream that one day on the red hills of Georgia| | the sons of former slaves and the sons of former | | slaveowners will be able to sit down together at a table | | of brotherhood. | | I have a dream that one day even the state of Mississippi, | | a desert state, sweltering with the heat of injustice| | and oppression, will be transformed into an oasis of | | freedom and justice. | | I have a dream that my four children will one day live in | | a nation where they will not be judged by the color of | | their skin but by the content of their character.| | I have a dream today. | || |Martin Luther King, Jr 28 Ago 1963 | ++ |glauco(at)uriland.it| | www.uriland.it .oooOICQ: 115323690 | +- ( )-- Oooo.-+ \ (( ) \_)) / (_/ -- http://mail.python.org/mailman/listinfo/python-list
email format in python
I want to have the python equivalent function of this (that checks email format) function CheckEmail($Email = ) { if (ereg([[:alnum:[EMAIL PROTECTED]:alnum:]]+\.[[:alnum:]]+, $Email)) { return true; } else { return false; } } ___ Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger Téléchargez cette version sur http://fr.messenger.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
Python s60
Hi, I have looked around for any type of example of script that claims to read the contacts database from an s60 phone, but i cant figure how to use that examples. All i want is a simple, CLEAR, script that show how to open contact database of an s60 phone and load all contacts present into a listbox, nothing else. This will be easy for the experts! please help me! Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list
Re: email format in python
[EMAIL PROTECTED] wrote: I want to have the python equivalent function of this (that checks email format) function CheckEmail($Email = ) { if (ereg([[:alnum:[EMAIL PROTECTED]:alnum:]]+\.[[:alnum:]]+, $Email)) { return true; } else { return false; } } While it is possible to translate the above code into Python (see http://docs.python.org/lib/module-re.html), you should know that the regex above will not validate all possible email addresses. In general it is a fools errand to try to anyway. -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: email format in python
Hello met, I want to have the python equivalent function of this (that checks email format) function CheckEmail($Email = ) { if (ereg([[:alnum:[EMAIL PROTECTED]:alnum:]]+\.[[:alnum:]]+, $Email)) { return true; } else { return false; } } Check out the email library module (see the examples at http://docs.python.org/lib/node589.html) Bye. -- Miki Tebeka [EMAIL PROTECTED] http://tebeka.bizhat.com The only difference between children and adults is the price of the toys pgpYVjP8OOEUV.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: ssh popen stalling on password redirect output?
for ssh automation I would in order: paramiko twisted keys + popen pexpect -- Pádraig Brady - http://www.pixelbeat.org -- -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Admin: I have kept the following: - PyWork - http://pywork.sourceforge.net (Not sure if it's mature) - Django - http://www.djangoproject.com (Looks interesting) - CherryPy - http://www.cherrypy.org (Unsure) I have also found a more comprehensive list here: http://wiki.python.org/moin/WebProgramming But I'd like to know your opinion on what you think is best. . . . I favor speed of development, intensive OO development, performance under heavy load, short learning curve, good documentation and community. I settled on CherryPy: Performance under load -- can't say one way or the other. I do know it's lightweight -- 40kb download, I recall. Good documentation -- yeah, if you are using the mainstream features. It's pretty extensible, too, so there are some secondary functions and features that are not as well documented. I know that the documentation is a major concern of the oommunity, and that they are pretty quick to respond when the docs are unclear. I give CherryPy very high marks for: speed of development, intensive OO development, short learning curve (if you already know Python), and community. And, as I said, for extensibility. I found I had working apps running on my machine with CherryPy in less time than I needed to read the installation docs on some other frameworks. It's just like writing Python, but with one extra object (cpg (2.0) or cherrypy (2.1) and one extra setting (exposed = True). That's it. I'd say give it a try -- you can have it running apps and go through the tutorials in a morning, so why not get first-hand with it? -- http://mail.python.org/mailman/listinfo/python-list
Re: Django - Rails killer comes...
Dnia Mon, 18 Jul 2005 00:52:44 -0700, flab ba napisał(a): To me, this seems like it places itself in competition with Zope, not Rails. No. Zope is an application server, much more powerfull and complicated, with its own object database and total object approach to all elements of the system. Django is similiar to Rails or Subway rather than to Zope. If I'm wrong, could somebody explain why this is a Rails Killer? Maybe Django is not strictly Rails killer (because if someone prefers Ruby to Python, he choose Ruby - and vice-versa) But Django is good alternative to Rails for those who prefer Python. Both use similiar approach, both was created in the same time, both use ORM, MVC etc. -- JZ -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Dnia 18 Jul 2005 00:52:40 -0700, laurent napisał(a): I follow somes projects that have a pythonic way to make web site. there's thats projects : http://www.cherrypy.org/ and http://subway.python-hosting.com/ subway aim to be like ruby on rails frameworks , simple and fast developpment. It uses cherrypy and other project like : * http://www.cheetahtemplate.org/ * http://www.formencode.org/ * http://www.sqlobject.org/ I think Django is more mature than Subway or CherryPy and can quickly become the black horse in area of pythonic frameworks. -- JZ -- http://mail.python.org/mailman/listinfo/python-list
Re: Java RMI-like services in Python
[Maurice LING] I am wondering if Python has services or frameworks that does the same as Java RMI? As Harald mentioned, Pyro is firmly in the Remote Method Invocation space. And there's always CORBA, of which there are multiple python and java implementations. Which might be useful, if you wanted to have a mixed language implementation. Another technology that could be very useful for you is Spread, for which both python and java libraries exist. http://www.zope.org/Members/tim_one/spread/ [Maurice LING] What I am seeking is to do pseudo-clustering. [ .. snip .. ] I know something like this had been achieved in Java (http://www-128.ibm.com/developerworks/java/library/j-super.html) but wondering if it is possible in Python. Is so, how? So, do you want to A: Build your own pseudo-clustering implementation? B: Use one that's already been written? If the answer is the latter, I recommend you take a look at PyLinda. PyLinda - Distributed Computing Made Easy http://www-users.cs.york.ac.uk/~aw/pylinda/ -- alan kennedy -- email alan: http://xhaus.com/contact/alan -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
On 18 Jul 2005, at 10:29, Cyril Bazin wrote: Hello, I never used a web framework using Python modules, but I think cheetah, Karrigel and CherryPy are not good since they allow user to play with the HTML code. IMO, it's not pythonic but phpythonic. Well, pretty much anything would allow that, it is more a matter of how much they encourage it ;) I find the cherrypy + HTML Template combination pretty resistant to excessive HTML in the Python, or Python in the HTML. One day when I get some time I'll have a look at Django, though I must say the templating language looked less nice than the rest of it on first glance, it says you don't have to use it though... Michael -- http://mail.python.org/mailman/listinfo/python-list
goto
hi, what is the equivalent of C languages' goto statement in python? best regards -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Dnia 18 Jul 2005 04:24:12 -0700, paron napisał(a): I favor speed of development, intensive OO development, performance under heavy load, short learning curve, good documentation and community. I settled on CherryPy: Performance under load -- can't say one way or the other. I do know it's lightweight -- 40kb download, I recall. I do not know how new CherryPy 2.1 (which now can use wsgi) is fast and stable but earler versions were quite unstable under heavy loads. Its paradigm creating web site like standalone appl (inherited from Cherry1) is not good suited to more complicated internet applications. Much more stable and much faster is e.g. Mygty (http://myghty.org) It is about 2x faster then CherryPy. Also faster than CherryPy is Webware and SkunkWeb. I did not check how fast is Django... It is fresh framework for open source community. -- JZ -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
Hayri ERDENER wrote: hi, what is the equivalent of C languages' goto statement in python? best regards You really shouldn't use goto. Fortunately you can't. Mage -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
On 7/18/05, Hayri ERDENER [EMAIL PROTECTED] wrote: hi, what is the equivalent of C languages' goto statement in python? best regards http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/832906c6122dc137 Let's not go through *that* again... -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Building Python with Tcl/Tk on Cygwin_NT-5.1
Dean, On Tue, Feb 08, 2005 at 12:55:15PM -0500, Jason Tishler wrote: On Tue, Feb 08, 2005 at 08:01:11AM -0800, Dean N. Williams wrote: $ rebaseall /usr/bin/rebaseall: line 70: [: too many arguments /usr/bin/rebaseall: line 75: [: too many arguments /usr/bin/rebaseall: line 94: $TmpFile: ambiguous redirect cannot read /cygdrive/c/Documents On my laptop installation everything works just fine. What is the difference? The TMP and/or TEMP environment variables have at least two spaces in them. The easiest workaround is to execute rebaseall like the following: $ TMP=/tmp rebaseall Long term I will change rebaseall to deal better with spaces in shell variables. The above rebaseall problem has been fixed: http://cygwin.com/ml/cygwin-announce/2005-07/msg00031.html Jason -- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6 -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
On Mon, 18 Jul 2005 08:45:22 -0300, JZ [EMAIL PROTECTED] wrote: Much more stable and much faster is e.g. Mygty (http://myghty.org) It is about 2x faster then CherryPy. Also faster than CherryPy is Webware and SkunkWeb. I did not check how fast is Django... It is fresh framework for open source community. Mmmh... I really don't know which one is better :( -- Thanks, Admin. Want to buy me a book? http://tinyurl.com/78xzb :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Efficiently Split A List of Tuples
On Sun, 17 Jul 2005 19:38:29 -0700, Raymond Hettinger wrote: Executive summary: Python's for-loops are both elegant and fast. It is a mistake to habitually avoid them. And frequently much more readable and maintainable than the alternatives. I cringe when I see well-meaning people trying to turn Python into Perl, by changing perfectly good, fast, readable pieces of code into obfuscated one-liners simply out of some perverse desire to optimize for the sake of optimization. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Dnia Mon, 18 Jul 2005 09:26:10 -0300, Admin napisał(a): On Mon, 18 Jul 2005 08:45:22 -0300, JZ [EMAIL PROTECTED] wrote: Much more stable and much faster is e.g. Mygty (http://myghty.org) It is about 2x faster then CherryPy. Also faster than CherryPy is Webware and SkunkWeb. I did not check how fast is Django... It is fresh framework for open source community. Mmmh... I really don't know which one is better :( Django has similar aproach to Rails or Subway. Myghty is similar to Perl::Mason. I think those two are the most matured and powerfull. (I do not mean Zope and Plone which is specific to its own category) -- JZ -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
On Mon, 18 Jul 2005 14:06:14 +0200, Mage wrote: Hayri ERDENER wrote: hi, what is the equivalent of C languages' goto statement in python? best regards You really shouldn't use goto. Fortunately you can't. Of course you can :-) You can write your own Python interpreter, in Python, and add a goto to it. You can use while or for loops, which are like goto, only they have all the advantages and none of the disadvantages. The same goes for continue and break, and try...except blocks: they are safe, tame gotos, not wild, dangerous ones that are out of control. You can call functions. Functions are implemented at the machine code level with the assembly language equivalent of a goto. Or you can tell us what problem you want to solve with a goto, and we'll tell you the proper way to solve it. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: Building Python with Tcl/Tk on Cygwin_NT-5.1
Dear Jason, Thanks for fixing this problem. I'm sure all the CDAT/Cygwin users really appreciate it. I'll put the update on the CDAT web portal. Best regards, Dean Dean, On Tue, Feb 08, 2005 at 12:55:15PM -0500, Jason Tishler wrote: On Tue, Feb 08, 2005 at 08:01:11AM -0800, Dean N. Williams wrote: $ rebaseall /usr/bin/rebaseall: line 70: [: too many arguments /usr/bin/rebaseall: line 75: [: too many arguments /usr/bin/rebaseall: line 94: $TmpFile: ambiguous redirect cannot read /cygdrive/c/Documents On my laptop installation everything works just fine. What is the difference? The TMP and/or TEMP environment variables have at least two spaces in them. The easiest workaround is to execute rebaseall like the following: $ TMP=/tmp rebaseall Long term I will change rebaseall to deal better with spaces in shell variables. The above rebaseall problem has been fixed: http://cygwin.com/ml/cygwin-announce/2005-07/msg00031.html Jason -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
Mage [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hayri ERDENER wrote: hi, what is the equivalent of C languages' goto statement in python? best regards You really shouldn't use goto. True. Fortunately you can't. Of course you can. Recent versions of Python have the ability to change where an element on the call stack will return to. Don't ask me to debug such a program unless you really want my unvarnished opinion of such stupidity. John Roth Mage -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem with threads
Stephan Popp wrote: I've got a problem with stopping python-threads. I'm starting a thread with twisteds reactor.deferToThread which start a methodcall in a seperate thread. In this thread a swig-wrapped c++ module is running. Now I want to stop the running thread from the main thread or another one, and have no idea how to do it. If this external call into the C++ module is long running, and doesn't itself provide a way to terminate before it's done, you can't do what you want unless you use a separate process entirely. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
what is the equivalent of C languages' goto statement in python? You really shouldn't use goto. Fortunately you can't. Steven Of course you can :-) Steven You can write your own Python interpreter, in Python, and add a Steven goto to it. Maybe easier would be to write a Python assembler (there's probably already one out there) and just write to Python's virtual machine... Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Dictionary, keys and alias
Glauco wrote: I want to insert a concept of alias in a dict_based class. ... Any suggestion ? Yes, in future don't attempt to start a new thread using Reply unless you are happy not having your post read by all those who have already killed the thread to which you replied. Anyone who was not interested in the Python Programming Contest thread is unlikely to have seen your question. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Dictionary, keys and alias
On Mon, 18 Jul 2005 12:17:37 +0200, Glauco wrote: I want to insert a concept of alias in a dict_based class. The idea is to have a facoltative name in the same dict that correspond at the same value. With this alias i can change original value. example: mydict['a'] = 1 I must define an alias example: myFunctAlias( mydict, 'a', 'b') print mydict {'a':1, 'b':1} mydict['b'] = 2 print mydict {'a':2, 'b':2} The only idea i have is to implement two dictionary one for convert name, alias in two keys with the same value (eg.numeric) in the first dict. The second for store only one time the k, v . You need some sort of redirection, something like this (untested): class Doubledict: def __init__(self, **kargs): self.data = {} self.aliases = {} for key in kargs: # Point the key to a hash. self.aliases[key] = hash(key) # And point the hash at the value. self.data[hash(key)] = kargs[key] def setalias(self, key, alias): # Point the alias to the same hash as the real key. self.aliases[alias] = hash(key) def __getitem__(self, key): return self.data[self.aliases[key]] def __setitem__(self, key, value): self.data[self.aliases[key]] = value The only niggly worry I have is I'm not sure when hash can be used, when it is unique, or even if is it guaranteed to be unique. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
In python there is no goto statement. In C I use goto only in one case: to exit more then one level of blocks (as a matter of fact, I always use goto EXIT in C, where EXIT is the label of the end of the function). In python you can mimic this by throwing an exception and catching it. Exception should know the destination label name and the catch statement should compare this name with its (catch statement) name. Hayri ERDENER [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hi, what is the equivalent of C languages' goto statement in python? best regards -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
JZ wrote: I think Django is more mature than Subway or CherryPy and can quickly become the black horse in area of pythonic frameworks. I'm not familiar with this expression. What do you mean by black horse? -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Bernhard Holzmayer schrieb: Kay Schluehr wrote: Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? Hello Kay, take this into account: Restrictions like commutativity, associative, distributive and flexibility laws don't belong neither to operands nor to operators themselves. Instead these are properties of fields (set of numbers with respect to a certain operation). For a famous example for a somewhat alternative behaviour look at the Octonions (discovered in 1843 by Graves and 1845 by Cayley), which are not associative with respect to addition and/or multiplication. (http://en.wikipedia.org/wiki/Octonions) or the Quarternions, which are non-commutative (http://en.wikipedia.org/wiki/Quaternion) Obviously, it's not correct to say: addition is associative, or, that multiplication is. With the same right, you could say, multiplication is not associative. It was associative in the tiny example I presented. I did not mentioned to discuss the evolving structure of the whole CAS here in detail which would be better done in an own newsgroup once an early version is released. Maybe the setting of the original question should be made more precise: associative, non-commutative multiplicative groups. Handling non-associative algebras like Lie algebras is a completely different matter and I'm not even sure which one is the best way to represent operations in Python? Maye this way? lie = Lie() # create an arbitrary Lie algebra (lie is again a class ) A,B = lie(),lie() # create two arbitrary elements of the Lie algebra lie[A,B] # create the commutator of the lie algebra by overloading lie[A,B] # the __getitem__ method lie[A,B] == -lie[-A,B] True If one wants to enforce assertions like lie[r*A,B] == r*lie[A,B] True for certain elements r of some group acting on lie, one must refine creation of lie in the initial assignment statement e.g. lie = Lie(V) where V is some vectorspace and the elements of lie are homomorphisms on V. V is created elsewhere. There are a lot of constraints induced by all the objects dynamically coupled together. With the same reasoning, we can show that it's not easy to generalize sorting, commutation, association or distribution mechanisms. Maybe it would be a very fascinating goal to solve your algorithmic approach in such a limited environment like the Quarternions. No CAS can represent infinitely many different representations of quaternions. But it should not be to hard to deal with an algebra that represents admissable operations on quaternions in an abstract fashion. A solution for this set of numbers, if achieved in a clean, mathematically abstract way, should hold for most other numbers/fields too, natural and real included. I guess that the approach might be this way: - define/describe the fields which shall be handled - define/describe the rules which shall be supported - find methods to reduce sequences of operations to simple binary or unary operations (tokens) - this may introduce brackets and stacking mechanisms - a weighing algorithm might be necessary to distinguish between plain numbers and place holders (variables) - application of the distributivity (as far as possible) might help to find a rather flat representation and a base for reordering according to the weights of the individual sub-expressions Nevertheless, there are lots of commercial programs which do such sort of symbolic mathematics, and which would badly fail when it would come to such awkward fields like Quarternions/Octonions. If you take a look on Mathematica or Maple both programs seem to interpret pure symbols as members of an associative and commutative algebra: expand( (a+x)^2) - a^2 + 2ax + x^2 This works very fast and accurate but is mathematically too restricted for me. For doing more advanced stuff one needs to do a lot of programming in either language shipped with the CAS for creating new packages. But then I ask myself: why not doing the programming labor in Python and redesign and optimize the core modules of the CAS if necessary? Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
Hayri ERDENER wrote: what is the equivalent of C languages' goto statement in python? Steven offered the best reply here, in that he wondered what you actually need this for. What usage of goto in C are you hoping to emulate? It's a certainty that some other non-goto technique will be more appropriate in Python. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
On Mon, 18 Jul 2005 10:06:21 -0300, Peter Hansen [EMAIL PROTECTED] wrote: I'm not familiar with this expression. What do you mean by black horse? That will help me too :) -- Thanks, Admin. Want to buy me a book? http://tinyurl.com/78xzb :) -- http://mail.python.org/mailman/listinfo/python-list
Re: stdin/stdout fileno() always returning -1 from windows service
On Sun, Jul 17, 2005 at 06:43:00PM -0700, chuck wrote: I have found that sys.stdin.fileno() and sys.stdout.fileno() always return -1 when executed from within a win32 service written using the win32 extensions for Python. Anyone have experience with this or know why? because there *is* no standard I/O for a windows service. You should be able to execute code like import sys sys.stdout = sys.stderr = open(some.log, w) if you have code that expects the standard output files to be available. You could also open sys.stdin in a similar way. Jeff pgpMaSZazXzRr.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
On Mon, Jul 18, 2005 at 09:06:21AM -0400, Peter Hansen wrote: JZ wrote: I think Django is more mature than Subway or CherryPy and can quickly become the black horse in area of pythonic frameworks. I'm not familiar with this expression. What do you mean by black horse? Maybe the Ferrari of pythonic frameworks (black horse on yellow background being the symbol of Ferrari). That's what I thought of first when I tried to parse the sentence ;-) -- Gerhard -- Gerhard Häring - [EMAIL PROTECTED] - Python, web database development signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list
Re: win32ui CreatePrintDialog
On Mon, Jul 18, 2005 at 09:18:45AM +0200, Eric Brunel wrote: On Fri, 15 Jul 2005 18:08:35 -0400, Chris Lambacher [EMAIL PROTECTED] wrote: Hi, This question has come up a few times on the list with no one giving a public answer. How do you use CreatePrintDialog from win32ui? About a year ago someone posted that: dlg = win32ui.CreatePrintDialog(1538) dlg.DoModal() will give you the window, but the ok button does not work. Here is what I did to make it work: code import win32ui from pywin.mfc import window, dialog class WindowsPrintDialog(window.Wnd): # Numbers for various items in the dialog PROPERTIES_BTN = 1025 PRINTER_NAME= 1139 PRINT_TO_FILE = 1040 PRINT_ALL = 1056 PRINT_PAGES = 1058 PRINT_SELECTION = 1057 FIRST_PAGE = 1152 LAST_PAGE = 1153 FROM_TEXT = 1089 TO_TEXT = 1090 NB_COPIES = 1154 def __init__(self): dlg = = win32ui.CreatePrintDialog(1538) window.Wnd.__init__(self, printDlg) def OnInitDialog(self): ## Initialize dialog itself self._obj_.OnInitDialog() ## Activate all widgets for i in (WindowsPrintDialog.PRINT_ALL, WindowsPrintDialog.PRINT_PAGES, WindowsPrintDialog.FIRST_PAGE, WindowsPrintDialog.LAST_PAGE, WindowsPrintDialog.FROM_TEXT, WindowsPrintDialog.TO_TEXT, WindowsPrintDialog.PRINT_SELECTION): itm = self._obj_.GetDlgItem(i) itm.EnableWindow() ## Disable Properties button: it doesn't work... itm = self._obj_.GetDlgItem(WindowsPrintDialog.PROPERTIES_BTN) itm.EnableWindow(0) def OnOK(self): ## Call on dialog itself self._obj_.OnOK() self._obj_.UpdateData(1) ## Now you can get values entered in dialog via: ## - self.IsDlgButtonChecked(id) pour check-buttons ## - self.GetDlgItemText(id) for textual fields ## - self.GetDlgItemInt(id) for integer fields ## Then use these info. to create your printer DC; for example: printerName = self.GetDlgItemText(WindowsPrintDialog.PRINTER_NAME) dc = win32ui.CreateDC() dc.CreatePrinterDC(printerName) ## And so on... /code Note that the printer properties button is explicitely disabled. If it's not, it seems to be working (it actually opens the printer properties dialog and all options can be modified without any error), but actually doesn't change a thing: the printing will be done with the printer default settings. If anybody has any idea on how this thing works, please let me know: I'm very interested. In the MFC documentation, CPrintDialog has a GetPrinterDC method. This method AFAICT gives you a printer device contex which has all the settings set for you. Diging into the source shows that the 1538 is being loaded as a template resource. The MSDN documentation does not say anything about this being neccessary and in fact, other common dialogs provide this as an option, but not a requirement. Why is this made a requirement? If it was not made a requirement, would the dialog work? I guess it would just be a matter of giving the default value 1538 to the idRes parameter in win32ui.CreatePrintDialog; AFAICT, this is always the id for the default print dialog. Can't figure out why it was not done in the first place... The problem is that 1538 is loaded as a template resource. I get exactly the same result from many resources all the way up to 2 (I tried them in a loop). I suspect that this number just works because it is an ever present resource id, and does not actually do anything to help us. When used in conjuntion with the rest of the MFC printing framework, the dialog seems to work, but this does not help me because the rest of my application is in PyGTK, I would rather limit my MFC programming to the bare minimum. If I could get the PrintDlg function to work, I would use that instead. Unfortunately I can't figure out how to make that work either. I may just have to pull out MinGW and compile a module that uses the PrintDlg function. Unfortunately I can't play with this because I don't have Visual Studio. I guess the logical next step, if the above worked, would be to add the GetPrinterDC() method (and maybe some others) so that we can do something useful with the dialog. Yep. See above. Thanks, Chris HTH -- python -c print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17;8(%,5.Z65\'*9--56l7+-']) -- http://mail.python.org/mailman/listinfo/python-list - End forwarded message - -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Dnia Mon, 18 Jul 2005 09:06:21 -0400, Peter Hansen napisał(a): I think Django is more mature than Subway or CherryPy and can quickly become the black horse in area of pythonic frameworks. I'm not familiar with this expression. What do you mean by black horse? I meant dark horse. Sorry for confusion. :) -- JZ -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Gerhard Haering wrote: On Mon, Jul 18, 2005 at 09:06:21AM -0400, Peter Hansen wrote: I'm not familiar with this expression. What do you mean by black horse? Maybe the Ferrari of pythonic frameworks (black horse on yellow background being the symbol of Ferrari). I know there are black sheep in some families, and dark horse candidates. Also yellow-bellied sapsuckers. There's a black horse fish in the Mississippi valley (also, quite coincidentally, of the sucker family). Not entirely sure that was the intended connotation. :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list
Python ldap pointers for a newbie - Actually just trying to decifer the error..
Hi all, I have a script which appears to work but it errors and the following output is given. My code is listed below.. Traceback (most recent call last): File ./ldap-nsc2.py, line 96, in ? truc.search() File ./ldap-nsc2.py, line 49, in search (result_type, result_data) = cnx.result(ldap_result_id, 0) File /usr/local/lib/python2.4/site-packages/ldap/ldapobject.py, line 406, in result res_type,res_data,res_msgid = self.result2(msgid,all,timeout) File /usr/local/lib/python2.4/site-packages/ldap/ldapobject.py, line 410, in result2 res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout) File /usr/local/lib/python2.4/site-packages/ldap/ldapobject.py, line 416, in result3 rtype, rdata, rmsgid, serverctrls = self._ldap_call(self._l.result3,msgid,all,timeout) File /usr/local/lib/python2.4/site-packages/ldap/ldapobject.py, line 94, in _ldap_call result = func(*args,**kwargs) TypeError: an integer is required So I dig into the docs at /usr/local/lib/python2.4/site-packages/ldap/ldapobject.py to see what the problem is.. snip def result(self,msgid=ldap.RES_ANY,all=1,timeout=None): result([msgid=RES_ANY [,all=1 [,timeout=None]]]) - (result_type, result_data) . . . snip So.. That's what I have in my code.. result_type, result_data = cnx.result(ldap_result_id, 0) Can Someone please point me in the right direction. I want to know WHY it's failing. I think it's right? Anyone? My Code... import ldap class NSCLdap(object): def __init__(self, server=sc-ldap.nsc.com, baseDN=o=nsc.com, who=None, cred=None): self.server = server self.baseDN = baseDN if who is None: self.who = else: self.who = who if cred is None: self.cred = else: self.cred = cred self.connection = None def connect(self): print LDAP Version, ldap.__version__ self.connection = ldap.open(self.server) self.connection.simple_bind_s( self.who, self.cred) self.connection.protocol_version=ldap.VERSION3 def search(self, baseDN=None, searchScope=ldap.SCOPE_SUBTREE, retrieveAttrs=None, searchAttrs=l=ny5* ): cnx = self.connection if baseDN is None: baseDN = self.baseDN try: ldap_result_id = cnx.search_s(baseDN, searchScope, searchAttrs, retrieveAttrs) while 1: result_type, result_data = cnx.result(ldap_result_id, 0) if (result_data == []): break else: if result_type == ldap.RES_SEARCH_ENTRY: result_set.append(result_data) if len(result_set) == 0: print No Results. return for i in range(len(result_set)): for entry in result_set[i]: try: name = entry[0][i]['cn'] email = entry[0][i]['mail'] phone = entry[0][i]['telephonenumber'] loc = entry[0][i]['l'] count = count + 1 print %d.\nName: %s\nDescription: %s\nE-mail: %s\nPhone: %s\n %\ (count, name, desc, email, phone) except: pass except ldap.LDAPError, error_message: print error_message if __name__ == '__main__': truc = NSCLdap() truc.connect() truc.search() -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Menu problem
try to check your definition of your function, self is usually used inside a class. pujo -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
[EMAIL PROTECTED] wrote: what is the equivalent of C languages' goto statement in python? You really shouldn't use goto. Fortunately you can't. Steven Of course you can :-) Steven You can write your own Python interpreter, in Python, and add a Steven goto to it. Maybe easier would be to write a Python assembler (there's probably already one out there) and just write to Python's virtual machine... Even easier to buy a book about programming. Note that python.org is second in google if you search programming. So we need a little more work. Mage -- http://mail.python.org/mailman/listinfo/python-list
os.path.expanduser on Windows: UnicodeEncodeError
My application is getting this error on Windows XP (works fine on Mac OS X) when it calls os.path.expanduser: UnicodeEncodeError: 'ascii' codec can't encode characters in position 52-56: ordinal not in range(128) The code was built with Python 2.3.4. I found referenes to Path 957650, but I'm not familiar with how such fixes are processed. Is there a patch I can add to fix this? How do I know what version of Python it is fixed in - that is, will upgrading to Python 2.3.5 fix this? Thanks for your help, Bob Swerdlow VP Engineering Goombah - Music Discovery [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Ann: Tkinter drag and drop module
On 2005-07-14, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: i remember freezing a python console app i wrote some time ago using the mcmillan installer (kinda like py2exe) and was surprised to discover that binaries dragged and dropped onto the .exe file were handled properly as args...making a kind of no-gui drag and drop... Do you mean you draged a file onto the .exe using the windows explorer? In this case the script just has to read in the first commandline argument, as the Win-Explorer does the dd work and passes the filename of the droped file on to the script. You can test that easily by creating a small .bat file: echo %1 pause -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
I see, you're sensitive for the difficulties which might arise. That's the thing I wanted to point out. Maybe I was looking too far forward... My first thought was to add attributes/qualifiers to the operands to improve the sorting. Then I realized that these attributes/qualifiers were related to the operators, since multiplication and division use the same operands, but while in one case it is associative and commutative, it isn't in the other. I agree that all this leads too far. But one thing creeps into my mind again: I guess you'll always need an inverse operation: A class which can handle multiplication will certainly require an inverse operation like division. Bernhard -- http://mail.python.org/mailman/listinfo/python-list
Re: Dictionary, keys and alias
I think hash doesn't guarantee the unicity of the result. But, it should avoid the collisions... foo = foo hash(foo) -740391237 hash(-740391237) -740391237 I think it's like some kind md5sum... I propose this solution: --- from UserDict import UserDict class DoubleDict(UserDict): def __init__(self, *args): UserDict.__init__(self, *args) self.values = {} #self.aliases = {} def setAlias(self, key, alias): # Point the alias to the same hash as the real key. if key in self: self.data[alias] = self.data[key] else: self[alias] = key def __getitem__(self, key): return self.values[self.data[key]] def __setitem__(self, key, value): self.data.setdefault(key, key) self.values[self.data[key]] = value print Result: d = DoubleDict() d[a] = 1 d[c] = 4 d.setAlias(a, b) print d[a], d[b], d[c] d[a] = 2 print d[a], d[b], d[c] d[b] = 3 d.setAlias(b, c) print d[a], d[b], d[c] del d[c] d[c] = 5 print d[a], d[b], d[c] del d[a] d[a] = 6 print d[a], d[b], d[c] --- Result: 1 1 4 2 2 4 3 3 3 3 3 5 6 6 5 As you can see the last test (del a and reassign a) fail because it reassign b. But, if your application doesn't need to midify the aliases, it's ok (I think). Else you can redefine the method __delitem__. Cyril On 7/18/05, Steven D'Aprano [EMAIL PROTECTED] wrote: On Mon, 18 Jul 2005 12:17:37 +0200, Glauco wrote: I want to insert a concept of alias in a dict_based class. The ideais to have a facoltative name in the same dict that correspond at the same value. With this alias i can change original value. example: mydict['a'] = 1 I must define an aliasexample: myFunctAlias( mydict, 'a', 'b') print mydict {'a':1, 'b':1} mydict['b'] = 2 print mydict {'a':2, 'b':2} The only idea i have is to implement two dictionary one for convert name, alias in two keys with the same value (eg.numeric) in the first dict. The second for store only one time the k, v . You need some sort of redirection, something like this (untested):class Doubledict:def __init__(self, **kargs):self.data = "">self.aliases = {}for key in kargs: # Point the key to a hash.self.aliases[key] = hash(key)# And point the hash at the value.self.data[hash(key)] = kargs[key]def setalias(self, key, alias): # Point the alias to the same hash as the real key.self.aliases[alias] = hash(key)def __getitem__(self, key):return self.data[self.aliases[key]]def __setitem__(self, key, value): self.data[self.aliases[key]] = valueThe only niggly worry I have is I'm not sure when hash can be used, whenit is unique, or even if is it guaranteed to be unique.--Steven.-- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: stdin/stdout fileno() always returning -1 from windows service
Interesting. The stdin and stdout objects in my service seems respond to returing a string for the statements str(sys.stdin) and str(sys.stdout). I guess they are just not attached to files? Can you provide a reference (MSDN or otherwise) that indicates that Windows Services don't have standard I/O? -- http://mail.python.org/mailman/listinfo/python-list
wxPython date
How do I form a new wxPython date using day, month and year? I've tried the wx.DateTimeFromDMY but it crashes in Pythonwin when I test it out and I get all manner of complaints when I try it from the command line. Surely there's an equivalent to the python datetime.date(2005,07,18) thanks, jason -- http://mail.python.org/mailman/listinfo/python-list
Windows command line problem
I'm sure someone else has posted a similar problem but I can't find it, nor the solution... I have a python script which accepts a command line argument. E.g. python.exe myscript.py -n Foo I build this as part of a package using distutils with the bdist_wininst option on a Windows 2K (SP4) machine. I have tested installing and running it fine on a Windows XP (SP2) machine. I build my package-installer with a Python.org 2.4.1 distribution which is source-compiled locally. I have installed my package-installer on a machine running ActiveState Python 2.4.1 installed from a .msi file. That all works fine. I have problems delivering it to the test team (of course). After some investigation, if I install the package on one of our test machines and butcher my installed file to dump the command line and exit (i.e. print 'hi', sys.argv) then I get the following: hi ['c:\\Python24\\Lib\\site-packages\\MyPackage\\myscript.py', '\x96n, 'Foo'] If I run it specifying --name instead of -n I get: hi ['c:\\Python24\\Lib\\site-packages\\MyPackage\\myscript.py', '\x96-name, 'Foo'] The machine in question is also running XP service pack 2 as far as I know, with Python.org's 2.4.1 distribution. Does anyone know why the first character on the command line (here '-') is getting adjusted (to '\x96') in this way ? Is it a Unicode/encodings kind of a problem ? I can make the problem go away by running with quotes like this: python.exe myscript.py -n Foo I'm hoping I can add an entry to my setup.py. Thanks for any and all help. Mark -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython date
On 18 Jul 2005 07:52:06 -0700, Jason [EMAIL PROTECTED] wrote: How do I form a new wxPython date using day, month and year? I've tried the wx.DateTimeFromDMY but it crashes in Pythonwin when I test it out and I get all manner of complaints when I try it from the command line. Surely there's an equivalent to the python datetime.date(2005,07,18) Are you specifying the date in DMY format? Also, remember that the months are zero based. This works fine on my systems (both OS X and Linux): import wx dt = wx.DateTimeFromDMY(18, 6, 2005) print dt - Mon Jul 18 00:00:00 2005 -- http://mail.python.org/mailman/listinfo/python-list
re.IGNORECASE and re.VERBOSE
I am using regular expressions and I would like to use both re.IGNORECASE and re.VERBOSE options. I want to do something like the following (which doesn't work): matsearch = r'''^\ {0,4}([mM]\d+) ''' MatSearch = re.compile(matsearch, re.VERBOSE, re.IGNORECASE) Does anyone have any suggestions? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list
Re: re.IGNORECASE and re.VERBOSE
On 7/18/05, Jeremy [EMAIL PROTECTED] wrote: I am using regular expressions and I would like to use both re.IGNORECASE and re.VERBOSE options. I want to do something like the following (which doesn't work): matsearch = r'''^\ {0,4}([mM]\d+) ''' MatSearch = re.compile(matsearch, re.VERBOSE, re.IGNORECASE) You need to OR them together: re.compile(matsearch, re.VERBOSE | re.IGNORECASE) -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython date
Thanks, Peter. I must have been having a bit of the stupids, your example worked fine for me too. Back to the salt mines! -- http://mail.python.org/mailman/listinfo/python-list
Re: re.IGNORECASE and re.VERBOSE
On 7/18/05, Jeremy [EMAIL PROTECTED] wrote: I am using regular expressions and I would like to use both re.IGNORECASE and re.VERBOSE options. I want to do something like the following (which doesn't work): matsearch = r'''^\ {0,4}([mM]\d+) ''' MatSearch = re.compile(matsearch, re.VERBOSE, re.IGNORECASE) MatSearch = re.compile(matsearch, re.IGNORECASE + re.VERBOSE) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: re.IGNORECASE and re.VERBOSE
Jeremy wrote: I am using regular expressions and I would like to use both re.IGNORECASE and re.VERBOSE options. I want to do something like the following (which doesn't work): matsearch = r'''^\ {0,4}([mM]\d+) ''' MatSearch = re.compile(matsearch, re.VERBOSE, re.IGNORECASE) Does anyone have any suggestions? These flags are combined using the bit-wise OR operator. re.compile(matsearch, re.VERBOSE|re.IGNORECASE) Reinhold -- http://mail.python.org/mailman/listinfo/python-list
Re: re.IGNORECASE and re.VERBOSE
Simon Brunning wrote: On 7/18/05, Jeremy [EMAIL PROTECTED] wrote: I am using regular expressions and I would like to use both re.IGNORECASE and re.VERBOSE options. I want to do something like the following (which doesn't work): matsearch = r'''^\ {0,4}([mM]\d+) ''' MatSearch = re.compile(matsearch, re.VERBOSE, re.IGNORECASE) MatSearch = re.compile(matsearch, re.IGNORECASE + re.VERBOSE) While this works when you are only combining flags, the general way of handling flags (= bit-fields) is with the three bit-wise operators '^', '' and '|'. Reinhold -- http://mail.python.org/mailman/listinfo/python-list
Re: stdin/stdout fileno() always returning -1 from windows service
It seems to simply be common wisdom. e.g., http://mail.python.org/pipermail/python-win32/2004-September/002332.html http://mail.mems-exchange.org/pipermail/quixote-users/2004-March/002743.html http://twistedmatrix.com/pipermail/twisted-python/2001-December/000644.html etc If you can find chapter and verse on MSDN, more power to you. This page implies that the standard handles are only available when there is a console for the application. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getstdhandle.asp Jeff pgpD1VX32k6bY.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
Hayri ERDENER schrieb: hi, what is the equivalent of C languages' goto statement in python? best regards No, but some of goto's use cases can be covered by unconditional jumps provided by exceptions. Here is a C function using goto: void main() { int i, j; for ( i = 0; i 10; i++ ) { printf( Outer loop executing. i = %d\n, i ); for ( j = 0; j 2; j++ ) { printf( Inner loop executing. j = %d\n, j ); if ( i == 3 ) goto stop; } } /* This message does not print: */ printf( Loop exited. i = %d\n, i ); stop: printf( Jumped to stop. i = %d\n, i ); } And here is a Python equivalent using exception handling: def main(): class stop(Exception):pass try: for i in range(10): print Outer loop executing. i = %d%i for j in range(2): print Inner loop executing. j = %d%j if i == 3: raise stop print Loop exited. i = %d%i # message does not print except stop: print Jumped to stop. i = %d%i Regards, Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Peter Hansen wrote: ''.join(chr(c) for c in range(65, 91)) 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' Wouldn't this be a candidate for making the Python language stricter? Do you remember old Python versions treating l.append(n1,n2) the same way like l.append((n1,n2)). I'm glad this is forbidden now. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
On Mon, Jul 18, 2005 at 08:40:16AM -0700, Kay Schluehr wrote: Hayri ERDENER schrieb: hi, what is the equivalent of C languages' goto statement in python? best regards No, but some of goto's use cases can be covered by unconditional jumps provided by exceptions. [...] I like the named loops concept of other HLL like Ada 95 or Java better than either goto or exceptions. It allows you to use break and continue for other than the innermost loops, too: break; = break out of inner loop break loop_name;= break out of named loop loop_name OTOH it's not used *that* often, so I won't argue for including it in Python ;) -- Gerhard -- Gerhard Häring - [EMAIL PROTECTED] - Python, web database development signature.asc Description: Digital signature -- http://mail.python.org/mailman/listinfo/python-list
Python scripts wont run - HELP
Bye Bye Billy Bob... Hello All, I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python 2.3.4. I can run three or four line scripts from the command line but have not been able to execute a script from a file. I have used EMACS and JEDIT to create small test routines. I would right click the file and set properties to executable. I would then click the icon, the bouncy ball would do its thing then a dialog box would flash on the screen for a fraction of a second. I could tell it had a progress bar on it but could not catch anything else on it. Then nothing else would happen. If I could execute a script the world would once again be my playground... PLEASE HELP. -- LINUX protects me from the GATES of hell !!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Python scripts wont run - HELP
windozbloz wrote: Bye Bye Billy Bob... Hello All, I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python 2.3.4. I can run three or four line scripts from the command line but have not been able to execute a script from a file. I have used EMACS and JEDIT to create small test routines. I would right click the file and set properties to executable. I would then click the icon, the bouncy ball would do its thing then a dialog box would flash on the screen for a fraction of a second. I could tell it had a progress bar on it but could not catch anything else on it. Then nothing else would happen. If I could execute a script the world would once again be my playground... PLEASE HELP. You will need to include #!/usr/bin/python At the top of your script. HTH J -- http://mail.python.org/mailman/listinfo/python-list
Re: Python scripts wont run - HELP
I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python 2.3.4. I can run three or four line scripts from the command line but have not been able to execute a script from a file. I have used EMACS and JEDIT to create small test routines. I would right click the file and set properties to executable. I would then click the icon, the bouncy ball would do its thing then a dialog box would flash on the screen for a fraction of a second. I could tell it had a progress bar on it but could not catch anything else on it. Then nothing else would happen. If I could execute a script the world would once again be my playground... PLEASE HELP. Open a terminal program like konsole. change the directory to where your files are (cd /path/to/files/). execute them (python my-script.py'). -- damjan -- http://mail.python.org/mailman/listinfo/python-list
Re: Image orientation and color information with PIL?
Hi All-- [EMAIL PROTECTED] wrote: Does anyone know if it is possible to determine if an image is horizontal/vertical and color or black white using the python image library? I have been searching this news group and the information was not all clear on this. How are you going to determine the orientation of an image without sophisticated image analysis? I suspect Adobe Photoshop can do it, but I don't know for sure. You'd have to look for things like sky, or clouds, overcast sky, people's faces, and so on and so forth. It'd be cool to have this available in Python, but unless the F-bot is busier than I thought and working behind the scenes using his time machine, it's not there now. If you write it I'll use it;-) Color vs BW ought to be easy, though, by analysing the color table, if there is one, and/or image mode. Check the PIL documentation. If you have only searched the newsgroup then you might have overlooked the docs. Metta, Ivan -- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.com/ http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list
Re: Python scripts wont run - HELP
Damjan wrote: I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python 2.3.4. I can run three or four line scripts from the command line but have not been able to execute a script from a file. I have used EMACS and JEDIT to create small test routines. I would right click the file and set properties to executable. I would then click the icon, the bouncy ball would do its thing then a dialog box would flash on the screen for a fraction of a second. I could tell it had a progress bar on it but could not catch anything else on it. Then nothing else would happen. If I could execute a script the world would once again be my playground... PLEASE HELP. Open a terminal program like konsole. change the directory to where your files are (cd /path/to/files/). execute them (python my-script.py'). THANK YOU THANK YOU THANK YOU It now works from the command line like you said. Shouldn't I also be able to 'click' an icon that has been set to executable and launch the whole process that way? Doug -- LINUX protects me from the GATES of hell !!! -- http://mail.python.org/mailman/listinfo/python-list
main window in tkinter app
A short while ago someone posted that(unlike the examples) you should use Tk as the base for your main window in tkinter apps, not Frame. Thus : class MyMain(Frame): def __init__(self, master): self.root = master self.master=master self.createWidgets() def createWidgets(): ... root = Tk() app = MyMain(root) app.master.title(Object Editor) root.mainloop() would become: class MyMain(Tk): ... ... app = MyMain() app.title(My App) app.mainloop() When I try converting to this approach I run into a problem with the __init__() method. It appears to go into an infinite loop in tkinter.__getattr__(). If I omit __init__() I get a properly titled window, but must explicitly call my createWidgets method from __main__. class MyMain(Tk): createWidgets() ... ... app = MyMain() app.title(My App) app.createWidgets() app.mainloop() Am I missing something? Bill -- http://mail.python.org/mailman/listinfo/python-list
Re: Image orientation and color information with PIL?
i = Image.open(blue.jpg) i.size (3008, 2000) i.mode 'RGB' 'RGB' is the value for color jpeg images. I believe that for blackwhite images, i.mode is 'L' (luminosity). If you want to determine whether an existing image is landscape or portrait, then just compare i.size[0] (width) and i.size[1] (height). If by determine if an image is horizontal/vertical, you want to find the orientation data recorded by some digital cameras, you can do that with PIL 1.1.4. According to the release notes for 1.1.4, + Added experimental EXIF support for JPEG files. To extract EXIF information from a JPEG file, open the file as usual, and call the _getexif method. If successful, this method returns a dictionary mapping EXIF TIFF tags to values. If the file does not contain EXIF data, the _getexif method returns None. The ExifTags module contains a dictionary mapping tags to tag names. This interface will most likely change in future versions. The exif tag 274 is Orientation. The values you'll see most often are 1 (Normal), 6 and 8 (90 and 270 degree rotations). Orientation can also encode 180 degree rotation, as well as any of the four rotations combined with a mirror operation. [k for (k,v) in ExifTags.TAGS.items() if v == 'Orientation'] [274] e = i._getexif() if e: print e[274] 1 I have written a standalone Python module that reads and changes the EXIF orientation data. You can view it here: http://unpy.net/cgi-bin/viewcvs.cgi/aethertool/disorient.py?rev=1.2content-type=text/vnd.viewcvs-markup It is available under the terms of the GNU GPL. Here's another page about EXIF orientation data: http://sylvana.net/jpegcrop/exif_orientation.html Jeff pgpbJ5BO1Z3ui.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Opinions on KYLIX 3 (Delphi 4 Linux)
Jeff Epler wrote: I honestly don't know why anyone would spend money for a development environment, no matter how fancy. I don't knowdefinitelye would develop software in a language that doesn't have at least one open implementation. It's a great way to get screwed when Borland goes under or decides they only want to sell a new, incompatible product. What do you do with your existing product when that happens? Re-train on a new platform, and re-write from scratch? Just say no to proprietary software. Jeff Thanks Jeff, Point taken! I had given that considerable thought. Your words 'retrain on a new platform' struck a loud cord with me, thank you, I will definitely reconsider. I don't ever want to find myself locked behind 'the GATES of hell' again! Doug -- LINUX protects me from the GATES of hell !!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Image orientation and color information with PIL?
if you mean that you want to figure out which way the image is depending on the actual data in the image, then you'll most likely get to do the image processing yourself, on the other hand, if you are talking jpegs from a relatively new camera then I suppose that you should be able to get that info by looking at the EXIF information. AFAIK you can read exif with PIL, but not write. -- http://mail.python.org/mailman/listinfo/python-list
Re: Image orientation and color information with PIL?
On Mon, Jul 18, 2005 at 10:55:42AM -0600, Ivan Van Laningham wrote: How are you going to determine the orientation of an image without sophisticated image analysis? There is research on automatic image orientation detection. [...] If you write it I'll use it;-) There's research going on in this area. Here are a few papers: http://www.dcs.shef.ac.uk/teaching/eproj/msc2004/abs/m3zs2.htm http://research.microsoft.com/research/pubs/view.aspx?pubid=918 there are probably many others. I considered implementing one of these algorithms back in 2003 or so, but instead I bought a digital camera with an orientation sensor. Jeff pgpJZsejWH68l.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: ssh popen stalling on password redirect output?
Thanks for the help, this gives me a few options. I think the best way to do it is using the public/private key authentication. -- http://mail.python.org/mailman/listinfo/python-list
Re: ssh popen stalling on password redirect output?
Thanks for the help, this gives me a few options. I think the best way to do it is using the public/private key authentication. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Peter Hansen wrote: Gerhard Haering wrote: On Mon, Jul 18, 2005 at 09:06:21AM -0400, Peter Hansen wrote: I'm not familiar with this expression. What do you mean by black horse? Maybe the Ferrari of pythonic frameworks (black horse on yellow background being the symbol of Ferrari). I know there are black sheep in some families, and dark horse candidates. Also yellow-bellied sapsuckers. There's a black horse fish in the Mississippi valley (also, quite coincidentally, of the sucker family). Not entirely sure that was the intended connotation. :-) -Peter I'm used to make those mistakes too... This mailing list taught me more English than Python for sure. I read the expression Dark horse contender many times, and i guess it has some reminiscence from medieval times and the cavalry stories. It meaning is something like the unknown that could be the new champ, someone intriguing and mysterious who doesn't unveil its skills untill showtime. Am I right? Cheers, Luis -- http://mail.python.org/mailman/listinfo/python-list
Re: python certification
[EMAIL PROTECTED] wrote: i want to get a small certificate or diploma in python. it should be online cuz i live in pakistan and wont have teast centers near me. it should be low cost as i am not rich. and hopefully it would be something like a a begginer certification cuz i am new to python. Just print out the certificate below and paste on your wall ;) #--# | | | | | Comp.Lang.Python does hereby certify that | | | | LORD VERMINARD | | | | is a bona fide Pythonista, | |with all rights and privileges| | assigned thereto.| | | | Presented This Day | | | | 18th of July, 2005 | | | | | #--# Or, you could give some indication of why you would need such a thing. If it's for your own satisfation, use the certificate above when you're gone through the tutorial and have written an actual program you feel is useful. (That's what's of value with Python - using it to make your life better, not being able to fill out the correct bubbles on some multiple choice test.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python scripts wont run - HELP
On Mon, 2005-07-18 at 17:22 +0100, John Abel wrote: windozbloz wrote: Bye Bye Billy Bob... Hello All, I'm a fairly literate windoz amateur programmer mostly in visual basic. I have switched to SuSE 9.2 Pro and am trying to quickly come up to speed with Python 2.3.4. I can run three or four line scripts from the command line but have not been able to execute a script from a file. I have used EMACS and JEDIT to create small test routines. I would right click the file and set properties to executable. I would then click the icon, the bouncy ball would do its thing then a dialog box would flash on the screen for a fraction of a second. I could tell it had a progress bar on it but could not catch anything else on it. Then nothing else would happen. If I could execute a script the world would once again be my playground... PLEASE HELP. You will need to include #!/usr/bin/python At the top of your script. HTH J Or, better yet: #!/usr/bin/env python ;) -- http://mail.python.org/mailman/listinfo/python-list
Re: Earthquake Forecasting Program July 11, 2005
Bob Officer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip over 100 lines that should have been snipped before] In particular I am interested in the EM dataset. There isn't any data set There are no formula... There is only EGD Crackpot. http://www.crank.net/geology.html Look down to the middle of the page E.D.G. Listed as Cranky I figured as much, and appreciate the info, but PLEASE learn to snip so people can find your meat easier. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I send keystrokes to a console window in Windows XP?
Thank you, Benji. This gives me hope, but what I really need to do is to send keystrokes to an already existing console window. Any help there? (P.S. Sorry that I wasn't more specific.) -- http://mail.python.org/mailman/listinfo/python-list
Re: Opinions on KYLIX 3 (Delphi 4 Linux)
Hi Doug Not only was Kylix a letdown, there is talk also of it being discontinued. To be fair though, it is easy to see the difficulty for Borland to deploy a Linux IDE of the same quality as Delphi when so much in different Linux distributions is variable, the widget set being a prime example: CLX just never caught on, amongst the myriad of more mature and more open toolsets. I am assuming that you have experience with pascal, or ObjectPascal as the Delphi manuals call it (if not, why Kylix?). If so, may I suggest you look into a) fpc (Free Pascal Compiler, http://www.freepascal.org) b) Lazarus (An fpc IDE, aims to be an open-source Delphi clone, supports multiple widget sets [Win32 native on Windows!], can't remember the URL) Though python is probably my favourite language for general purpose hacking, there is a lot to be said for a native compiled language (sometimes speed _is_ an issue), and in particular there is a lot to be said for fpc: - Something like 99% Turbo Pascal compliant - Very nearly Delphi compliant (object-pascal) - (IMHO) Much cleaner language than C, still natively compiled - Supports operator overloading inlining - Can be used to develop python extensions - Supports nearly effortless cross-compiling There are some problems with Lazarus at the moment, here is the biggie: It creates binaries of around 5MB for a minimal app, and this is because, at the moment it seems like it compiles the component library into the executable. This is somewhat of a problem for me but I expect this will change within a release or two. Lazarus is _very_ much like Delphi, and works on Windows, Linux, and possibly several other platforms. cya Caleb and net for info about Borlands KYLIX 3 and have found little technical info about it. Their screen shots are very impressive, similar to Visual Basic. I have sent several emails to Borlands Sales and Pre-Sales departments. Pre-Sales bounces and Sales won't answer. I'm sitting here with money in hand ready to buy but not from a company that won't give me the time of day. Does anyone of you have experiance with KYLIX 3 and do you think I should consider buying it? Thank You, I'll go oil my keyboard now. Doug -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Luis M. Gonzalez wrote: I read the expression Dark horse contender many times, and i guess it has some reminiscence from medieval times and the cavalry stories. It meaning is something like the unknown that could be the new champ, someone intriguing and mysterious who doesn't unveil its skills untill showtime. Am I right? My understanding is that it is a horse-racing phrase. Some unprincipled racers would dye a horse to disguise him and get better odds. Obviously this only works to make a horse darker. A dark horse is an unknown quantity -- the phrase is usually only applied to horses that show well without the normal track record preceding that success. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: goto
On Mon, 2005-07-18 at 12:27 -0600, Steven Bethard wrote: Hayri ERDENER wrote: what is the equivalent of C languages' goto statement in python? Download the goto module: http://www.entrian.com/goto/ And you can use goto to your heart's content. And to the horror of all your friends/coworkers. ;) STeVe Shouldn't that be to the horror of all your goto-snob friends. IMO, most of the people who deride goto do so because they heard or read where someone else did. Many of the world's most profitable software companies (MS for example) have thousands of goto statements in their code... oh the horror of it all. Why aren't these enlightened-by-the-gods know-it-alls as profitable as these obviously ignorant companies? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python ldap pointers for a newbie - Actually just trying to decifer the error..
rh0dium wrote: ldap_result_id = cnx.search_s(baseDN, searchScope, searchAttrs, retrieveAttrs) You are already using the synchronous search method which indeed return the search results. So this should read: result_data=cnx.search_s(baseDN,searchScope,searchAttrs,retrieveAttrs) result_type, result_data = cnx.result(ldap_result_id, 0) You don't need this if you just want to use synchronous search method. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list