ANN: M2Crypto 0.17
M2Crypto is the most complete Python wrapper for OpenSSL. Homepage: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto Changes in 0.17: - setup.py has new test command to run unit tests (requires setuptools) - Added m2urllib2, by James Bowes (python 2.4 and later, at least for now) - Added CONNECT proxy for httpslib and m2urllib2, by James Bowes - Added PKey.get_modulus, X509.get_fingerprint, X509_Name.as_der and m2.bn_to_hex, by Thomas Uram - Prevent Connection.makefile from freeing bio redundantly, by Thomas Uram - Added Err.peek_error_code, by Thomas Uram - Fixed m2urllib.open_https to return the response headers, otherwise code that relied on that would break (for example msnlib-3.5), by Arno Bakker - Fixed twisted wrapper to work with 16kb BIO buffers, by Martin Paljak - Added support for remaining ECs, by Larry Bugbee - Fixed DSA.save_key and DSA_.save_pub_key, by Larry Bugbee - SSL.Context.load_verify_locations raises ValueError if cafile and capath are both None - Fixed X509.check_purpose() (was always raising exceptions) - smime_read_pkcs7 was changed to automatically call BIO_set_mem_eof_return on memory BIOs because otherwise the read would fail with SMIME_Error: not enough data - X509.new_extension('subjectKeyIdentifier', 'hash') raises ValueError instead of crashing Python -- Heikki Toivonen -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: tkFileDialog closes main application
On Wed, 20 Dec 2006 18:37:10 +0100, mdmdmd [EMAIL PROTECTED] wrote: Hello, I wish to collect 4 files from a user. So I have decided to use tkFileDialog askopenfilename. My problem is that after a few file selections the root window is destroyed (the whole program just dissappears) I tested the code below on Linux with Python 2.1 and tcl/tk 8.3.4 and it works perfectly. I have created a simple example and was able to reproduce the same thing with this. I've just started using tkinter so I have no idea what I may be doing wrong. If anyone has any ideas please let me know. If you run the following code, just click the Browse button, and select a file. Do this repeatedly and for me after the sixth or seventh time the window shuts down. Is there any error when this happens? Have you tried running your script from a DOS command window? BTW, I'm using python 2.4 on Windows XP. Thank you for any help. How do you select your files? I occasionally see problems on Windows when a window is closed via a double-click: the last 'button release' event for the double-click is not consumed by the dialog, but sent to the window behind it. Could it be what happens? If you select your files with a double-click and if the mouse cursor just happens to be on the close button for your main window behind it, you may involuntarily close the main window when selecting the file. Please try to select the files and then press the 'Open' button to see if the problem still happens. Here is a tiny modification to your code to print a message when the window is closed via its close button: from Tkinter import * import Pmw import tkFileDialog import os.path filepath = 'C:\\Documents and Settings\\admin\\Desktop\\' class App(Frame): def __init__(self,master): Frame.__init__(self, master, bg='gray') self.enttxt = StringVar() lbl = Label(self,text='File 1:') lbl.grid(row = 0,column = 0,sticky = W,padx = 5,pady = 5) self.e1 = Entry(self,textvariable = self.enttxt,width = 50) self.e1.grid(row = 0,column = 1,columnspan = 3,sticky = W,padx = 5,pady = 5) btn = Button(self,text='Browse ...',width = 12, command = self.browse) btn.grid(row = 0,column = 4,sticky=W,padx=5,pady=5) master.protocol('WM_DELETE_WINDOW', self.doQuit) def doQuit(self): print 'Closed by the WM!' self.quit() def browse(self): fileformats = [('Text File ','*.csv'), ('All Files ','*.*')] retval = tkFileDialog.askopenfilename(title='Choose File', initialdir=filepath, filetypes=fileformats, parent = self) if retval: self.enttxt.set(os.path.abspath(retval)) def main(): root = Tk() root.withdraw() root.title('test') root.configure(bg='gray') app = App(root) app.pack() root.update() root.deiconify() root.mainloop() if __name__ == '__main__': main() BTW, why do you create a sub-class of Frame for your application? Why not create a sub-class of Tk instead? HTH -- python -c print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-']) -- http://mail.python.org/mailman/listinfo/python-list
Re: list1.append(list2) returns None
i rewrote the code following the advices from subdir of the parent thread: # well, table is composed of a list of columns. # so let's stick them together def enlargetable(table,col): table.append(col) # the code won't return sorted lists :-o return_the_fucking_table_bitch=table # assign it to a new variable to return it return return_the_fucking_table_bitch # :-| def removecolfromtable(table,col): return table.remove(col) print enlargetable([[1],[2],[3]],[4]) # and this code works. -- http://mail.python.org/mailman/listinfo/python-list
Re: list1.append(list2) returns None
Pyenos schrieb: i rewrote the code following the advices from subdir of the parent thread: # well, table is composed of a list of columns. # so let's stick them together def enlargetable(table,col): table.append(col) # the code won't return sorted lists :-o Why should it sort the list? return_the_fucking_table_bitch=table # assign it to a new variable to return it return return_the_fucking_table_bitch # :-| That isn't necessary. A simple return table is fine. def removecolfromtable(table,col): return table.remove(col) table.remove() also returns None. print enlargetable([[1],[2],[3]],[4]) # and this code works. Georg -- http://mail.python.org/mailman/listinfo/python-list
Re: your opinion about psycopg vs pygresql
Martin P. Hellwig wrote: However, given the choice, what in your opinion would be the reason why someone would chose one over the other? Now I know this could easily get into a flamewar, so if you comment (but please do so) I'll still investigate that, since at this moment I don't even have a clue how they differ and on what reason, why does PostgreSQL seem to favour pygresql and Pythoneers psycopg? Thanks in advance. Well, my info can be a little out of date, since I researched this problem more than a year ago. AFAIK, psycopg still lacks prepared statements, which can be a huge drawback (partial workaround: use executemany() whenever possible). Psycopg 2 (as opposed to psycopg 1.1) does not support commit() on cursor (no serialized connections) Among the advantages of psycopg 2 is its very good support of mappings between Python data types and PostgreSQL data types. You can easily introduce your own mappings, even for composite data types. My $0.02 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python-list Digest, Vol 39, Issue 378
Just a guess, but I think you need to be using at least Python 2.4 if you are going to use IDLE version 2.4.4-2. sorry i did a typo. I am actually using python 2.4.4 On Dec 20, 1:16 pm, altern [EMAIL PROTECTED] wrote: Hi when i try to run IDLE on my debian laptop I get this error. $ idle Traceback (most recent call last): File /usr/bin/idle, line 5, in ? main() File idlelib/PyShell.py, line 1359, in main File idlelib/FileList.py, line 44, in new File idlelib/PyShell.py, line 105, in __init__ File idlelib/EditorWindow.py, line 111, in __init__ File /usr/lib/python2.4/lib-tk/Tkinter.py, line 2764, in __init__ Widget.__init__(self, master, 'text', cnf, kw) File /usr/lib/python2.4/lib-tk/Tkinter.py, line 1865, in __init__ self.tk.call( _tkinter.TclError: expected integer but got `100 I am not sure about what could cause the problem because I didnt use my laptop for python programming for couple of weeks. Before that it worked fine. And on that period i might have installed few things. I am running Debian unstable with python 2.2.4, tcl8.4, tk8.4, python-tk 24.4-1 and IDLE 2.4.4-2. I already tried to reinstall IDLE, tk and tcl and python-tk but that did not solve anything, i keep getting the same error. any ideas? thanks enrike -- http://mail.python.org/mailman/listinfo/python-list
Re: rsync for python?
nienfeng írta: Hi, everyone I want to build rsync server that can run in linux and windows, and configure by python. So I'm looking for something like rsync for python. I find rsync.py and pysync. But rsync.py looks like a client mode, it can't be a rsync server, is it? Can pysync be a rsync server? Look at rdiff-backup here: http://www.nongnu.org/rdiff-backup/ Well, this can only sync in one direction, but it is very good at it. I'm using it to synchronize big directories (20GB data, thousands of hundreds of small files) over an ADSL connection and it works. If you need to sync in both directions, I would recommend subversion. There is a python module for subversion. Although subversion is not lightweight, and you really need to read its (very long) documentation. :-) Best, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: a question on python dict
[EMAIL PROTECTED] wrote: Thank you very much for your explanation! I made a mistake that I said the hash value should be recalculated each time the dict resize, what I wanted to say was that the position of each item should be recalculated. Maybe I should take a look at the source code of python dict some day. I'll some here for help then. In your original message you said: I think this will waste some time doing the increasing-copying thing. If I know I'm going to handle about 2 items, I can set the size of hashtable to 3. Have you actually tried timing how much time is wasted doing this? 2 items really isn't very many for a dictionary to handle. I ran a quick test to see how long it takes to create a dictionary with 2 items. Remember, as has been explained to you, the items are not copied, nor are the hash values recalculated when the dictionary is resized, so if your dictionary takes much longer to create than the test below gives you (on your machine that is rather than mine), then the problem lies elsewhere. e.g. a slow hash function, or the time taken to create whatever you are storing in the dictionary. Just creating the dictionary with no other Python overhead: timeit.py -s import random; r = [ random.random() for i in range(2)] d = dict.fromkeys(r) 100 loops, best of 3: 11.3 msec per loop Creating the dictionary using a Python for loop: timeit.py -s import random; r = [ random.random() for i in range(2)] d={} for k in r: d[k] = None 100 loops, best of 3: 11.7 msec per loop Assigning to the elements in a pre-populated (and therefore the right size) dictionary: timeit.py -s import random; r = [ random.random() for i in range(2)]; d=dict.fromkeys(r) for k in r: d[k] = None 100 loops, best of 3: 10.1 msec per loop How many times do you create this dictionary that shaving 1.5 milliseconds off 11 millseconds matters to you? FWIW, for a 2,000,000 element dictionary the times are 2.5s and 1.48s respectively so the situation does get progressively worse as dictionaries get very large. -- http://mail.python.org/mailman/listinfo/python-list
FYA: python cell phone is ruby-less
(mostly off-topic) vertu makes a $310,000US cell phone which has rubies on it. i thought it was quite interesting that they have a cheaper phone ($115,000) called Python which *doesn't* have rubies: http://money.cnn.com/popups/2006/biz2/cellphone better order yours now since only 26 will be made. ;-) happy holidays everyone! -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Core Python Programming, Prentice Hall, (c)2007,2001 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com -- http://mail.python.org/mailman/listinfo/python-list
Re: def index(self):
George Sakkis [EMAIL PROTECTED] wrote: Gert Cuykens wrote: class HelloWorld(object): @cherrypy.exposed def index(self): return Hello World do i have to write @cherrypy.exposed before every def or just once for all the def's ? and why not write something like @index.exposed ? in other words i have no idea what @ actually does i only know i have too write it to make it work :) Am guessing @ is something like prototyping in javascript but then def index is not a object but a method ? So that would not make sense ? oh and self stands more or less for private method right ? Ouch. Do you really expect to learn a language from scratch by QA in a malining list ? That's a very inefficient way to spend both yours and others' time. Do your homework first by reading one of the several free tutorials online and come back when you have trouble with something specific you didn't understand. To be perfectly fair, searching for information about decorators if you don't know what they are called is kind of hard. Searching for information about the '@' character in the Python documentation doesn't lead to much. The CherryPy tutorial does at least mention this decorator, just not in any meaningful way: Exposing objects CherryPy maps URL requests to objects and calls the suitable method automatically. The methods that can be called as a result of external requests are said to be exposed. Objects are exposed in CherryPy by setting the exposed attribute. This an be done directly on the object itself: object.exposed = True. Methods can also be exposed using a special decorator: Why this distinction? The distinction between published and exposed objects may seem silly or unnecessary at first. By definition, all exposed objects are also published, so why do we need to care about non-exposed objects? To the OP: do i have to write @cherrypy.exposed before every def or just once for all the def's ? Before every def that you wish to expose, which won't be all of them. and why not write something like @index.exposed ? because that isn't how it works. cherrypy.exposed is a decorator, which means it is a function that takes a function as an argument modifies it in some way and returns the modified function as its result. in other words i have no idea what @ actually does i only know i have too write it to make it work :) Am guessing @ is something like prototyping in javascript but then def index is not a object but a method ? So that would not make sense ? @expr def fn(...): ... is exactly equivalent to: def fn(...): ... fn = (expr)(fn) except that at the point when the decorator is called the function has not yet been assigned to the name 'fn'. (Also remember that def is an executable statement so it happens when the line containing the def is execfuted, and that names assigned to functions are just like other variable names and can be rebound at will.) oh and self stands more or less for private method right ? if you have to ask that question about 'self' you really do need to read some introductory texts on Python. Methods get passed their instance as their first parameter (usually this is implicit in the call, but it is always explicitly shown in the method) and self is simply the conventional name. Many other languages use 'this' instead of self and make the passing of 'this' implicit inside the method as well as outside. There are good reasons why it is explicit in Python, but just remember that the first parameter a method receives is always the instance and you won't go far wrong. -- http://mail.python.org/mailman/listinfo/python-list
Re: Stani's Python Editor - questions
On Wed, 20 Dec 2006 15:45:01 +0100, Laszlo Nagy [EMAIL PROTECTED] wrote: Hello, I was trying to get answers for these. SPE homepage was down. Then I found it on berlios (http://developer.berlios.de/forum/forum.php?forum_id=12695) but no one answered since 5 days. In fact nobody seems to write in anything to that forum, I presume it is dead. I have no other choice than ask it here. I apologize in advance, they may be silly questions. 1. How can I navigate between opened files? Usually I open 10 or more files at the same time. There is no way to quickly scroll the tabs and select the one that I want. Tabs simply run out of my screen. Normally with ctrl-tab, ctrl-shift-tab, ctrl-f6 ctrl-shift-f6 (at least on windows) 2. I tried to use the Browser for navigation but it tells me file is already open and it won't switch to the file. Annoying. What version do you have? on 0.8.0b on Windows, it jumps to the tab, if the file is already open. [...] I did not find any options/preferences to change the above things. Some of the above might be new feature requests. I recently switched from DrPython to SPE. SPE has more functions and it could be much much better than DrPython, but it has big problems. Now the interesting part of your post begins for me. :) For example, I like that SPE saves the workspace automatically for me. In DrPython you have a plugin Sessions or SessionsLight for that. on the sf project page and the SessionsLight on: http://mitglied.lycos.de/drpython/ It saves all open file plus last editing position. But it takes two minutes to start up SPE, because I have to press the OK button on the ISO8859-1 message for each file that is re-opened. I very like the Browser window, but I cannot use it for navigation. I like the new style save file dialog, but I cannot use it because it is small. I like the code completion. (dot) :-) In DrPython, there is also a Code Completions plugin. It is not perfect, but still useful. I don't want to persuade to use this or that, but a closer look to the plugins will reveal the hidden features of DrPython, and plugins prevent DrPython to become to bloated. Thanks, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: tuple.index()
In article [EMAIL PROTECTED], greg [EMAIL PROTECTED] writes: | | Not at all. I didn't say that they came in pairs. Consider: | | [str1, str2, agent1, str3, agent2, agent3, agent4, str4, ...] | | That's homogeneous. Any item of the list can be | either a string or an agent, and the only thing | the position in the list affects is what order | the strings and agents are processed in. Grrk. I think that I see Python's problem - and it is Python's problem, not mine or that of any of the other people who ask related questions. The terms heterogeneous and homogeneous are being used in an extremely specialised, unconventional and restricted way, without any kind of hint in the documentation that this is so. It isn't an UNREASONABLE use, but assuredly will NOT spring to the mind of anyone who sees the terms, most especially if they are familiar with their use in other areas of computing and mathematics. But, given that meaning, I now understand your point. Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list
Re: [PythonCAD] [ANNOUNCE] Thirty-fifth release of PythonCAD now available
Hi again. In addition to the thirty-fifth release of PythonCAD finally seeing the light of day, the PythonCAD website was given a long overdue makeover. I'd like to thank Jose Antonio Martin for doing the stylesheet and artwork. The new look is an vast improvement from the plain text layout the site has always had. Art Haas -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 -- http://mail.python.org/mailman/listinfo/python-list
Re: SQLALCHEMY - Method to have the last word, by Michael Bayer
Diez B. Roggisch [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: Wearing skull socks makes you mean. Ahh, I guess you're right - that twitching in my feet I should get rid of them, wear cherubim socks instead and take a more relaxed stance towards Ilias and his kind. If only I manage to really do this until they convince me to keep them, wearing them even in my sleep... Is there some of way of suppressing the deadly information in this thread before the Spanish Inquisition sees it ? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: tuple.index()
In article [EMAIL PROTECTED], Hendrik van Rooyen [EMAIL PROTECTED] writes: | Nick Maclaren [EMAIL PROTECTED] wrote: | | Not at all. I didn't say that they came in pairs. Consider: | | [str1, str2, agent1, str3, agent2, agent3, agent4, str4, ...] | | See Algol 68 for an example of this. | | When I looked at the above, I went tilt - Yes, you are confused :-) Neither the agents nor strings take the other as 'arguments', but are effectively methods of the I/O object. Let's consider a modern example: a text editor with hyperlink facilities. Note that I am referring to the hyperlinks of the kind that can occur anywhere, and not those associated with a particular, usually highlighted, word. Text is a sequence of letters/words/sentences/paragraphs/markup/etc.; let's assume words, as strings, for the purpose of argument. Words can be inserted, deleted, changed etc. Hyperlinks are agents and can be added at any point. Their only relationship with the text is the position at which they occur (i.e. none or more may occur between any two consecutive words). Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list
Re: calling a class instance of function
Hi, Methods i.e functions bound to a class instance (or object) the self argument in their definition: [code] class pid: def add(self, toadd): pass #or some sensible code [/code] If you want to define a method without that implicit self argument you'll have to make this method a static: [code] class pid: @staticmethod def staticadd (param1, param2): pass #or some sensible code [/code] Furthermore, your test() seems to be rather a function than a class: You want to use this function to test the pid class but what you do with your code below is to define a class test which inherits pid. I'm not really sure what the following lines do ... this would usually be the place to introduce class variables. Hope that Helps! Greetings Nils Original-Nachricht Datum: 21 Dec 2006 11:09:32 +1100 Von: Pyenos [EMAIL PROTECTED] An: python-list@python.org Betreff: calling a class instance of function class pid: pid def add(original_pid,toadd): add pid original_pid.append(toadd) return original_pid def remove(something_to_remove_from,what): remove pid something_to_remove_from.remove(what) return something_to_remove_from def modify(source,element,changewiththis): modify pid source[source.index(element)]=changewiththis return source class test(pid): pid.original=[1,2,3] pid.toadd=4 pid.add(pid.original,pid.toadd) # error here says that # it expects pid instance as first arg # not a list that it got. why do i get an error? -- http://mail.python.org/mailman/listinfo/python-list -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer -- http://mail.python.org/mailman/listinfo/python-list
Re: what is wrong with my code?
Hi, this is the line that breaks your code: def progressTable(progress_table, action, task, pid=len(progress_table) your parameter progress_table is known inside the function, not inside its definition. So pid=len(progress_table) won't do. If you really think that it is possible that pid is anything else but len(progress_table), you should use for example -1 as the default value and calculate the length inside your functions if the parameter is not different. Otherwise dump this parameter. Hope that helps! Greetings Nils Original-Nachricht Datum: 21 Dec 2006 09:16:58 +1100 Von: Pyenos [EMAIL PROTECTED] An: python-list@python.org Betreff: what is wrong with my code? import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS=[new,remove,modify] DEFAULT_PROGRESS_DATA_FILE=progress_data PROGRESS_OUTCOMES=[pass, fail] def unpickleProgressTable(pickled_progress_data_file): return unpickled_progress_table def pickleProgressTable(progress_table_to_pickle): return pickled_progress_data_file # Of course, you get progress_table is unpickled progress table. def progressTable(progress_table, action, task, pid=len(progress_table), outcome=PROGRESS_OUTCOMES[1]): pid_column_list=progress_table[0] task_column_list=progress_table[1] outcome_column_list=progress_table[2] # But a task must also come with an outcome! def newEntry(new_task, new_outcome): new_pid=len(task_column_list) pid_column_list.extend(new_pid) task_column_list.extend(new_task) outcome_column_list.extend(new_outcome) def removeEntry(pid_to_remove, task_to_remove): if pid_column_list.index(pid_to_remove)==task_column_list.index(task_to_remove): # Must remove all columns for that task index_for_removal=pid_column_list.index(pid_to_remove) pid_column_list.remove(index_for_removal) task_column_list.remove(index_for_removal) outcome_column_list.remove(index_for_removal) # Default action is to modify to pass def modifyEntry(pid_to_modify, outcome_to_modify=PROGRESS_OUTCOMES[0]): index_for_modifying=pid_column_list.index(pid_to_modify) # Modify the outcome outcome_column_list[index_for_modifying]=outcome_to_modify -- http://mail.python.org/mailman/listinfo/python-list -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer -- http://mail.python.org/mailman/listinfo/python-list
Re: Stani's Python Editor - questions
1. How can I navigate between opened files? Usually I open 10 or more files at the same time. There is no way to quickly scroll the tabs and select the one that I want. Tabs simply run out of my screen. Normally with ctrl-tab, ctrl-shift-tab, ctrl-f6 ctrl-shift-f6 (at least on windows) This does not work for me. I'm using these: OS: FreeBSD 6.1-RELEASE Python: 2.4.3 wxPython: 2.6.3.3 SPE: 0.8.2a Maybe I should use 0.8.0, but this would be difficult. My SPE was installed using the ports system of my OS and I do not want to screw it up. 2. I tried to use the Browser for navigation but it tells me file is already open and it won't switch to the file. Annoying. What version do you have? on 0.8.0b on Windows, it jumps to the tab, if the file is already open. Does not work for me! I'm getting messages like this: python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed I'm not sure what it means, but maybe the problem is not in SPE or DrPython - it is with wxWidgets or GTK ? In DrPython you have a plugin Sessions or SessionsLight for that. Okay, I know that DrPython has lots of plugins. I tried to install some of them but the important ones did not work and I gave up. But it takes two minutes to start up SPE, because I have to press the OK button on the ISO8859-1 message for each file that is re-opened. This must be a problem with wxHtmlWindow because I get the same message when I start the wxPython demo. I'm upgrading wxPython right now, but I'm not sure if it will help. SPE requires 2.6.1 and I already have a newer version. (DrPython does not use wxHtmlWindow, this is why it does not throw error messages.) In DrPython, there is also a Code Completions plugin. It is not perfect, but still useful. I tried to install it on FreeBSD but it did not work. I tried it on Windows and turned out that code completion in DrPython it is much worse than in SPE. I'm missing code folding as well. DrPython is better for me right now, because it works. :-) But none of them are practical nor easy to use. SPE would be better if it worked. I wanted to buy the Wing IDE, but their support team said it is not available for FreeBSD. They allow me to compile it from sources but it is a mess. I would have to sign an NDA and spend hours with compiling it, and it would still not be a supported platform. It is just too much work. Komodo does not work on FreeBSD at all. Also tried boaconstructor, but it was very unstable. If I would like to have a good IDE for Python that knows a lot (code completion, code folding, class browser, integrated debugger, call tips, subversion integration etc.) then what choices I have? I don't want to persuade to use this or that, but a closer look to the plugins will reveal the hidden features of DrPython, and plugins prevent DrPython to become to bloated. I'm sorry, I do not want to be offensive. DrPython is good, but it is not a complete IDE. I would happily pay for a good IDE but I cannot find one (not for FreeBSD). Maybe the problem is with my mind and I should replace my OS immediately. :-) Best, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: rsync for python?
nienfeng wrote: Hi, everyone I want to build rsync server that can run in linux and windows, and configure by python. So I'm looking for something like rsync for python. I find rsync.py and pysync. But rsync.py looks like a client mode, it can't be a rsync server, is it? Can pysync be a rsync server? Thanks by nienfeng This one for Windows and Linux is all in Python and its configuration is also Python scripting : http://www.xellsoft.com/SynchronEX.html#features GUI wizards can create starting script templates for more complex tasks. You'd not need to run an extra server as it directly uses SFTP, DAV (HTTP(S)), FTP(S), Local-Filesystem/NFS, Windows-Network .. standards for WAN/LAN transfer. Sam -- http://mail.python.org/mailman/listinfo/python-list
Re: Regexp Neg. set of chars HowTo?
On Dec 20, 7:40 am, durumdara [EMAIL PROTECTED] wrote: Hi! I want to replace some seqs. in a html. Let: a- b = ab but: xxx - b must be unchanged, because it is not word split. I want to search and replace with re, but I don't know how to neg. this set ['\ \n\t']. This time I use full set without these chars, but neg. is better and shorter. Ok, I can use [^\s], but I want to know, how to neg. set of chars. sNorm1= '([^[\ \t\n]]{1})\-\br\ \/\\n' - this is not working. Thanks for the help: dd sNorm1= '([%s]{1})\-\br\ \/\\n' c = range(0, 256) c.remove(32) c.remove(13) c.remove(10) c.remove(9) s = [\\%s % (hex(v).replace('00x', '')) for v in c] sNorm1 = sNorm1 % (.join(s)) print sNorm1 def Normalize(Text): rx = re.compile(sNorm1) def replacer(match): return match.group(1) return rx.sub(replacer, Text) print Normalize('a -br /\nb') print Normalize('a-br /\nb') sys.exit() It looks like you are trying to de-hyphenate words that have been broken across line breaks. Well, this isn't a regexp solution, it uses pyparsing instead. But I've added a number of other test cases which may be problematic for an re. -- Paul from pyparsing import makeHTMLTags,Literal,Word,alphas,Suppress brTag,brEndTag = makeHTMLTags(br) hyphen = Literal(-) hyphen.leaveWhitespace() # don't skip whitespace before matching this collapse = Word(alphas) + Suppress(hyphen) + Suppress(brTag) \ + Word(alphas) # define action to replace expression with the word before hyphen # concatenated with the word after the BR tag collapse.setParseAction(lambda toks: toks[0]+toks[1]) print collapse.transformString('a -br /\nb') print collapse.transformString('a-br /\nb') print collapse.transformString('a-br/\nb') print collapse.transformString('a-br\nb') print collapse.transformString('a- BR clear=all\nb') -- http://mail.python.org/mailman/listinfo/python-list
Re: Stani's Python Editor - questions
On Thu, 21 Dec 2006 11:58:48 +0100, Laszlo Nagy [EMAIL PROTECTED] wrote: 1. How can I navigate between opened files? Usually I open 10 or more files at the same time. There is no way to quickly scroll the tabs and select the one that I want. Tabs simply run out of my screen. Normally with ctrl-tab, ctrl-shift-tab, ctrl-f6 ctrl-shift-f6 (at least on windows) This does not work for me. I'm using these: OS: FreeBSD 6.1-RELEASE Python: 2.4.3 wxPython: 2.6.3.3 SPE: 0.8.2a I also saw big problems with DrPython on wxPython: 2.6.3.3 and Ubuntu. Maybe I should use 0.8.0, but this would be difficult. My SPE was installed using the ports system of my OS and I do not want to screw it up. 2. I tried to use the Browser for navigation but it tells me file is already open and it won't switch to the file. Annoying. What version do you have? on 0.8.0b on Windows, it jumps to the tab, if the file is already open. Does not work for me! I'm getting messages like this: python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed Same similar error messages with DrPy. I would try to update to a higher wxPython version and/or reporting this to the wxPython user mailing list. I'm not sure what it means, but maybe the problem is not in SPE or DrPython - it is with wxWidgets or GTK ? I suspect so. In DrPython you have a plugin Sessions or SessionsLight for that. Okay, I know that DrPython has lots of plugins. I tried to install some of them but the important ones did not work and I gave up. But it takes two minutes to start up SPE, because I have to press the OK button on the ISO8859-1 message for each file that is re-opened. This must be a problem with wxHtmlWindow because I get the same message when I start the wxPython demo. I'm upgrading wxPython right now, but I'm not sure if it will help. SPE requires 2.6.1 and I already have a newer version. (DrPython does not use wxHtmlWindow, this is why it does not throw error messages.) I would comment out the wxPython versions check in spe for trying out. In DrPython, there is also a Code Completions plugin. It is not perfect, but still useful. I tried to install it on FreeBSD but it did not work. I tried it on Windows and turned out that code completion in DrPython it is much worse than in SPE. Yes, I know! :( This is also a future task. I'm missing code folding as well. DrPython is better for me right now, because it works. :-) Code folding should work in DrPython. Preferences = File types and click folding check box, then the folding menu in View menu should work. It is on our todo list for Drpython. I plan on January or February to make a thorough test on Linux. BTW: For that I'm (we're) looking for tester and developer for all that things. But none of them are practical nor easy to use. SPE would be better if it worked. I wanted to buy the Wing IDE, but their support team said it is not available for FreeBSD. They allow me to compile it from sources but it is a mess. I would have to sign an NDA and spend hours with compiling it, and it would still not be a supported platform. It is just too much work. Komodo does not work on FreeBSD at all. Also tried boaconstructor, but it was very unstable. If I would like to have a good IDE for Python that knows a lot (code completion, code folding, class browser, integrated debugger, call tips, subversion integration etc.) then what choices I have? Did you try already Eric3 (with PyQt). Looks very nice and stable and has a lot of features. I don't want to persuade to use this or that, but a closer look to the plugins will reveal the hidden features of DrPython, and plugins prevent DrPython to become to bloated. I'm sorry, I do not want to be offensive. No, no problem at all! :) DrPython is good, but it is not a complete IDE. I see, it isn't intended to be that also. I would happily pay for a good IDE but I cannot find one (not for FreeBSD). Maybe the problem is with my mind and I should replace my OS immediately. :-) Good Luck for finding your preferred editor and IDE. Best, Laszlo Cheers, -- http://mail.python.org/mailman/listinfo/python-list
Re: Stani's Python Editor - questions
On 12/21/06, Franz Steinhaeusler [EMAIL PROTECTED] wrote: Does not work for me! I'm getting messages like this: python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed Same similar error messages with DrPy. I would try to update to a higher wxPython version and/or reporting this to the wxPython user mailing list. FWIW, this has been reported for ages on the wxPython list. It's a bug in the Gtk implementation that generates these scary-looking warnings, but doesn't seem to cause any real problems. -- # p.d. -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib.unquote and unicode
Martin v. Löwis wrote: Duncan Booth schrieb: The way that uri encoding is supposed to work is that first the input string in unicode is encoded to UTF-8 and then each byte which is not in the permitted range for characters is encoded as % followed by two hex characters. Can you back up this claim (is supposed to work) by reference to a specification (ideally, chapter and verse)? In URIs, it is entirely unspecified what the encoding is of non-ASCII characters, and whether % escapes denote characters in the first place. http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1 Servus, Walter -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Simple Way To Determine If File Is Executable
Fredrik Lundh [EMAIL PROTECTED] schrieb Sebastian 'lunar' Wiesner wrote: no, I'm showing that a local file marked as executable overrides a shared one, even if the local file isn't actually an executable. Only if you have your system set up badly. The current directory should not be in the search path, and it especially shouldn't have higher priority than the regular bin locations. and the award for completely missing the context of this subthread goes to... Nevertheless his comment was absolutely correct... nope. a Unix system uses the same flag to determine if a file is executable no matter how I've set up my path. Paul didn't even mention the word executable. He was referring to completely different thing: The fact, that whether a local executable overrides a shared on, is matter of how you set your PATH. The local file would be executable, whether it is in the PATH or not... -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Simple Way To Determine If File Is Executable
Fredrik Lundh [EMAIL PROTECTED] schrieb Sebastian 'lunar' Wiesner wrote: you're confusing the shell's is this file executable check with the loader's can I execute this file check: $ export PATH=.:$PATH $ dd if=/dev/zero of=ls count=1 1+0 records in 1+0 records out $ ls -l ls -rw-rw-r-- 1 slab slab 512 Dec 20 03:33 ls $ chmod a+x ls $ ls -bash: ./ls: cannot execute binary file ??? Am I blind or is there really no difference between you shell example an mine? As far as I can see, you are doing exactly the same thing as I did... no, I'm showing that a local file marked as executable overrides a shared one, even if the local file isn't actually an executable. Well, that doesn't tell us anything about, whether a file executable or not. But anyway: you admit, that the local file ls is __not__ actually executable, although it has the x-bit set? So what are trying to proof? that you're wrong when you claim that the contents of the file matters when using the usual Unix conventions to check if a file is executable. Let me ask you a question: [EMAIL PROTECTED]:09:52] ~/test -- cat test.sh #!/bin/bash if [ $1 ]; then echo Hello $1 else echo Hello world fi [EMAIL PROTECTED]:09:54] ~/test -- ll test.sh -rw-r--r-- 1 lunar lunar 76 2006-12-21 13:09 test.sh Is test.sh now executable or not? Bye lunar -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: What am I supposed to do with an egg?!
Morpheus [EMAIL PROTECTED] wrote So, what am I supposed to do here now? That's easy: Breed it... -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Re: Need Simple Way To Determine If File Is Executable
Sebastian 'lunar' Wiesner wrote: no, I'm showing that a local file marked as executable overrides a shared one, even if the local file isn't actually an executable. Only if you have your system set up badly. The current directory should not be in the search path, and it especially shouldn't have higher priority than the regular bin locations. and the award for completely missing the context of this subthread goes to... Nevertheless his comment was absolutely correct... nope. a Unix system uses the same flag to determine if a file is executable no matter how I've set up my path. Paul didn't even mention the word executable. He was referring to completely different thing: The fact, that whether a local executable overrides a shared on, is matter of how you set your PATH. The local file would be executable, whether it is in the PATH or not... are you trying to win some kind of award? /F -- http://mail.python.org/mailman/listinfo/python-list
an hex number problem
Hello, I got a number 19968: 1. how can I change it to the hex form 0x4e00, 2. and how can I change 0x4e00 to a python unicode character u\u4e00? thank you! -- http://mail.python.org/mailman/listinfo/python-list
Re: an hex number problem
[EMAIL PROTECTED] wrote: I got a number 19968: x = 19968 1. how can I change it to the hex form 0x4e00, hex(x) '0x4e00' 2. and how can I change 0x4e00 to a python unicode character u\u4e00? unichr(x) u'\u4e00' also see: http://effbot.org/pyfaq/how-do-i-convert-a-number-to-a-string /F -- http://mail.python.org/mailman/listinfo/python-list
Re: What am I supposed to do with an egg?!
Sebastian 'lunar' Wiesner wrote: Morpheus [EMAIL PROTECTED] wrote So, what am I supposed to do here now? That's easy: Breed it... Since two days I'm fighting with myself not to make this joke. Thanks for relieving me... Regards Stephan -- http://mail.python.org/mailman/listinfo/python-list
[ANN] pygccxml - 0.8.5
Hello! I'm pleased to announce the 0.8.5 release of pygccxml. What is pygccxml? = ...The purpose of the GCC-XML extension is to generate an XML description of a C++ program from GCC's internal representation. -- Introduction to GCC-XML The purpose of pygccxml is to read a generated file and provide a simple framework to navigate C++ declarations, using Python classes. Where is pygccxml? == Site: http://language-binding.net/pygccxml/pygccxml.html Download: http://language-binding.net/pygccxml/download.html What's new? === Features * Added new functionality: I depend on them. Every declaration can report types and declarations it depends on. This functionality helps code generators. For example, Py++, the Boost.Python code generator, uses it to verify that all relevant declarations were exposed. * Declarations, read from GCC-XML generated file, could be saved in cache. Small features -- * New type traits have been added: * is_bool * Small improvement to algorithm, which extracts value_type ( mapped_type ) from std containers. * Few aliases to long method name were introduced. Bug fixes - * signed char and char are two different types. This bug was fixed and now pygccxml treats them right. Many thanks to Gaetan Lehmann for reporting the bug. * Fixing bug related to array size and cache. For a more complete list, please see the news: http://language-binding.net/pygccxml/history/history.html -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: an hex number problem
On Thu, 21 Dec 2006 13:33:51 +0100, [EMAIL PROTECTED] wrote: Hello, I got a number 19968: 1. how can I change it to the hex form 0x4e00, '0x%x' % 19968 2. and how can I change 0x4e00 to a python unicode character u\u4e00? unichr(19968) thank you! HTH -- python -c print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-']) -- http://mail.python.org/mailman/listinfo/python-list
[ANN] Py++ - 0.8.5
Hello! I'm pleased to announce the 0.8.5 release of Py++. What is Py++? = Py++ is an object-oriented framework for creating a code generator for Boost.Python library. Where is Py++? == Site: http://language-binding.net/pyplusplus/pyplusplus.html Download: http://language-binding.net/pyplusplus/download.html What's new? === Features * Added Function Transformation feature. This feature allows you to describe function wrapper and Py++ will do the rest. Example could be found here: http://tinyurl.com/y3ec24 * Added new functionality, which allows you to control messages and warnings. * Adding new algorithm, which controls the registration order of the functions. * Added new Py++ defined return_pointee_value call policy * Opaque types are fully supported * Py++ will check the completeness of the bindings. It will check for you that the exposed declarations don't have references to unexposed ones. Small features -- * It is possible to configure Py++ to generate faster ( compilation time ) code for indexing suite version 2. * The algorithm, which finds all class properties was improved. Now it provides a better way to control properties creation. A property that would hide another exposed declaration will not be registered\\created. * Work around for custom smart pointer as member variable Boost.Python bug was introduced. For a more complete list, please see the news: http://language-binding.net/pyplusplus/history/history.html -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: What am I supposed to do with an egg?!
Stephan Kuhagen [EMAIL PROTECTED] wrote Sebastian 'lunar' Wiesner wrote: Morpheus [EMAIL PROTECTED] wrote So, what am I supposed to do here now? That's easy: Breed it... Since two days I'm fighting with myself not to make this joke. Thanks for relieving me... No problem ;) -- Freedom is always the freedom of dissenters. (Rosa Luxemburg) -- http://mail.python.org/mailman/listinfo/python-list
Displaying contents of a file using PyWin
How do I display the contents of a file in a window using PyWin? Thanks, MS -- http://mail.python.org/mailman/listinfo/python-list
Re: Good Looking UI for a stand alone application
On 12/20/06, Vincent Delporte [EMAIL PROTECTED] wrote: On Tue, 19 Dec 2006 08:15:18 -0600, Chris Mellon [EMAIL PROTECTED] wrote: There's a few more caveats I haven't addressed, and there are places where wx isn't perfect. BTW, do you know of a good article/book on writing cross-platform GUI apps, with recommendations, pitfalls, etc. especially using wxWidgets? -- http://mail.python.org/mailman/listinfo/python-list There's a book on both wxWidgets itself, and on wxPython. Both of them focus primarily on the wx api, rather than on the more general cross platform problems. The wxWidgets book is part of Bruce Perens' open source series, and you can get the PDF from http://phptr.com/perens. The wxPython book isn't freely available, but you can order it from wxpython.org. Unfortunately, neither book points out too much in the way of pitfalls - they're mainly focussed on the API. The wxWidgets book does have a section on some common errors with conforming to platform standards and what wx can and cannot do to help. -- http://mail.python.org/mailman/listinfo/python-list
treating MIME messages
Hello all. Anybody who has idle time, please look at my version of MIME tools at http://www.fidoman.ru/prog/mime/. Questions and critical notes are welcome. If somebody will consider that interesting, I will refine these modules and put to pypi. -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] PyInstaller 1.3 released
Robin Becker wrote: Giovanni Bajo wrote: yeah that's pretty cryptic. It's a known bug which I need to come around and fix it. Anyway, the message itself is harmless: if the program then exits, there is *another* problem. If you want to help with that, you could enable the console+debug mode and see what the traceback is. I'd be very glad to fix the problem for you. No problem I'll give it a whirl tomorrow. ... OK I found the problem. First off I still see this message about msvcr71.dll could not be extracted! in the debug output. Secondly I found that the icon I specified in the Makespec.py invocation is actually being added to the distribution exe. I actually want to put the icon onto the running Tk app. We're using this code to do that self.tk.call('wm','iconbitmap', self._w, '-default', 'rptlabw.ico') ie it's assumed that the icon has been extracted into the runtime folder. I guess I either need to put the icon in as a resource or figure out some way to find the original exe and extract the icon from it. -- Robin Becker -- http://mail.python.org/mailman/listinfo/python-list
Re: Stani's Python Editor - questions
On Thu, 21 Dec 2006 07:09:54 -0500, Peter Decker [EMAIL PROTECTED] wrote: On 12/21/06, Franz Steinhaeusler [EMAIL PROTECTED] wrote: Does not work for me! I'm getting messages like this: python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed python:3255): Gtk-CRITICAL **: gtk_container_remove: assertion `GTK_IS_TOOLBARcontainer) || widget-parent == GTK_WIDGETcontainer)' failed Same similar error messages with DrPy. I would try to update to a higher wxPython version and/or reporting this to the wxPython user mailing list. FWIW, this has been reported for ages on the wxPython list. It's a bug in the Gtk implementation that generates these scary-looking warnings, but doesn't seem to cause any real problems. Sorry, I didn't find the right messages. Do you remember is is necessary to update wxpython or even other underlying software? -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] Py++ - 0.8.5
Roman Yakovenko schrieb: Hello! I'm pleased to announce the 0.8.5 release of Py++. I'm just wondering why there is a comp.lang.python.announce newsgroup. Could it be for making announcements or would that be too obvious? -- http://mail.python.org/mailman/listinfo/python-list
Question about Tkinter windows
Hi everyone, this is the first time I use Python. I'm working on an application using Tkinter and I would like that the windows could only be opened once, is there any option to get that? I don't know if I've explained myself: what I want is that if the user clicks on Options, for example, and he doesn't close the options window, even if he clicks again on the same button the window doesn't open again. Oh, I forgot, the windows are toplevel. -- http://mail.python.org/mailman/listinfo/python-list
boost::python and automatic conversion for const std::string
I have a lot of functions returning const std::string. Every time I wrap one of those I have to do it like this: class_.def(name, someclass::bla, boost::python::return_value_policyboost::python::copy_const_reference() ); Is there a way to register a return value conversion for const std::string so I can omit it every time I have to wrap functions returning const std::string ? I wan't those strings to be copied to python as new strings (I don't want to hold a pointer to them). Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Displaying contents of a file using PyWin
import win32ui from pywin.mfc import docview t = object_template() d = t.OpenDocumentFile(d:/temp/music.log, True) Crashes PythonWin -- http://mail.python.org/mailman/listinfo/python-list
Re: Displaying contents of a file using PyWin
In [EMAIL PROTECTED], MiguelS wrote: import win32ui from pywin.mfc import docview t = object_template() d = t.OpenDocumentFile(d:/temp/music.log, True) Crashes PythonWin What do you mean by `crashes`? Any chance you get a name error like:: NameError: name 'object_template' is not defined ? Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] Py++ - 0.8.5
In [EMAIL PROTECTED], Felix Benner wrote: Roman Yakovenko schrieb: Hello! I'm pleased to announce the 0.8.5 release of Py++. I'm just wondering why there is a comp.lang.python.announce newsgroup. Could it be for making announcements or would that be too obvious? Yes that's for making announcements. And usually they are posted here too. Set a filter on the subject if you don't want to read them. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Strong Unix Developers wanted to work on OO-Database at Major Bank
A premier bank in New York City is looking for strong unix developers to work on their homegrown OO-database. The ideal developer will have significant experience with one or more of a variety of languages including, Python, Perl, C++ or C. It is very important to have deep knowledge of unix and good understanding of databases. The role is focused more on exceptionally technical developers with less interest on obscure syntax or buzzword technologies. The company will happily help people relocate from anywhere in the country. Compensation will be quite good. If you are interested in the role feel free to contact me at [EMAIL PROTECTED] Thanks in advance. Best, Peter Peter Isaacs, Vice President Grady Levkov Company, Inc. 580 Broadway, Suite 1100 New York, NY 10012 v: 212-925-0900 x 106 f: 212-925-0200 [EMAIL PROTECTED] http://www.gradylevkov.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Displaying contents of a file using PyWin
Sorry, the code I posted was wrong. I tried import win32ui from pywin.mfc import docview t = docview.DocTemplate() t.OpenDocumentFile(d:/temp/music.log, True) This caused windows to close PythonWin. -- http://mail.python.org/mailman/listinfo/python-list
How a script can know if it has been called with the -i command line option?
The subject says it all, I would like a script to act differently when called as $ python script.py and when called as $ python -i script.py. I looked at the sys module but I don't see a way to retrieve the command line flags, where should I look? TIA, Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there a way to push data into Microsoft Excel Word from Python ?
Hi Paul Thanks for the kind words! No, thank _you_ for taking the time to write such a useful document. regards Caleb -- http://mail.python.org/mailman/listinfo/python-list
are there Tomboy and F-Spot equivalents?
Hi, I dislike installing the entire Mono stack simply to take notes and manage photos, and am totally biased towards Python. At least for search I got Tracker, instead of Beagle. Are there equvalents applications for Tomboy and F-Spot which are written in Python. -- http://mail.python.org/mailman/listinfo/python-list
Windows upgrade incomplete
I've a few versions of Python on my XP PC, most recently Python 2.5. The file associations appear not to have been upgraded. Executing a .py file turned out to still be using 2.3. assoc .py .py=Python.File ftype Python.file Python.file=D:\PROGRA~1\Python23\python.exe %1 %* Presumably if I'd uninstalled the old Python first I'd have not seen this. I've amended my file type associations and all is now well. Someone might care to look at the installer. I've used the MSIs since 2.4. -- Pete Forman-./\.- Disclaimer: This post is originated WesternGeco -./\.- by myself and does not represent [EMAIL PROTECTED]-./\.- the opinion of Schlumberger or http://petef.port5.com -./\.- WesternGeco. -- http://mail.python.org/mailman/listinfo/python-list
[ANNOUNCE] pygtkmvc version 1.0.0 has been released
Hi all, I'm proud to announce that the first stable release 1.0.0 of pygtkmvc has been released. ** pygtkmvc version 1.0.0 ** pygtkmvc is a fully Python-based implementation of the Model-View-Controller (MVC) and Observer patterns for the PyGTK2 toolkit. MVC is a pattern that can be successfully used to design and develop well structured GUI applications. The MVC pattern basically helps in separating semantics and data of the application from their representation. The Observer pattern helps to weaken dependencies among parts that should be separated, but need to be connected each other. pygtkmvc provides a powerful and still simple infrastructure to help designing and implement GUI applications based on the MVC and Observer patterns. ** Features ** The framework has been designed to be: - Essential and small, it does only what it was designed for. - Not an external dependency for your application: it fits in 80KB and can be released along with it. - Easy to understand and to use; fully documented. - Portable: straightly runs under many platforms. Version 1.0.0 is the first stable release. Main features are: - Observer pattern supports pythonian containers and user-defined classes. - Support for multi-threading in models. - Support for gtk models like TreeModel and TextBuffer. - Bug fixes. - Documentation and several examples are provided. ** Get it! ** Latest version and information can be found at the project home page: http://pygtkmvc.sourceforge.net License is LGPL. ** Credits ** Many thanks to: - Baruch Even baruch _AT_ ev-en.org for providing useful feedback and a pretty example. - Johannes Jordens j.jordens _AT_ ucl.ac.uk and Robert Jordens jordens _AT_ debian.org for depeloping and maintaining Debian packages. -- Roberto Cavada -- http://mail.python.org/mailman/listinfo/python-list
Re: merits of Lisp vs Python
Rob Thorpe wrote: Anders J. Munch wrote: Let u(t) be the actual memory used by the program at time t. Let r(t) be the size of reachable memory at time t. Require that u(t) is a member of O(t - max{t'=t: r(t')}) There. That wasn't so hard, was it? That's quite a clever definition actually. But, let's say I have a lisp machine. It has an unusual architecture, it's made entirely of SRAM cells of ~9bits. Sometimes these cells are used as storage, sometimes their contents represent logic circuits and the routing between them is configured to form them into a processor. Please tell me what reachable memory is ;). (The above processor is not science fiction, it could easily be done with FPGAs) Reachable memory is the set of interpreter objects (conses, closures, scopes, atoms and what have you) reachable from from some appropriately defined root set. It can be unambiguously defined with respect to a virtual machine, with no regard to how actual implementations represent these things. For actual memory use, a simple byte count would do fine. If code and data are intermingled, just use the combined size of both of them. If you're worried about comparing incompatible units, don't be: apples and oranges compare just fine under big-Oh. - Anders -- http://mail.python.org/mailman/listinfo/python-list
Re: list1.append(list2) returns None
Pyenos wrote: def enlargetable(table,col): table.append(col) # the code won't return sorted lists :-o return_the_fucking_table_bitch=table # assign it to a new variable to return it return return_the_fucking_table_bitch # :-| Maybe you were just trying to be funny, but assiging the table to another variable before returning is not only unnecessary, it accomplishes nothing. The following will do exactly the same thing as the above: [code] def enlargetable(table,col): table.append(col) return table [/code] -- http://mail.python.org/mailman/listinfo/python-list
Re: boost::python and automatic conversion for const std::string
On 21 Dec 2006 07:30:41 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have a lot of functions returning const std::string. Every time I wrap one of those I have to do it like this: class_.def(name, someclass::bla, boost::python::return_value_policyboost::python::copy_const_reference() ); Is there a way to register a return value conversion for const std::string so I can omit it every time I have to wrap functions returning const std::string ? I wan't those strings to be copied to python as new strings (I don't want to hold a pointer to them). I am not sure, you'd better ask this question o Boost.Python mailing list: http://mail.python.org/mailman/listinfo/c++-sig/ Py++, Boost.Python code generator, does it for you: http://tinyurl.com/ygwdkz -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: merits of Lisp vs Python
Anders J. Munch wrote: Rob Thorpe wrote: Anders J. Munch wrote: Let u(t) be the actual memory used by the program at time t. Let r(t) be the size of reachable memory at time t. Require that u(t) is a member of O(t - max{t'=t: r(t')}) There. That wasn't so hard, was it? That's quite a clever definition actually. But, let's say I have a lisp machine. It has an unusual architecture, it's made entirely of SRAM cells of ~9bits. Sometimes these cells are used as storage, sometimes their contents represent logic circuits and the routing between them is configured to form them into a processor. Please tell me what reachable memory is ;). (The above processor is not science fiction, it could easily be done with FPGAs) Reachable memory is the set of interpreter objects (conses, closures, scopes, atoms and what have you) reachable from from some appropriately defined root set. It can be unambiguously defined with respect to a virtual machine, with no regard to how actual implementations represent these things. Yes. For actual memory use, a simple byte count would do fine. If code and data are intermingled, just use the combined size of both of them. Well, in my example the code, the data and the processor are intermingled. Still you could do it this way. But, what would happen for example if on a normal machine someone wrote a program that generated lots of functions that it never used, would it have to be detected by the GC. This is hard to do. The solution is probably to define the root set only in terms of data. If you're worried about comparing incompatible units, don't be: apples and oranges compare just fine under big-Oh. Yes. Thank you for comprehensively out-arguing me. I'll give one last reason why it may not be a good thing to define: reference counting. Some people want to use refcounts, and believe that under certain circumstances they provide better performance than GC. I don't know if they're right, I suspect they are for some limited circumstances. A normal ref-count system can't be gauranteed to have no memory holes introduced by loops in the data. But, if the programmer causes no loops to come into being then he/she is safe. An implementation that used refcounting might not be of much general use, but for specific purposes, embedded programming for example, it might be useful. -- http://mail.python.org/mailman/listinfo/python-list
PythonCard Auto Placement
Hi All, I'm getting started with pythoncard. I'm wondering if there is any way to auto-place the gui elements that I use, so that they are all visible, and aligned? I would use the layout/resource editors, but I'm blind, so I can't see where the elements end up, and the controls for moving don't show up as usable controls in my screen reader. Any help is appreciated. Thanks Much, Brandon McGinty -- http://mail.python.org/mailman/listinfo/python-list
Re: How a script can know if it has been called with the -i command line option?
Michele Simionato schrieb: The subject says it all, I would like a script to act differently when called as $ python script.py and when called as $ python -i script.py. I looked at the sys module but I don't see a way to retrieve the command line flags, where should I look? TIA, Michele Simionato I don't know how to get the command line flags, but the variable you are interested in is this one: from ctypes import * print c_int.in_dll(pythonapi, Py_InteractiveFlag) ;-) Thomas -- http://mail.python.org/mailman/listinfo/python-list
query
can anyone help me on indentation in python and tell me some nice text editors used for a beginner in python? -- http://mail.python.org/mailman/listinfo/python-list
Re: How a script can know if it has been called with the -i command line option?
Michele Simionato wrote: The subject says it all, I would like a script to act differently when called as $ python script.py and when called as $ python -i script.py. I looked at the sys module but I don't see a way to retrieve the command line flags, where should I look? In the optparse module. Jim -- http://mail.python.org/mailman/listinfo/python-list
Re: query
[EMAIL PROTECTED] wrote: can anyone help me on indentation in python and tell me some nice text editors used for a beginner in python? You MUST tell us what platform you run on for us to make a recommendation. Remember Python runs on Windows, Linux, Mac, ... On Windows my current favorite is PyScripter available at: http://mmm-experts.com/Products.aspx?ProductId=4 Another good choice is Eclipse with Python plug-in but it is a very large application. If you do Java and other development as well as Python that might be an excellent choice. -Larry -- http://mail.python.org/mailman/listinfo/python-list
Re: How a script can know if it has been called with the -i command line option?
On Thu, 2006-12-21 at 11:22 -0800, [EMAIL PROTECTED] wrote: Michele Simionato wrote: The subject says it all, I would like a script to act differently when called as $ python script.py and when called as $ python -i script.py. I looked at the sys module but I don't see a way to retrieve the command line flags, where should I look? In the optparse module. That doesn't answer the question. The OP wants to inspect the options passed to the interpreter, not the options passed to the script. optparse aids in parsing sys.argv, which only contains the options that are passed to the script. -Carsten -- http://mail.python.org/mailman/listinfo/python-list
Re: urllib.unquote and unicode
The way that uri encoding is supposed to work is that first the input string in unicode is encoded to UTF-8 and then each byte which is not in the permitted range for characters is encoded as % followed by two hex characters. Can you back up this claim (is supposed to work) by reference to a specification (ideally, chapter and verse)? http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1 Thanks. Unfortunately, this isn't normative, but we recommend. In addition, it talks about URIs found HTML only. If somebody writes a user agent written in Python, they are certainly free to follow this recommendation - but I think this is a case where Python should refuse the temptation to guess. If somebody implemented IRIs, that would be an entirely different matter. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: query
[EMAIL PROTECTED] wrote: can anyone help me on indentation in python and tell me some nice text editors used for a beginner in python? http://effbot.org/pyfaq/tutor-whats-the-best-editor-ide-for-python /F -- http://mail.python.org/mailman/listinfo/python-list
Decorator for Enforcing Argument Types
I'm not sure if this has been done before, but I couldn't easily find any prior work on Google, so here I present a simple decorator for documenting and verifying the type of function arguments. Feedback/suggestions/criticism is welcome. ''' 2006.12.21 Created. ''' import unittest import inspect def arguments(*args): '''A simple decorator for formally documenting and verifying argument types. usage: @arguments(type1, type2, [type3.1, type3.2, ..., type3.N], type4, ..., typeN) def somefunc(arg1, arg2, arg3, arg4, ..., argN): do stuff return ''' return lambda f:_Arguments(f, *args) class _Arguments(object): # todo: extend to verify Zope interfaces def __init__(self, fn, *args): self.fn = fn # create argument type list self.arguments = [] for arg in args: if not isinstance(arg, list): arg = list([arg]) arg = set(arg) self.arguments.append(arg) # create name-to-index lookup argNames, varArgName, varkwName, defaults = inspect.getargspec(fn) assert len(argNames) == len(self.arguments), 'list of argument types must match the number of arguments' self.argNameToIndex = {} for i,name in enumerate(argNames): self.argNameToIndex[name] = i if defaults and i = len(self.arguments)-len(defaults): # add default type to allowable types self.arguments[i].add(type(defaults[i-(len(self.arguments)-len(defaults))])) def verify(self, value, i): '''Returns true if the value matches the allowable types for the ith argument.''' if not isinstance(i, int): if i not in self.argNameToIndex: raise Exception, 'unknown argument name: %s' % i i = self.argNameToIndex[i] return type(value) in self.arguments[i] def verifyAll(self, *values, **kvalues): '''Returns true if all values matche the allowable types for their corresponding arguments.''' for i,value in enumerate(values): if not self.verify(value, i): return False for name,value in kvalues.iteritems(): if not self.verify(value, name): return False return True def __call__(self, *args, **kargs): assert self.verifyAll(*args, **kargs), 'argument types must be in the form of %s' % self.arguments return self.fn(*args, **kargs) class Test(unittest.TestCase): def test(self): @arguments(str, [int, float], list) def foo(abc, xyz, big=None): return '%s %s' % (abc, xyz) self.assertEqual(type(foo), _Arguments) self.assertEqual(len(foo.arguments), 3) self.assertEqual(foo.arguments[2], set([list, type(None)])) self.assertEqual(foo.verify('how', 0), True) self.assertEqual(foo.verify(123, 0), False) self.assertEqual(foo.verify(123, 1), True) self.assertEqual(foo.verify(1.23, 1), True) self.assertEqual(foo.verifyAll('how',123), True) self.assertEqual(foo.verifyAll(123,'how'), False) self.assertEqual(foo.verifyAll(abc='how',xyz=123), True) self.assertEqual(foo.verifyAll('how',xyz=123), True) self.assertEqual(foo.verifyAll('how',xyz='oeuuo'), False) self.assertEqual(foo.verifyAll('how',xyz=123,big=None), True) self.assertEqual(foo.verifyAll('how',xyz=123,big=[1,2,3]), True) self.assertEqual(foo.verifyAll('how',123,[1,2,3]), True) self.assertEqual(foo.verifyAll('how',123,'asoenhuas'), False) self.assertTrue(foo('how',123)) self.assertTrue(foo(abc='how',xyz=123,big=None)) if __name__ == '__main__': unittest.main() -- http://mail.python.org/mailman/listinfo/python-list
Re: Decorator for Enforcing Argument Types
Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm not sure if this has been done before, but I couldn't easily find any prior work on Google, so here I present a simple decorator for documenting and verifying the type of function arguments. Feedback/suggestions/criticism is welcome. They Python wiki has a page for decorator ideas/submissions, compare yours to this one: http://wiki.python.org/moin/PythonDecoratorLibrary#head-308f2b3507ca91800def19d813348f78db34303e -- Paul -- http://mail.python.org/mailman/listinfo/python-list
GNUmed - new version released
Hello, Today we are releasing a new GNUmed version. GNUmed is a package to manage medical offices. Version is up to 0.2.3 Version features and bug fixes are explained in our Wiki http://wiki.gnumed.de/bin/view/Gnumed/ReleaseStatus http://wiki.gnumed.de/bin/view/Gnumed/RoadMap Packages available as usual for GNU/Linux and MS Windows als well as Debian packages MacOSX packages didn't make it yet due to unexplained problems with the Mac port. In general it looks like the code is getting much more stable and easier to fix and extent. Bug reports are appreciated. -- Sebastian Hilbert Leipzig / Germany [www.gnumed.de] - PGP welcome, HTML -/dev/null -- http://mail.python.org/mailman/listinfo/python-list
Re: Decorator for Enforcing Argument Types
Chris wrote: I'm not sure if this has been done before see example 4 in the original specification: http://www.python.org/dev/peps/pep-0318/#examples /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Decorator for Enforcing Argument Types
On Dec 21, 3:57 pm, Paul McGuire [EMAIL PROTECTED] wrote: Chris [EMAIL PROTECTED] wrote in messagenews:[EMAIL PROTECTED] I'm not sure if this has been done before, but I couldn't easily find any prior work on Google, so here I present a simple decorator for documenting and verifying the type of function arguments. Feedback/suggestions/criticism is welcome.They Python wiki has a page for decorator ideas/submissions, compare yours to this one:http://wiki.python.org/moin/PythonDecoratorLibrary#head-308f2b3507ca9... Thanks, I was unaware of that page. I designed mine allow for introspection, so the program can explicitly see what types a function takes and test argument combinations if need be, which that example doesn't seem to allow. Mine also supports multiple types per argument. However, I like how that one also checks the return value. Chris -- http://mail.python.org/mailman/listinfo/python-list
removing the header from a gzip'd string
Hi, I have some code that takes a string and obtains a compressed version using zlib.compress Does anybody know how I can remove the header portion of the compressed bytes, such that I only have the compressed data remaining? (Obviously I do not intend to perform the decompression!) Thanks, -- http://mail.python.org/mailman/listinfo/python-list
Re: Decorator for Enforcing Argument Types
Chris wrote: I'm not sure if this has been done before, I think this is the best implementation: http://oakwinter.com/code/typecheck/ I have never used it, but it seems well done. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
How to distribute an additional DLL to site-packages?
Dear Python experts, I am writing a python extension module that needs to link with a third-party DLL. How can I copy this DLL to the site-packages directory along with my extension modules? It seems that data_files parameter can do this, but I do not know how to get the absolute destination directory. After all, this directory is configurable. I guess I need to determine /path/to/site-package for setup( ... ext_modules = [...] data_files = [ ('/path/to/site-package', ['mydll.dll]) ] ) using something like distutil.config.get_dest_dir(). Many thanks in advance. Bo -- http://mail.python.org/mailman/listinfo/python-list
Re: removing the header from a gzip'd string
Rajarshi wrote: Hi, I have some code that takes a string and obtains a compressed version using zlib.compress Does anybody know how I can remove the header portion of the compressed bytes, such that I only have the compressed data remaining? what makes you think there's a header portion in the data you get from zlib.compress ? it's just a continuous stream of bits, all of which are needed by the decoder. (Obviously I do not intend to perform the decompression!) oh. in that case, this should be good enough: data[random.randint(0,len(data)):] /F -- http://mail.python.org/mailman/listinfo/python-list
Re: tkFileDialog closes main application
Eric Brunel wrote: BTW, why do you create a sub-class of Frame for your application? Why not create a sub-class of Tk instead? The short answer is that inhereting from Frame will allow embedding of the application in another application. A Tk() can not be embedded like this. Tk is appropriately instantiated if (and only if) __name__ == __main__ here, allowing the App to run as the main application here. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: removing the header from a gzip'd string
Rajarshi wrote: Does anybody know how I can remove the header portion of the compressed bytes, such that I only have the compressed data remaining? (Obviously I do not intend to perform the decompression!) Just curious: What's your goal? :) A home made hash function? Regards, Björn -- BOFH excuse #80: That's a great computer you have there; have you considered how it would work as a BSD machine? -- http://mail.python.org/mailman/listinfo/python-list
13 second delay using select() with Popen3()
hi all... I wrote a seemingly simple function (below) to use Popen3() and select() to run a program and capture its exit status, stdout output, and stderr output. It worked fine until the box was upgraded to Debian sarge. Now the call to select() always takes about 13 seconds before returning the first time. The delay only occurs when the function is running within a CGI program invoked by Apache (v2.2). If I run the same thing from a shell in the same environment, there is no delay. The correct result is always returned; the only problem is the 13-second delay. The command passed as cmd runs a bash script which looks at some local files and prints one line of output and then does exit 0. Python is v2.4.4 (can't use 2.5 because I am using Zope which doesn't support it yet). I would appreciate any suggestions or advice about whether I got the select loop wrong somehow, or what else might be wrong. Thanks!! Jonathan Mark --- import os, popen2, select def execCommand(cmd, mergeErrors = False): popen3 = popen2.Popen3(cmd, capturestderr = True) popen3.tochild.close() strOutput = '' strErrors = '' fdOutputFrom = popen3.fromchild.fileno() fdlistFrom = [fdOutputFrom, popen3.childerr.fileno()] while fdlistFrom: fdlistReadable, fdlistWriteable, fdlistError = select.select( fdlistFrom, [], fdlistFrom) for fd in fdlistError: raise AssertionError('file I/O error with child process') for fd in fdlistReadable: data = os.read(fd, 8192) if data: if mergeErrors or fd is fdOutputFrom: strOutput += data else: strErrors += data else: fdlistFrom.remove(fd) popen3.fromchild.close() popen3.childerr.close() return popen3.wait(), strOutput, strErrors -- http://mail.python.org/mailman/listinfo/python-list
Re: Decorator for Enforcing Argument Types
Chris a écrit : I'm not sure if this has been done before, It has... but I couldn't easily find any prior work on Google, so here I present a simple decorator for documenting and verifying the type of function arguments. Feedback/suggestions/criticism is welcome. my humble opinion Python is dynamic, and fighting against the language is IMHO a really bad idea. The only places where theres a real need for this kind of stuff are when dealing with the outside world (IOW : inputs and outputs). And then packages like formencode can do much more than mere type-checking /my humble opinion -- http://mail.python.org/mailman/listinfo/python-list
Building python C++ extension modules using MS VC++ 2005?
Dear list, I have been using mingw to build a python extension module. I had to jump through a number of hooks like the _ctype problem caused by the use of msvcr71.dll, but the module was mostly usable. Things become complicated when I use more and more boost libraries and mingw can not work well with some of the modules. I am trying to switch to VC but I was suggested that I need to use the identical version of VC that is used to build python, which means VC7.1, 2003. However, microsoft seems to stop distributing this version of VC, and its website points me to VC expression 2005... (http://msdn2.microsoft.com/en-us/visualc/aa336490.aspx) Can I use the 2005 version to build python extension? What is the official or recommended way to build python extension module under windows? Many thank in advance. Bo -- http://mail.python.org/mailman/listinfo/python-list
Why can't you use varargs and keyword arguments together?
I've always wondered why I can't do: def foo(a,b,c): return a,b,c args = range(2) foo(*args, c = 2) When you can do: foo(*args, **{'c':2}) Whenever I stub my toe on this one, I always just use the second approach, which seems less readable. As with most things in Python, I've suspected there's a good reason for it. Having just bumped into this one again, I thought I'd ask if anyone knows why the first syntax should not be allowed. This comes up anyplace you need variable arguments and keyword arguments together but don't have the keyword arguemnts in a dict. In this case you are forced to put them in a dict. I don't think anyone would find that to be more readable. Thanks and Merry Christmas, -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: Why can't you use varargs and keyword arguments together?
On 21 Dec 2006 14:51:15 -0800, Sandra-24 [EMAIL PROTECTED] wrote: I've always wondered why I can't do: def foo(a,b,c): return a,b,c args = range(2) foo(*args, c = 2) When you can do: foo(*args, **{'c':2}) You just need to turn things around: def foo(a, b, c): ... return a, b, c ... args = range(2) foo(c=2, *args) (0, 1, 2) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Decorator for Enforcing Argument Types
Bruno Desthuilliers wrote: my humble opinion Python is dynamic, and fighting against the language is IMHO a really bad idea. The only places where theres a real need for this kind of stuff are when dealing with the outside world (IOW : inputs and outputs). And then packages like formencode can do much more than mere type-checking /my humble opinion Agreed. The worst case I have seen: An elaborate decorator (similar to the OP's) laboriously checks arg types. That's IMHO not consenting adults territory. But it gets a whole lot worse when it's applied to a method whose body is like this: if isinstance( action_for_type1(... # big snip elif isinstance(... action_typeN( ... # no else statement -- http://mail.python.org/mailman/listinfo/python-list
Re: def index(self):
On 21 Dec 2006 09:44:48 GMT, Duncan Booth [EMAIL PROTECTED] wrote: George Sakkis [EMAIL PROTECTED] wrote: @expr def fn(...): ... is exactly equivalent to: def fn(...): ... fn = (expr)(fn) ok i did my homework reading about decorators http://www.python.org/doc/2.4.4/whatsnew/node6.html could it be the example above needs to be like @expr def fn(...): ... is exactly equivalent to: def fn(...): ... fn = expr(fn) oh and self stands more or less for private method right ? if you have to ask that question about 'self' you really do need to read some introductory texts on Python. Methods get passed their instance as their first parameter (usually this is implicit in the call, but it is always explicitly shown in the method) and self is simply the conventional name. Many other languages use 'this' instead of self and make the passing of 'this' implicit inside the method as well as outside. There are good reasons why it is explicit in Python, but just remember that the first parameter a method receives is always the instance and you won't go far wrong. in all the things i every read about self i end up with blablabla scoping blabla blabla self:: blablabla public static methods blablabla :) So when reading 'self' is the same as 'this' it was worth asking the question for confusion sake :) -- http://mail.python.org/mailman/listinfo/python-list
RE: Fall of Roman Empire
Hendrik van Rooyen wrote: naaah - you don't have to worry - for real control He uses assembler. with jump statements. so the loops are closed. Unfortunately its not open source. Yet. People are working hard on reverse-engineering it though. I hope no one slaps them with a DMCA-style lawsuit ... Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list
Re: python-hosting.com projects: dead?
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: [...] As of this morning my project is back online, so my thanks to python hosting/webfaction for that. I'm very grateful to them for the great free service they have provided. I'm sorry that they are getting killed with spam, but I'm also sorry that they chose to handle the problem in the way that they did. I had no way of knowing when I'd have access to my svn repository and tickets again. I'm sure you can understand why I was dismayed by this and why, unfortunately, I'll never be comfortable trusting my data to them again. As a user of webfaction's commercial web hosting services, I'm glad that they took the responsible action they did to stop spammers affecting those services. Frankly, as a user of a free service, I don't think you have the right to demand an instant response -- though it seems they provided just that to some such users. What you wrote above is a fairly drastic over-reaction. If you need more reliable service, then pay for hosting. Worse, your words would not be much different if they had been calculated to punish the very people trying to help you (I don't say for a moment that was your intent of course!). Like all of us who post messages on the internet wink, I'm sure you'll now go and think about it for a day before hitting 'reply' again. John -- http://mail.python.org/mailman/listinfo/python-list
Re: list1.append(list2) returns None
At Thursday 21/12/2006 14:50, Matimus wrote: The following will do exactly the same thing as the above: [code] def enlargetable(table,col): table.append(col) return table [/code] Which, by the way, was one of the first answers he got, by Edward Kozlowski. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: [ANN] PyInstaller 1.3 released
Robin Becker wrote: OK I found the problem. First off I still see this message about msvcr71.dll could not be extracted! in the debug output. Secondly I found that the icon I specified in the Makespec.py invocation is actually being added to the distribution exe. I actually want to put the icon onto the running Tk app. We're using this code to do that self.tk.call('wm','iconbitmap', self._w, '-default', 'rptlabw.ico') ie it's assumed that the icon has been extracted into the runtime folder. I guess I either need to put the icon in as a resource or figure out some way to find the original exe and extract the icon from it. If you specify it as icon (--icon to Makespec), it means you want it as icon of the executable. If you just want to add it as an additional data file, read the manual about that. It will be extracted to the runtime directory and you should be able to access it through _MEIPASS2 (manual should be clear about that). You can't just read it from the current directory because the current directory is where your exectuable is run (which could even be off a CDROM...). -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list
Re: regular expression
Asper Faner wrote: I seem to always have hard time understaing how this regular expression works, especially how on earth do people bring it up as part of computer programming language. Natural language processing seems not enough to explain by the way. Why no eliminate it ? It has very much to do with computer programming. There is program flow, conditions, loops, variables. Roman -- http://mail.python.org/mailman/listinfo/python-list
Re: Building python C++ extension modules using MS VC++ 2005?
You can use 2005 to build extensions for Python 2.5. I've done this with several extensions, both my own and others. I do not know if you can use it for Python 2.4, so I won't advise you on that. I thought Microsoft made its C/C++ compiler, version 7.1 (2003) freely available as a command line tool. If you can't find it on their site, ask around, I'm sure a lot of people have it. Probably you'll also find someone has put it up somewhere if you search on google. Try 2005 first and see what happens though. -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: Why can't you use varargs and keyword arguments together?
On Dec 21, 5:59 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote: You just need to turn things around: def foo(a, b, c): ... return a, b, c ... args = range(2) foo(c=2, *args) (0, 1, 2) You know, I feel like a real shmuck for not trying that... Thanks! -Sandra -- http://mail.python.org/mailman/listinfo/python-list
Re: regular expression
Also regular expressions are (pretty much) universal accross a ton of languages... even search engines now provide some support for regular expressions... I know its a bit of a headache, but keep trying to learn it mate. Once you have it wrapped you will never look back. Adam - http://www.aejw.com/?page=contact Roman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Asper Faner wrote: I seem to always have hard time understaing how this regular expression works, especially how on earth do people bring it up as part of computer programming language. Natural language processing seems not enough to explain by the way. Why no eliminate it ? It has very much to do with computer programming. There is program flow, conditions, loops, variables. Roman -- http://mail.python.org/mailman/listinfo/python-list
Re: Building python C++ extension modules using MS VC++ 2005?
Sure you can build extensions for Python2.4 with VS2005, I've always done this way. And with Pyrex it is very very easy. Make sure to have a look at Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex -- http://mail.python.org/mailman/listinfo/python-list
Re: tkFileDialog closes main application
Thanks for the reply. I used your modified code to test. I ran the code on Windows Python 2.4 tcl/tk 8.4. When I opened the ui I: 1) click browse button 2) file dialog opens and I double click the file. When I do this, the selected file path is entered in Entry field. I don't need to close dialog, it closes automatically. 3) click browse button again 4) double click file 5) repeat sometimes it only takes one time to kill root, sometimes a few more. After I killed root with the double clicks I then tried with a click browse - select file - click open button very slowly making sure I didn't double click and the same thing happened - root was destroyed. BTW, with your modified code, the Closed by the WM was not displayed to console. Hmmm? I think this must just be peculiar to Windows. Can any other windows users test to see if they can reproduce? thanks again for your response. Eric Brunel wrote: On Wed, 20 Dec 2006 18:37:10 +0100, mdmdmd [EMAIL PROTECTED] wrote: Hello, I wish to collect 4 files from a user. So I have decided to use tkFileDialog askopenfilename. My problem is that after a few file selections the root window is destroyed (the whole program just dissappears) I tested the code below on Linux with Python 2.1 and tcl/tk 8.3.4 and it works perfectly. I have created a simple example and was able to reproduce the same thing with this. I've just started using tkinter so I have no idea what I may be doing wrong. If anyone has any ideas please let me know. If you run the following code, just click the Browse button, and select a file. Do this repeatedly and for me after the sixth or seventh time the window shuts down. Is there any error when this happens? Have you tried running your script from a DOS command window? BTW, I'm using python 2.4 on Windows XP. Thank you for any help. How do you select your files? I occasionally see problems on Windows when a window is closed via a double-click: the last 'button release' event for the double-click is not consumed by the dialog, but sent to the window behind it. Could it be what happens? If you select your files with a double-click and if the mouse cursor just happens to be on the close button for your main window behind it, you may involuntarily close the main window when selecting the file. Please try to select the files and then press the 'Open' button to see if the problem still happens. Here is a tiny modification to your code to print a message when the window is closed via its close button: from Tkinter import * import Pmw import tkFileDialog import os.path filepath = 'C:\\Documents and Settings\\admin\\Desktop\\' class App(Frame): def __init__(self,master): Frame.__init__(self, master, bg='gray') self.enttxt = StringVar() lbl = Label(self,text='File 1:') lbl.grid(row = 0,column = 0,sticky = W,padx = 5,pady = 5) self.e1 = Entry(self,textvariable = self.enttxt,width = 50) self.e1.grid(row = 0,column = 1,columnspan = 3,sticky = W,padx = 5,pady = 5) btn = Button(self,text='Browse ...',width = 12, command = self.browse) btn.grid(row = 0,column = 4,sticky=W,padx=5,pady=5) master.protocol('WM_DELETE_WINDOW', self.doQuit) def doQuit(self): print 'Closed by the WM!' self.quit() def browse(self): fileformats = [('Text File ','*.csv'), ('All Files ','*.*')] retval = tkFileDialog.askopenfilename(title='Choose File', initialdir=filepath, filetypes=fileformats, parent = self) if retval: self.enttxt.set(os.path.abspath(retval)) def main(): root = Tk() root.withdraw() root.title('test') root.configure(bg='gray') app = App(root) app.pack() root.update() root.deiconify() root.mainloop() if __name__ == '__main__': main() BTW, why do you create a sub-class of Frame for your application? Why not create a sub-class of Tk instead? HTH -- http://mail.python.org/mailman/listinfo/python-list
Re: Displaying contents of a file using PyWin
[Forwarded from [EMAIL PROTECTED] At Thursday 21/12/2006 13:51, MiguelS wrote: import win32ui from pywin.mfc import docview t = docview.DocTemplate() t.OpenDocumentFile(d:/temp/music.log, True) This caused windows to close PythonWin. This appears to be a problem with pywin32. Using release 209 for Python 2.4 I get an Access Violation. Also I've noticed that this idiom: try: win32ui.GetApp().RemoveDocTemplate(template) except NameError: # haven't run this before - that's ok pass doesn't work anymore because RemoveDocTemplate raises a different exception now. -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
Re: PythonCard Auto Placement
Brandon McGinty wrote: Hi All, I'm getting started with pythoncard. I'm wondering if there is any way to auto-place the gui elements that I use, so that they are all visible, and aligned? I would use the layout/resource editors, but I'm blind, so I can't see where the elements end up, and the controls for moving don't show up as usable controls in my screen reader. Any help is appreciated. Thanks Much, Brandon McGinty The first part to your quesion is easy. Pythoncard uses a very simple resource file format (just a plain vanilla Python dictionary) and so one can simply write a Python that outputs the resource file and automate the process. The second part to your question might be harder. Are you saying the Pythoncard controls don't show up as usable controls in your screen reader, or the ones in the resource editor? If it's the latter, you can simply use the method I described and automatically create the resource file. I am very familiar with Pythoncard and don't mind helping if I can but I don't have any experience with screen reader. -- http://mail.python.org/mailman/listinfo/python-list
Re: removing the header from a gzip'd string
At Thursday 21/12/2006 18:32, Fredrik Lundh wrote: Hi, I have some code that takes a string and obtains a compressed version using zlib.compress Does anybody know how I can remove the header portion of the compressed bytes, such that I only have the compressed data remaining? what makes you think there's a header portion in the data you get from zlib.compress ? it's just a continuous stream of bits, all of which are needed by the decoder. No. The first 2 bytes (or more if using a preset dictionary) are header information. The last 4 bytes are for checksum. In-between lies the encoded bit stream. Using the default options (deflate, default compression level, no custom dictionary) will make those first two bytes 0x78 0x9c. If you want to encrypt a compressed text, you must remove redundant information first. Knowing part of the clear message is a security hole. Using an structured container (like a zip/rar/... file) gets worse because the fixed (or guessable) part is longer, but anyway, 2 bytes may be bad enough. See RFC1950 ftp://ftp.isi.edu/in-notes/rfc1950.txt -- Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas -- http://mail.python.org/mailman/listinfo/python-list
I am taking a programming performance match!
Hi all, The question is like this: = One computer, 2 ethernet adapter. Receving UDP packages and send them out throught another adapter. The one who's program could support the heavies traffic could win a little bonus. = I am considerring trying twited. Is it suitable for this kind of job? -- http://mail.python.org/mailman/listinfo/python-list
Re: I am taking a programming performance match!
I'm sure it could do the job, but if the sole function is to be an IO relay, I would use a lower level language like C. Cheers, -T 一首诗 wrote: Hi all, The question is like this: = One computer, 2 ethernet adapter. Receving UDP packages and send them out throught another adapter. The one who's program could support the heavies traffic could win a little bonus. = I am considerring trying twited. Is it suitable for this kind of job? -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there any python-twisted tutorial or texts?
I want to study twisted of python . But I donot know how to start. Any suggistions? There is a book about using Twisted. It's called 'Twisted Network Programming Essentials.' It is an entry-level book at best, but it does go over quite a lot of things that the Twisted library is capable of. Well, the book is not that good. It completely fails to explain deferreds which are a central concept in Twisted. I only understood deferreds when watching Bob Ippolitos screencast about Mochikit which implements the same API as Twisted... Then I got back to the Twisted book. I think it needs more work. -- damjan -- http://mail.python.org/mailman/listinfo/python-list
Problem in using Pulp
Hi, I am trying to run the following example which uses PULP for linear optimization. But I am getting this error in the last line: EOL while scanning single quoted string. Can anyone help me with this? thanks Amit --Code from pulp import * prob = LpProblem(linear, LpMinimize) # Variables x = LpVariable(x, 0, 4) y = LpVariable(y, -1, 1) z = LpVariable(z, 0) # Objective prob += x + 4*y + 9*z # Constraints prob += x+y = 5 prob += x+z = 10 prob += -y+z == 7 GLPK(C:\Documents and Settings\Amit\Desktop\glpk-4.9\glpk-4.9\examples\).solve(prob) -- http://mail.python.org/mailman/listinfo/python-list
RE: [python-win32] Displaying contents of a file using PyWin
Hi Gabriel, [Forwarded from [EMAIL PROTECTED] At Thursday 21/12/2006 13:51, MiguelS wrote: import win32ui from pywin.mfc import docview t = docview.DocTemplate() t.OpenDocumentFile(d:/temp/music.log, True) This caused windows to close PythonWin. This appears to be a problem with pywin32. Using release 209 for Python 2.4 I get an Access Violation. It was attempting to set a Python error without the GIL held. I've fixed that - it now results in: win32ui: PyCDocument::OnOpenDocument handler does not exist. Using: t.OpenDocumentFile(None) Opens a document - I'm afraid I can't recall the MFC semantics here at the moment. Also I've noticed that this idiom: try: win32ui.GetApp().RemoveDocTemplate(template) except NameError: # haven't run this before - that's ok pass doesn't work anymore because RemoveDocTemplate raises a different exception now. I can't recall any change I made that would account for that. I'm assuming that the NameError comes from 'template' which is yet to be assigned - but in that case RemoveDocTemplate should not be called as the NameError happens before. I don't recall (and grep doesn't show) that pythonwin ever raises this exception. Mark -- http://mail.python.org/mailman/listinfo/python-list