TypeCheck vs IsInstance in C API
I'm examining the C API, and I have a question. http://docs.python.org/api/object.html There are two functions that appear to do nearly same thing, and I just want to be certain I'm not missing something. First is PyObject_IsInstance: int PyObject_IsInstance(PyObject *inst, PyObject *cls); Returns 1 if inst is an instance of the class cls or a subclass of cls, or 0 if not... Second is PyObject_TypeCheck: int PyObject_TypeCheck(PyObject *o, PyTypeObject *type); Return true if the object o is of type type or a subtype of type... Now, I can see that IsInstance can take a tuple as the second argument and check the type of the first argument against every item in the tuple. I also see that TypeCheck was added in version 2.2. Why was it added? Its functionality already seems covered by IsInstance. Is it a new-style vs. old-style class thing? -Kirk McDonald -- http://mail.python.org/mailman/listinfo/python-list
Re: TIming
Tue, 2006-05-30 at 00:23 -0500, WIdgeteye wrote: > On Tue, 30 May 2006 04:34:03 +, Tim Roberts wrote: > > > WIdgeteye <[EMAIL PROTECTED]> wrote: > >>HI, > >>I am trying to write a little program that will run a program on scedule. > >>I am having trouble understanding the datetime, time, sched modules. What > >>I would like is something like this: > >> > >>If date&time = 06-13-2006:18:00:00 > >>Then run this program > >> > >>I am not sure how to enter a future date in this equation using any of > >>the modules mentioned above. I have figured out how to get the date and > >>time from the modules above but not the future and then compare the two. > > > > What operating system are you using? Both Linux and Windows have commands > > that can do this for you. It's more efficient to use existing operating > > system services than to invent your own. > > > > Also, remember to take into account the possibility that your program > > might not check the time at the exact second. In your example, you need > > to be prepared to start your app if the time is just PAST 6 PM on June 13. > > I am using Linux and could use cron. But I want to be able to > schedule and record television shows on her. And yeah I know about > freevo but it's way to complicated than it needs to be. > > So back to the question: How can I get a 9 position tuple from > the time functions in Python based on a future date. Tim Roberts is right. As you are on linux, I suggest you investigate the at command - very user friendly and not at all complicated. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- http://mail.python.org/mailman/listinfo/python-list
Re: Large Dictionaries
Roy Smith wrote: > My guess would be that each resize grows the table by a constant > factor, which IIRC, works out to amortized O(n). Right. For <5 entries, the size is multiplied by 4 each time, and doubled each time for large dictionaries. > It's not as good as > creating the dict the right size in the first place, but it's really > not that bad. Somewhat more troubling is that it can lead to memory > fragmentation problems. Depends on your operating system, of course. You get over a page size fairly quickly, and then many systems use anonymous mappings, where a range of pages gets mapped from swap on allocation, and unmapped on deallocation. So while this can cause address space fragmentation, it doesn't cause memory fragmentation (i.e. memory that is allocated by the process but can't be used). > I don't understand why Python doesn't have a way to give a size hint > when creating a dict. It seems so obvious to be able to say "d = dict > (size=10*1000*1000)" if you know beforehand that's how many keys > you're going to add. There is no need for it. If dicts don't work well in some cases, these cases should be investigated and fixed, instead of working around the problem by loading the problem onto the developer. As you said, it *should* have linear time, with the number of insertions. If it doesn't (and it appears not to), that may be due to hash collisions, or due to the time for computing hashes not being constant. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: TIming
On Tue, 30 May 2006 04:34:03 +, Tim Roberts wrote: > WIdgeteye <[EMAIL PROTECTED]> wrote: >>HI, >>I am trying to write a little program that will run a program on scedule. >>I am having trouble understanding the datetime, time, sched modules. What >>I would like is something like this: >> >>If date&time = 06-13-2006:18:00:00 >>Then run this program >> >>I am not sure how to enter a future date in this equation using any of >>the modules mentioned above. I have figured out how to get the date and >>time from the modules above but not the future and then compare the two. > > What operating system are you using? Both Linux and Windows have commands > that can do this for you. It's more efficient to use existing operating > system services than to invent your own. > > Also, remember to take into account the possibility that your program > might not check the time at the exact second. In your example, you need > to be prepared to start your app if the time is just PAST 6 PM on June 13. I am using Linux and could use cron. But I want to be able to schedule and record television shows on her. And yeah I know about freevo but it's way to complicated than it needs to be. So back to the question: How can I get a 9 position tuple from the time functions in Python based on a future date. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ricerca Programmatore Python
Edward Elliott <[EMAIL PROTECTED]> wrote: > Scott David Daniels wrote: > > > I understand there is an Italian-language Python group, but _here_ > > the language is English, even if you begin by an apology in English. > > ... In consideration for such people, please limit yourself to English. > > I doubt he'll ever see your reprimand, looks like a hit-and-run job. Too Hmmm, doesn't look like that to me -- he also posted to the Italian group (correctly in that case, since it.comp.lang.python DOES welcome Python job offers in Italian), got responses offering existing free software to do multigraphs, followed up explaining he knows about those programs but (being a non-programmer with what he thinks is a good idea) still need a contract Python programmer to work on it, etc, etc. Sounds like a person with likely good intentions that's clueless about non-English posts (and apparently job offers) being unwelcome to this newgroup (and about netiquette more generally -- reading groups' charters before posting, etc). About job offers -- I got my current (dream!) job through a long chain of circumstances which DID begin with somebody posting a job offer to this group... so, I can't honestly sympathize with the distaste that some have expressed about seeing (relevant!-) job offers here (yeah, there ARE better venues, admittedly -- but some of us dinosaurs read newsgroups regularly but check out such sites only once in a while, and only when specifically LOOKING for a job, which at the time of that post that eventually got me a job, I definitely wasn't...;-). Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: TIming
WIdgeteye <[EMAIL PROTECTED]> wrote: >HI, >I am trying to write a little program that will run a program on >scedule. I am having trouble understanding the datetime, time, sched >modules. What I would like is something like this: > >If date&time = 06-13-2006:18:00:00 >Then run this program > >I am not sure how to enter a future date in this equation using any >of the modules mentioned above. I have figured out how to get the date >and time from the modules above but not the future and then compare >the two. What operating system are you using? Both Linux and Windows have commands that can do this for you. It's more efficient to use existing operating system services than to invent your own. Also, remember to take into account the possibility that your program might not check the time at the exact second. In your example, you need to be prepared to start your app if the time is just PAST 6 PM on June 13. -- - Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Weekly Python Patch/Bug Summary
Patch / Bug Summary ___ Patches : 375 open ( -3) / 3264 closed (+26) / 3639 total (+23) Bugs: 910 open ( +3) / 5851 closed (+20) / 6761 total (+23) RFE : 217 open ( -1) / 220 closed ( +3) / 437 total ( +2) New / Reopened Patches __ Minor Correction to urllib2 HOWTO (2006-05-20) CLOSED http://python.org/sf/1492147 opened by Mike Foord None missing from keyword module (2006-05-20) CLOSED http://python.org/sf/1492218 opened by iga Seilnacht Socket-object convenience function: getpeercred(). (2006-05-20) http://python.org/sf/1492240 opened by Heiko Wundram urllib2 HOWTO - Further (minor) Corrections (2006-05-20) CLOSED http://python.org/sf/1492255 opened by Mike Foord Windows CE support (part 1) (2006-05-21) CLOSED http://python.org/sf/1492356 opened by Luke Dunstan Windows CE support (part 2) (2006-05-27) http://python.org/sf/1495999 opened by Luke Dunstan Unification of list-comp and for syntax (2006-05-21) http://python.org/sf/1492509 opened by Heiko Wundram distinct error type from shutil.move() (2006-05-22) http://python.org/sf/1492704 opened by Zooko O'Whielacronx Improvements to ceval.c (2006-05-22) http://python.org/sf/1492828 opened by mrjbq7 Speed up gzip.readline (~40%) (2005-09-04) CLOSED http://python.org/sf/1281707 reopened by marumari Speed up gzip.readline (~40%) (2005-09-04) CLOSED http://python.org/sf/1281707 reopened by marumari Allow build without tracing (2006-05-22) CLOSED http://python.org/sf/1493102 opened by Steve Holden Performance enhancements for struct module (2006-05-23) CLOSED http://python.org/sf/1493701 opened by Bob Ippolito Documentation for new Struct object (2006-05-24) http://python.org/sf/1494140 opened by Bob Ippolito PyUnicode_Resize cannot resize shared unicode object (2006-05-25) CLOSED http://python.org/sf/1494487 opened by Hirokazu Yamamoto Numeric characters not recognized. (2006-05-24) CLOSED http://python.org/sf/1494554 opened by Anders Chrigström BaseWidget.destroy updates master's childern too early (2006-05-24) http://python.org/sf/1494750 opened by Greg Couch Scalable zipfile extension (2003-09-27) CLOSED http://python.org/sf/813436 reopened by jafo Remove types.InstanceType and new.instance (2006-05-26) CLOSED http://python.org/sf/1495675 opened by Collin Winter Fix test_exceptions.py (2006-05-27) http://python.org/sf/1496135 opened by Collin Winter urllib2 HTTPPasswordMgr: default ports (2006-05-28) CLOSED http://python.org/sf/1496206 opened by John J Lee Convert Tkinter to METH_VARARGS style (2006-05-29) http://python.org/sf/1496952 opened by Georg Brandl deprecate METH_OLDARGS (2006-05-29) CLOSED http://python.org/sf/1496957 opened by Georg Brandl urllib2: ensure digest auth happens in preference to basic (2006-05-29) CLOSED http://python.org/sf/1497027 opened by John J Lee Let dicts propagate the exceptions in user __eq__ (2006-05-29) http://python.org/sf/1497053 opened by Armin Rigo Patches Closed __ Minor Correction to urllib2 HOWTO (2006-05-21) http://python.org/sf/1492147 closed by quiver None missing from keyword module (2006-05-20) http://python.org/sf/1492218 closed by gbrandl urllib2 HOWTO - Further (minor) Corrections (2006-05-21) http://python.org/sf/1492255 closed by quiver Windows CE support (part 1) (2006-05-21) http://python.org/sf/1492356 closed by loewis PC new-logo-based icon set (2006-05-17) http://python.org/sf/1490384 closed by loewis Cleaned up 16x16px icons for windows. (2006-05-03) http://python.org/sf/1481304 closed by loewis property to get the docstring from fget (2004-08-08) http://python.org/sf/1005461 closed by gbrandl Speed up gzip.readline (~40%) (2005-09-04) http://python.org/sf/1281707 closed by etrepum Speed up gzip.readline (~40%) (2005-09-04) http://python.org/sf/1281707 closed by etrepum Speed up gzip.readline (~40%) (2005-09-04) http://python.org/sf/1281707 closed by etrepum scary frame speed hacks (2004-01-13) http://python.org/sf/876206 closed by tim_one Allow build without tracing (2006-05-22) http://python.org/sf/1493102 closed by gbrandl MacOSX: distutils support for -arch and -isysroot flags (2006-05-13) http://python.org/sf/1488098 closed by ronaldoussoren Performance enhancements for struct module (2006-05-23) http://python.org/sf/1493701 closed by etrepum Fix for int(string, base) wrong answers (take 2) (2005-10-24) http://python.org/sf/1335972 closed by tim_one remove 4 ints from PyFrameObject (2005-10-25) http://python.org/sf/1337051 closed by tim_one PyUnicode_Resize cannot resize shared unicode object (2006-05-24) http://python.org/sf/1494487 closed by doerwalter Numeric characters n
Re: How to use tk.call ?
>> self.table.bind("",self.table.tk.call(self.table._w,'yview','scroll',-5,'units') >I haven't used Table, but are you sure that what you are calling >"self.table" here actually has mouse focus? >James Yup, I click on the table, and then frantically work the mouse wheel to no effect... Jerry -- http://mail.python.org/mailman/listinfo/python-list
Re: Watching serial port activity.
I'm using linux. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to calc easier the "long" filesize from nFileSizeLow and nFileSizeHigh
Shift nFileSizeHigh by 32 and add FileSizeLow. Roger "DurumDara" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi ! > > I get the file datas with FindFilesW. > I want to calc the filesize from nFileSizeLow and nFileSizeHigh with easiest > as possible, without again calling os.getsize(). > How to I do it ? I need good result ! > > Thanx for help: > dd == Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News== http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- -- http://mail.python.org/mailman/listinfo/python-list
Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional
"Luis M. González" <[EMAIL PROTECTED]> wrote: > I didn't know it wasn't a free ebook. I realized it once I downloaded > it. > But it's such a good book that I decided to buy a hard copy. > This way I will support its author, while getting a very good book on > Python. :-D Sounds much better. -- John MexIT: http://johnbokma.com/mexit/ personal page: http://johnbokma.com/ Experienced programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html -- http://mail.python.org/mailman/listinfo/python-list
wait() on Popen4 object from thread?
I'm having problems calling the Popen4 object wait() method from a thread. The folloing program produces an error on some machines (but seems to work on others) --8<-- import time import threading import popen2 def monitorThread(): while True: s = p.fromchild.readline() if s: print s else: print p.wait() watching = False break watching = True p = popen2.Popen4('mplayer -quiet -slave test.avi') threading.Thread(target=monitorThread).start() while watching: time.sleep(0.1) --8<-- Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap self.run() File "/usr/lib/python2.4/threading.py", line 422, in run self.__target(*self.__args, **self.__kwargs) File "testit.py", line 11, in monitorThread print p.wait() File "/usr/lib/python2.4/popen2.py", line 94, in wait pid, sts = os.waitpid(self.pid, 0) OSError: [Errno 10] No child processes Is it a requirement that the Popen4 object's wait method be called from the same thread that created it? Why does it work on one machine: Python 2.4.2 (#1, May 7 2006, 17:58:05) [GCC 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. But not on another: Python 2.4.2 (#1, May 7 2006, 17:34:02) [GCC 3.4.5 (Gentoo 3.4.5-r1, ssp-3.4.5-1.0, pie-8.7.9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. -- Grant Edwards [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Watching serial port activity.
On 2006-05-30, xkenneth <[EMAIL PROTECTED]> wrote: >I'm writing a couple python applications that use the serial port > (RS-232) quite extensively. Is there any way I can monitor all activity > on the serial port and have it printed as the transactions occur? I'm > trying to reverse engineer a microcontroller serial routine and I'd > like to see any response the chip sends back. What OS? Under windows you can use portmon from sysinternals. I don't think there's anything for Linux. I've noclue about OS X. -- Grant Edwards [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: How to use tk.call ?
[EMAIL PROTECTED] wrote: > > I can't find how too use tk.call, can anyone give me a clue as to how > to > solve my problem? py> from Tkinter import * py> tk = Tk() py> tk.tk py> tk.tk.call Also, any widget should have a tk (which has a call): py> b = Button(tk, text='button') py> b.tk py> b.tk.call > I have tried the following: > > self.table.bind("",self.table.tk.call(self.table._w,'yview','scroll',-5,'units') I haven't used Table, but are you sure that what you are calling "self.table" here actually has mouse focus? 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: Any other config parsing modules besides ConfigParser ?
Arthur> Are there any other good config parser modules for python? I am Arthur> looking for something a bit more versatiles than ConfigParser. You'll need to evaluate the candidates, but this might be a useful place to start looking: http://wiki.python.org/moin/ConfigParserShootout Skip -- http://mail.python.org/mailman/listinfo/python-list
Watching serial port activity.
Hi, I'm writing a couple python applications that use the serial port (RS-232) quite extensively. Is there any way I can monitor all activity on the serial port and have it printed as the transactions occur? I'm trying to reverse engineer a microcontroller serial routine and I'd like to see any response the chip sends back. Regards, Ken -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
John Machin wrote: > On 29/05/2006 10:47 PM, Serge Orlov wrote: > > Maybe urllib2 in > > python 2.4 reports to the server that it supports compressed data but > > doesn't decompress it when receives the reply? > > > > Something funny is happening here. Others reported it working with 2.4.3 > and Rocco's original code as posted in this thread -- which works for me > on 2.4.2, Windows XP. It "works" for me too, returning raw uncompressed data. > There was one suss thing about Rocco's problem description: > First message ended with d=takefeed(url) > But next message said print rss > Is rss == d? Nope. If you look at html tags, 2.3 code returns ... whereas 2.4 code returns... That may explain why 2.3 result is not compressed and 2.4 result is compressed, but that doesn't explain why 2.4 *is* compressed. I looked at python 2.4 httplib, I'm sure it's not a problem, quote from httplib: # we only want a Content-Encoding of "identity" since we don't # support encodings such as x-gzip or x-deflate. I think there is a web accellerator sitting somewhere between Rocco and Google server that is confused that Rocco is "misinforming" web server saying he's using Firefox, but at the same time claiming that he cannot handle compressed data. That's why they teach little kids: don't lie :) -- http://mail.python.org/mailman/listinfo/python-list
Re: How to calc easier the "long" filesize from nFileSizeLow and nFileSizeHigh
On 30/05/2006 1:40 AM, DurumDara wrote: > Hi ! > > I get the file datas with FindFilesW. > I want to calc the filesize from nFileSizeLow and nFileSizeHigh with > easiest as possible, without again calling os.getsize(). > How to I do it ? I need good result ! > > Thanx for help: > dd Hello, *again*, dd Well I've never heard of this caper before but what I'd do would be a Google search for e.g. nFileSizeHigh and read the first few articles ... in particular the first one which warns about bulldust on the MS website :-) HTH, John P.S. You have heard of Google, haven't you? -- http://mail.python.org/mailman/listinfo/python-list
Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional
I didn't know it wasn't a free ebook. I realized it once I downloaded it. But it's such a good book that I decided to buy a hard copy. This way I will support its author, while getting a very good book on Python. Luis -- http://mail.python.org/mailman/listinfo/python-list
TIming
HI, I am trying to write a little program that will run a program on scedule. I am having trouble understanding the datetime, time, sched modules. What I would like is something like this: If date&time = 06-13-2006:18:00:00 Then run this program I am not sure how to enter a future date in this equation using any of the modules mentioned above. I have figured out how to get the date and time from the modules above but not the future and then compare the two. Any help appreciated. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
On 30/05/2006 12:44 AM, Rocco wrote: > Thanks Serge. > It's a gzip string. Look, Ma, no gzip!!! C:\junk>rocco_rss.py 'NF E/1.0type rocco_rss.py import urllib2 def takefeed(url): request=urllib2.Request(url) request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Win dows NT') opener = urllib2.build_opener() data=opener.open(request).read() return data url='http://news.google.it/?output=rss' d=takefeed(url) print repr(d[:100]) -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
On 29/05/2006 10:47 PM, Serge Orlov wrote: > Rocco wrote: >> Also with ascii the function does not work. > > Well, at least you fixed misconfiguration ;) > > Googling for 1F8B (that's two first bytes from your strange python 2.4 > result) gives a hint: it's a beginning of gzip stream. Well done! > Maybe urllib2 in > python 2.4 reports to the server that it supports compressed data but > doesn't decompress it when receives the reply? > Something funny is happening here. Others reported it working with 2.4.3 and Rocco's original code as posted in this thread -- which works for me on 2.4.2, Windows XP. There was one suss thing about Rocco's problem description: First message ended with d=takefeed(url) But next message said print rss Is rss == d? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list
Re: Is anybody knows about a linkable, quick MD5/SHA1 calculator library ?
On 30/05/2006 2:57 AM, DurumDara wrote: > Hi ! > > I need to speedup my MD5/SHA1 calculator app that working on > filesystem's files. > I use the Python standard modules, but I think that it can be faster if > I use C, or other module for it. > > I use FSUM before, but I got problems, because I "move" into "DOS area", > and the parameterizing of outer process maked me very angry (not working). > You will see this in this place: > http://mail.python.org/pipermail/python-win32/2006-May/004697.html > > So: I must handle unicode filenames. I think that if I find a library > that can working with py's unicode chars, and I can load and use it to > hash files, the code be better, and faster. > > Anybody knows about same code ? > > Py2.4, Windows, Py2Exe, wxPy... That was the specification. > Hello (again), dd ... As the effbot has said, the Python md5 and sha modules are written in C. Hints: (1) the helpfile index says "builtin module" (2) you don't find a sha.py or md5.py in c:\Python24\Lib\ An md5/sha library will concern itself with strings (which you obtain from a file's *contents*), just like Python's modules do. Any struggle with Unicode characters in the *names* of files is a separate concern. Let's all stop worrying about low-level things like getting the 8.3 filename so that you can pass it to an MS-DOS program, and let's try to explore why you think there is a problem with your initial approach. At the end of this posting is a very simple Python function that calculates the hash of a file (and its length), given the name of the file (str or unicode, doesn't matter), which hashing module to use, and a blocksize to use when reading. There is a really flash :-) user interface that allows you to try it with either a glob pattern "*.txt", or (as glob doesn't grok Windows mbcs/unicode filenames) a single utf8-encoded filename. Please try it out. My expectation is that, with a suitable choice of blocksize, you will not be able to find anything that is significantly faster and won't be difficult to interface to (like the FSUM program!). If you have any problems or more questions, please don't hesitate to ask. HTH, John === function and driver === C:\junk>type hashtestbed.py def hash_of_file(hash_module, fname, block_size): f = open(fname, 'rb') hashobj = hash_module.new() filesize = 0 while True: block = f.read(block_size) if not block: break filesize += len(block) hashobj.update(block) f.close() return (filesize, hashobj.digest()) def to_hex(s): return ''.join('%02x' % ord(c) for c in s) if __name__ == "__main__": import sha, md5, time, sys, glob # print sys.argv mdlname = sys.argv[1] mdl = {'sha': sha, 'md5': md5}[mdlname] szs = sys.argv[2].lower() factor = {'m': 1024*1024, 'k': 1024}.get(szs[-1], 1) if factor == 1: bsz = int(szs) else: bsz = int(szs[:-1]) * factor filearg = sys.argv[3] if filearg.startswith("'"): # repr(single filename, encoded in utf8) filenames = [eval(filearg).decode('utf8')] # print filenames else: filenames = glob.glob(sys.argv[3]) # I'm entering the above for the "Best UI of the Year" award :-) for fn in filenames: t0 = time.time() fsz, digest = hash_of_file(mdl, fn, bsz) seconds = time.time() - t0 print "%s, %r, bksz %d: %d bytes," \ " %.2f secs (%.4f secs/MB)\n\thash = %s" \ % (mdlname, fn, bsz, fsz, seconds, seconds/fsz*1024*1024, to_hex(digest)) C:\junk> === sample usage === C:\junk>hashtestbed.py md5 32k '\xe5\xbc\xa0\xe6\x95\x8f.txt' md5, u'\u5f20\u654f.txt', bksz 32768: 17 bytes, 0.00 secs (0. secs/MB) hash = 746d0931605368989a20691a906a67f8 C:\junk>hashtestbed.py md5 32k \downloads\python*.msi md5, '\\downloads\\python-2.4.2.msi', bksz 32768: 9671168 bytes, 0.08 secs (0.00 86 secs/MB) hash = bfb6fc0704d225c7a86d4ba8c922c7f5 md5, '\\downloads\\python-2.4.3.msi', bksz 32768: 9688576 bytes, 0.06 secs (0.00 67 secs/MB) hash = ab946459d7cfba4a8500f9ff8d35cc97 md5, '\\downloads\\python-2.5a2.msi', bksz 32768: 10274816 bytes, 0.05 secs (0.0 048 secs/MB) hash = cedc1e1fed9c4cd137921a80485bf007 === end === -- http://mail.python.org/mailman/listinfo/python-list
Re: Running External Commands + Seeing when they are Finished
It works! Gasp! Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Need C# Coding for MD5 Algorithm...
Dennis Lee Bieber wrote: > As for the algorithm... http://www.faqs.org/rfcs/rfc1321.html > > Implement per that spec. It even includes a C-language > implementation that you might be able to bastardize into C# Please don't. Crypto algorithms are hard enough to implement correctly as it is. Leave it to the experts and use a library. -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list
How to use tk.call ?
Hi, I am trying to port one of my Tcl/Tk apps to Python ( 2.4.2/3). One task is to try to be able to use my wheel mouse to scroll a Tktable object. The tcl code looks like: #Support the MouseWheel bind $ui_vars(table) { $ui_vars(table) yview scroll -5 units } bind $ui_vars(table) { $ui_vars(table) yview scroll +5 units } bind $ui_vars(code) { $ui_vars(code) yview scroll -5 units } bind $ui_vars(code) { $ui_vars(code) yview scroll +5 units } $ui_vars(table) is the table and $ui_vars(code) is a text widget. on the python side I can get scrolling in the text widget by # Support for mouse wheel self.command.bind("",self.command.yview_scroll(-5 ,'units')) self.command.bind("",self.command.yview_scroll(5,'units')) Unfortunately the python Tkinter Table widget does not support the yview_scroll command. I have tried the following: self.table.bind("",self.table.tk.call(self.table._w,'yview','scroll',-5,'units') but, alas nothing happens I can't find how too use tk.call, can anyone give me a clue as to how to solve my problem? Thanks, Jerry -- http://mail.python.org/mailman/listinfo/python-list
Re: Beginner Python OpenGL difficulties
[EMAIL PROTECTED] wrote: > I'm beginning learning Python and OpenGL in Python. > > Python fine. But difficulties with OpenGL; presumably with the > installation of OpenGL. > > OS = Linux FC5. > > Python program gl_test.py: > > from OpenGL.GLUT import * > from OpenGL.GLU import * > from OpenGL.GL import * > > name = "Hello, World" > height = 400 > etc. > > [EMAIL PROTECTED]/etc/python>$ python2 gl_test.py > > Traceback (most recent call last): > File "gl_test.py", line 1, in ? > from OpenGL.GLUT import * > ImportError: No module named OpenGL.GLUT > > [EMAIL PROTECTED]/etc/python>$ echo $PYTHONPATH > /usr/lib/python2.2/site-packages/OpenGL > You should already have site-packages in your PythonPath. You want the directory *above* OpenGL in the path, not OpenGL itself. I'm unsure why you're running a Python 2.2 instance on a modern Linux. I'd suspect that you're using an RPM for an older Linux? Not sure there, I run Gentoo, so everything builds from source for the packages that are installed. There are some Fedora Core build patches in CVS that are waiting for me to get my posterior in gear with Win32 testing to be released. Not sure if that would change anything for you, though. Good luck, Mike -- Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
Max M <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > "anya" <[EMAIL PROTECTED]> writes: > > > > > >>Acctualy there is a solution: > >>see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810 > > > > > > Again, sending anything but plain text as the message body ensures > > that your message is unreadable to a large number of people using a > > variety of software. It's your choice whether to restrict your > > audience in this way, but know that that's what you're doing. > > > 90% of users are non-technical users who use standard email readers, > that can easily read html messages. Even if your figure of 90% were correct, 10% of readers is still a large number for most purposes. It's also unknown exactly *which* 10% of your readers that covers. > In my experience the kind of user that receives emails with html and > pictures often prefer it that way. What of those who prefer it not to be that way? What of those who are *incapable* of reading a message that way? > So why bother with the lecture? I cannot remember when I have last > received a relevant email that I could not read in text mode. Nice for you. Fortunately, standard message formats allow the internet to be used by those other than the enabled majority. Let's keep it that way. -- \ "People come up to me and say, 'Emo, do people really come up | `\ to you?'" -- Emo Philips | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Another option - Re: saving settings
On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote: > Hi, > > I was wondering how to make a single .exe file, say some kind od clock, > and be able to save some settings (alarm for example) into the same > file? Basically make code rewrite it self... > > thanks! Another option I thought of: - get the Nullsoft NSIS installer - write a Python wrapper to NSIS if desired - within your app, include: - embedded py2exe - embedded/wrapped NSIS - within your app offer a menu option to 'export this program', which changes data files as needed, then invokes py2exe and NSIS to create a whole new installer exe That way, you'd have what you're after - a way to distribute your app, including its current state, as a single EXE file. Also, it would have the advantage of this EXE being an installer which sets up start menu shortcuts. -- Cheers aum -- http://mail.python.org/mailman/listinfo/python-list
Re: Need C# Coding for MD5 Algorithm...
In <[EMAIL PROTECTED]>, Charleees wrote: > I need C# code for Implementing MD5 Algorithm.. Hope all would have > heard of MD5 Algorith... Does any one have the C# coding for that > Algorithm.. please Send... ITs URgent. There's one in `System.Security.Cryptography`, no need to implement your own. You can get an MD5 `HashAlgorithm` object this way:: HashAlgorithm algorithm = HashAlgorithm.Create("MD5"); Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: starting some Python script from C#
Hello. It seems that the following code works. And it seems that Process object can automatically run script by using python.exe, but only if standard output is not redirected... /* * Created by SharpDevelop. * User: Zlatko * Date: 28.5.2006 * Time: 9:38 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.IO; using System.Collections.Generic; using System.Diagnostics; using System.ComponentModel; using System.Windows.Forms; namespace CS_script { class MainClass { public static void Main(string[] args) { MyProcess myProcess = new MyProcess(); myProcess.ExecuteScript(); MessageBox.Show("Continue?","Application", MessageBoxButtons.OKCancel); } } public class MyProcess { // These are the Win32 error code for file not found or access denied. const int ERROR_FILE_NOT_FOUND =2; const int ERROR_ACCESS_DENIED = 5; /// /// Executes a python script. /// public void ExecuteScript() { Process myProcess = new Process(); try { // Get the path that stores the python script. //string myDocumentsPath =Environment.GetFolderPath(Environment.SpecialFolder.Personal); //If the script is placed in the same folder as C# executable, set the path to current directory: string myDocumentsPath=Environment.CurrentDirectory; //Set the fully qualified script name myProcess.StartInfo.FileName = myDocumentsPath + "\\my_script.py"; //Execute the script: myProcess.Start(); //string output = myProcess.StandardOutput.ReadToEnd(); //Console.WriteLine(output); //Console.WriteLine(myProcess.StandardOutput.ReadToEnd()); //TextReader t = myProcess.StandardOutput; //MessageBox.Show(t.ReadToEnd()); // Wait for it to die... myProcess.WaitForExit(); MessageBox.Show ("Python script is successfully executed!"); } catch (Win32Exception e) { if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND) { Console.WriteLine(e.Message + ". Check the path."); } else if (e.NativeErrorCode == ERROR_ACCESS_DENIED) { // Note that if your word processor might generate exceptions // such as this, which are handled first. Console.WriteLine(e.Message + ". You do not have permission to print this file."); } } } } } Greetings, Zlatko "Gerard Flanagan" <[EMAIL PROTECTED]> je napisao u poruci interesnoj grupi:[EMAIL PROTECTED] >> "Gerard Flanagan" <[EMAIL PROTECTED]> je napisao u poruci interesnoj >> grupi:[EMAIL PROTECTED] >> > tatamata wrote: >> >> Hello. >> >> >> >> How can I run some Python script within C# program? >> >> >> > >> > - >> >ProcessStartInfo startInfo; >> >Process process; >> >string directory; >> >string pyArgs; >> >string script; >> > >> >startInfo = new ProcessStartInfo("python"); >> >startInfo.WorkingDirectory = directory; >> >startInfo.Arguments = script + " " + pyArgs; >> >startInfo.UseShellExecute = false; >> >startInfo.CreateNoWindow = true; >> >startInfo.RedirectStandardOutput = true; >> >startInfo.RedirectStandardError = true; >> > >> >process = new Process(); >> >process.StartInfo = startInfo; >> >process.Start(); >> > >> >string s; >> >while ((s = process.StandardOutput.ReadLine()) != null) >> >{ >> >//do something with s >> >} >> > - >> > > > tatamata wrote: >> Hello. I tried to implement ypour suggestion, but an error apears: >> "Exception System.ComponentModel.Win32Exception was thrown in debugee: >> The specified executable is not a valid Win32 application. >> >> namespace CS_script >> { >> class MainClass >> { >> public static void Main(string[] args) >> { >> >> System.Diagnostics.ProcessStartInfo psi =new >> System.Diagnostics.ProcessStartInfo(); >> psi.FileName="my_script.py"; >> psi.WorkingDirectory=Environment.CurrentDirectory; >> psi.RedirectStandardOutput = true; >> psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; >> psi.UseShellExecute = false; >> psi.CreateNoWindow = true; >> >> System.Diagnostics.Process script; >> script = System.Diagnostics.Process.Start(psi); >> >>
Re: create a text file
Stan Cook a écrit : > I'm writing a script to list all of my music files' id3 tags to a comma > delimited file. The only part I'm missing seems like it should be the > simplest. I haven't used Python for the last couple of years. My > question is this: > > When I use os.open(,"w"), I get an error message, > TypeError: an integer is required. Has something changed? Did I miss > something??? You want open() (the builtins one), not os.open(). Also, if you want to deal with csv files, you may want to check the csv module (if you don't use it already). -- http://mail.python.org/mailman/listinfo/python-list
Re: create a text file
Stan Cook wrote: > I'm writing a script to list all of my music files' id3 tags > to a comma delimited file. The only part I'm missing seems > like it should be the simplest. I haven't used Python for > the last couple of years. My question is this: > > When I use os.open(,"w"), I get an error > message,TypeError: an integer is required. Has > something changed? Did I miss something??? the function is called "open", not "os.open". there's an open function in the os module, but that's doing something slightly different (see the library reference documentation for details if you're curious). -- http://mail.python.org/mailman/listinfo/python-list
create a text file
I'm writing a script to list all of my music files' id3 tags to a comma delimited file. The only part I'm missing seems like it should be the simplest. I haven't used Python for the last couple of years. My question is this: When I use os.open(,"w"), I get an error message,TypeError: an integer is required. Has something changed? Did I miss something??? Thanks, ---> S Cook -- http://mail.python.org/mailman/listinfo/python-list
Re: HTMLParser chokes on bad end tag in comment
Edward Elliott wrote: > Guess you learn something new every day. Too bad there's so much illegal > code in the wild. :( if more people learned something new every day, the wild would look a lot different. -- http://mail.python.org/mailman/listinfo/python-list
Re: Is anybody knows about a linkable, quick MD5/SHA1 calculator library ?
DurumDara wrote: > I use the Python standard modules, but I think that it can be faster if > I use C, or other module for it. Python's MD5 and SHA-1 code is written in C, and is quite fast: python -m timeit -s "import sha; s = sha.new(); S = '*'*100" "s.update(S)" 100 loops, best of 3: 12.2 msec per loop python -m timeit -s "import md5; s = md5.new(); S = '*'*100" "s.update(S)" 100 loops, best of 3: 6.45 msec per loop are you sure it's really a CPU-bound problem? -- http://mail.python.org/mailman/listinfo/python-list
Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional
i won't have a free and guileless mind to code if i do this. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ricerca Programmatore Python
Scott David Daniels wrote: > I understand there is an Italian-language Python group, but _here_ > the language is English, even if you begin by an apology in English. > ... In consideration for such people, please limit yourself to English. I doubt he'll ever see your reprimand, looks like a hit-and-run job. Too bad we can't force non-English posts through Babelfish first. At the very least, we'll get a good laugh out of it: Blank to all, I write in order to inform you of one proposed of collaboration. I am trying a programmatore for the realization of a minium-software useful in order to analyze and to represent multigrafi. An optimal competence is demanded in uses of Python with the relati to you packages of mathematical rappresentazione (es. matplotlib). For the notion of grafo it is referred to the following pages: http://it.wikipedia.org/wiki/Teoria_dei_grafi (Italian). http://en.wikipedia.org/wiki/Graph_theory (English). The residence in province of Milan, sight of a possible encounter is preferibile. Draft of one retribuita external collaboration. The interested ones can directly contact to the present deliveries in tail to the email, sending the relative resume to me. I hope of to have made what appreciate postando this announcement. In contrary case, I make excuses myself for the disturbance. Salutes, Giandomenico Sica -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list
Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional
"Kriv" <[EMAIL PROTECTED]> wrote: > Hi friends, > > I found this eBook on the web. This book is very very good. > I refer to them. I doubt Apress will be happy with this. Don't post garbage like this, since instead of helping, you're doing the opposite. People interested in copyright infringement don't need your posts, they know where and how to get it. http://diveintopython.org/ Dive into Python http://greenteapress.com/thinkpython/ How to Think Like a Computer Scientist: Learning with Python http://honors.montana.edu/~jjc/easytut/easytut/ Non-Programmers Tutorial For Python http://www.freenetpages.co.uk/hp/alan.gauld/tutintro.htm Learning to program (might be outdated) -- John MexIT: http://johnbokma.com/mexit/ personal page: http://johnbokma.com/ Experienced programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Very good Python Book. Free download : Beginning Python: From Novice to Professional
On 29 May 2006 10:52:13 -0700, "Kriv" <[EMAIL PROTECTED]> wrote: >Hi friends, > >I found this eBook on the web. This book is very very good. >I refer to them. > >http://rapidshare.de/files/21704644/Apress.Beginning.Python.From.Novice.to.Professional.Sep.2005.rar.html > > >Thx >John WOW! What a great book! Thanks for the link. You RULE. -- http://mail.python.org/mailman/listinfo/python-list
Re: John Bokma harassment
[EMAIL PROTECTED] wrote: >>"There is so much noise we can't hear each other, but I will defend >>to the death a chance to get heard for whatever you might have to say >>that's intelligent (while not necessarily from your own mouth)". > > You write a much cooler quote! > >>Besides, it is not clear that Voltaire really said that. > > No? well I guess it's alright to harrass Xah then. Your first question should be: Is it alright that Xah harasses 5 newsgroups? Or maybe work on your spelling, harass is with one r, but maybe you didn't read the subject, which wouldn't amaze me, since you sound like you should be spending time on MySpace OMG!. -- John MexIT: http://johnbokma.com/mexit/ personal page: http://johnbokma.com/ Experienced programmer available: http://castleamber.com/ Happy Customers: http://castleamber.com/testimonials.html -- http://mail.python.org/mailman/listinfo/python-list
Re: HTMLParser chokes on bad end tag in comment
Fredrik Lundh wrote: >> Should it? The end tag it chokes on is in comment, isn't it? > > no. STYLE and SCRIPT elements contain character data, not parsed > character data, so comments are treated as characters, and the first > "http://www.w3.org/TR/html4/appendix/notes.html#notes-specifying-data Element content When script or style data is the content of an element (SCRIPT and STYLE), the data begins immediately after the element start tag and ends at the first ETAGO ("") before the SCRIPT end tag: document.write ("This won't work") In JavaScript, this code can be expressed legally by hiding the ETAGO delimiter before an SGML name start character: document.write ("This will work<\/EM>") Guess you learn something new every day. Too bad there's so much illegal code in the wild. :( -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list
Re: itertools.count() as built-in
[EMAIL PROTECTED] wrote: > Is there any chance of itertools.count() ever becoming one of the > built-in functions? That's unlikely. The goal is to have fewer builtins rather than more. Utility and frequency are not the only considerations; otherwise glob.glob, sys.stderr, print.pprint, copy.copy, and many others would also be candidates. > It's a wonderful little function and I find myself > importing it in every module I write. I'm glad you find it so useful. Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: summarize text
On 29 May 2006 07:52:33 -0700, gene tani <[EMAIL PROTECTED]> wrote: robin wrote:> hello list,>> does anyone know of a library which permits to summarise text? i've> been looking at nltk but haven't found anything yet. any help would beunclear what you're asking, maybe look at: http://www.cs.waikato.ac.nz/~ml/weka/index.htmlhttp://www.kdnuggets.com/software/suites.html http://www.ailab.si/orangehttp://mallet.cs.umass.edu/index.php/Main_Page http://minorthird.sourceforge.net/http://www.dia.uniroma3.it/db/roadRunner/http://www.lemurproject.org/ --http://mail.python.org/mailman/listinfo/python-listText summarization is a big problem, unlikely to be solved by calling on an established library. Although it's not entirely clear what you are hoping to do, the links above are for document searching, document classification, or data mining.But if you mean something like a news brief or a plot summary, check out the Document Understanding Conferences, http://duc.nist.gov/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding a lost PYTHONPATH with find
John J. Lee wrote: > find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \; > > > The minus in '-100k' (meaning "less than 100k") seems to be > undocumented, at least on my system. It should be standard in linux man pages, can't speak for other unices: TESTS Numeric arguments can be specified as +n for greater than n, -n for less than n, n for exactly n. Maybe you were fooled because it's not directly under the description of -size. > I suppose the -maxdepth is > redundant since I think find searches breadth-first by default. ??? maxdepth determines how deep the search will look, not the order the search occurs. Your search only find things within 3 levels of the root, unless your directory tree goes no deeper than that (very unlikely) the maxdepth can't be redundant. -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
Ten wrote: > Sorry for the rant, good luck to the guy if he's solved his problem, > but damn, that "90% so let's not bother doing things properly" stuff makes > my blood boil. You must really hate browsing the web then. :) -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list
Very good Python Book. Free download : Beginning Python: From Novice to Professional
Hi friends, I found this eBook on the web. This book is very very good. I refer to them. http://rapidshare.de/files/21704644/Apress.Beginning.Python.From.Novice.to.Professional.Sep.2005.rar.html Thx John -- http://mail.python.org/mailman/listinfo/python-list
Unlimited Free Music Downloads WOW! 100% Legal
-- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
On Monday 29 May 2006 11:28, Max M wrote: > Ben Finney wrote: > > "anya" <[EMAIL PROTECTED]> writes: > >>Acctualy there is a solution: > >>see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810 > > > > Again, sending anything but plain text as the message body ensures > > that your message is unreadable to a large number of people using a > > variety of software. It's your choice whether to restrict your > > audience in this way, but know that that's what you're doing. > > 90% of users are non-technical users who use standard email readers, > that can easily read html messages. > Even if your 90% were any kind of real statistic, 90% of everyone is not everyone, and there ends the technical debate. 100 != 90 As a matter of interest, I'm almost sure that on checking you'd find that of the widely available mail clients, only a minority will display such a mail properly without further interaction. You might find that platform neutrality and usefulness to people are genuine considerations for those with any kind of technical integrity, and that "most people use this particular piece of proprietary software so let's just say screw the rest" (whilst still benefiting from a platform-neutral medium, and bouncing it off open source servers) is widely considered a shabby and broken way of working. If people want to palm people off with excuses and generally implement things in a lazy, badly badly planned, mercenary and undisciplined way, they're probably better off spending their time with the non-technical management and not amongst programmers. Sorry for the rant, good luck to the guy if he's solved his problem, but damn, that "90% so let's not bother doing things properly" stuff makes my blood boil. -- There are 10 types of people in this world, those who understand binary, and those who don't. -- http://mail.python.org/mailman/listinfo/python-list
Is anybody knows about a linkable, quick MD5/SHA1 calculator library ?
Hi ! I need to speedup my MD5/SHA1 calculator app that working on filesystem's files. I use the Python standard modules, but I think that it can be faster if I use C, or other module for it. I use FSUM before, but I got problems, because I "move" into "DOS area", and the parameterizing of outer process maked me very angry (not working). You will see this in this place: http://mail.python.org/pipermail/python-win32/2006-May/004697.html So: I must handle unicode filenames. I think that if I find a library that can working with py's unicode chars, and I can load and use it to hash files, the code be better, and faster. Anybody knows about same code ? Py2.4, Windows, Py2Exe, wxPy... That was the specification. Thanx for help: dd -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
On 2006-05-29, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: > It _might_ come as a shock to you, but when you install e.g. > Word on another computer, there aren't any documents coming > with it. Documents and settings aren't quite the same thing, but it's a valid point. > Especially not the ones you wrote on that other machine. > > Seriously: Who is going to copy a executable around? I do. I copy putty.exe around all of the time. > Do you know of any other program that behaves like that? Back in the day, that used to be fairly common under DOS/Windows. Not that it's still not a really bad idea. -- Grant Edwards grante Yow! I'm wet! I'm wild! at visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: omniorbpy: problems sending float values
Juergen wrote: > hi, > > I've got a problem sending floating point values to an corba server. > With other datatyes like short or string it works fine. > > > So having this idl file : > > module Example{ > interface User{ > void setV( in float x ); > }; > interface Target{ > void getV( out short x); > }; > }; > > I just receive zero ( -2.58265845332e-05) by sending an float to > another client with the above interface. > the client : > ** > import sys > from omniORB import CORBA > import _omnipy > import Example, CosNaming > > orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) > > > > ior = sys.argv[1] > obj = orb.string_to_object(ior) > > us = obj._narrow( Example.User ) > > if us is None: > print "blabla" > sys.exit(1) > > us.setV( 5.0 ) > ** > > the server : > ** > import sys > from omniORB import CORBA, PortableServer > import CosNaming, Example, Example__POA > > class User_i( Example__POA.User ): > def setV( self, x ): > print x > print type(x) > y = float(x) > print y > print type(y) > > > class Target_i( Example__POA.Target ): > def getV( self ): > return 5 > > orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) > poa = orb.resolve_initial_references("RootPOA") > > > us = User_i() > tg = Target_i() > > uo = us._this() > to = tg._this() > print orb.object_to_string(uo) > print > print orb.object_to_string(to) > > > poaManager = poa._get_the_POAManager() > poaManager.activate() > > orb.run() > ** > > does anyone have an answer to that kind of problem? > I mean, it just like sending short values, or strings. > I never used omniorb and have no clue were's the problem, but if you don't find a solution just convert float into a string on one side and back on the other hehe =B) -- http://mail.python.org/mailman/listinfo/python-list
Re: itertools.count() as built-in
Duncan Smith <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Zipping an xrange? I'm having trouble visualizing how you do that to > > avoid x*i+y. > > > > -Janto > > > > Something like, > > >>> lis = ['a', 'b', 'c', 'd'] > >>> y = 3 > >>> i = 7 > >>> for n, item in zip(xrange(y, len(lis)*i+y, i), lis): > print n, item Actually I tend to use sys.maxint as the xrange's middle arg, but, yes, this IS the general idea!-) Alex -- http://mail.python.org/mailman/listinfo/python-list
Re: access serial port in python
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >hi >i hav written a code in python to send an SMS from a nokia 3310 >connected to my PC... >i wanted to receive a msg on my PC. In order to do so, the PC must know >when it has to read data frm the serial port ...thus an interrupt must >be generated when the serial port receives data frm the phone .HOW >CAN I DO THIS IN PYTHON ?? >can anyone help me with this INTERRUPT HANDLING thing in PYTHON ??? >thanks > Others have answered your direct question about serial handling. Let me urge you to consider investigation of the gnokii and gammu projects, which handle MANY other aspects of SMS handling that I doubt you want to burden you. There turns out to be depressingly more to SMS than you might imagine (although it's just possible that you already have almost everything you need for the 3310). When researching these two projects, note that gammu is already aware of Python, but rather unstably so, and that gnokii's Windows story has brightened immensely in the last month. -- http://mail.python.org/mailman/listinfo/python-list
Re: Any other config parsing modules besides ConfigParser ?
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: >ConfigObj? > http://www.voidspace.org.uk/python/configobj.html . . . Depending on what the original questioner meant by "general", I'm always happy to recommend Python itself as a configuration-parsing mechanism http://www.unixreview.com/documents/s=10083/ur0605k/ >. -- http://mail.python.org/mailman/listinfo/python-list
How to calc easier the "long" filesize from nFileSizeLow and nFileSizeHigh
Hi ! I get the file datas with FindFilesW. I want to calc the filesize from nFileSizeLow and nFileSizeHigh with easiest as possible, without again calling os.getsize(). How to I do it ? I need good result ! Thanx for help: dd -- http://mail.python.org/mailman/listinfo/python-list
Re: itertools.count() as built-in
[EMAIL PROTECTED] wrote: > Zipping an xrange? I'm having trouble visualizing how you do that to > avoid x*i+y. > > -Janto > Something like, >>> lis = ['a', 'b', 'c', 'd'] >>> y = 3 >>> i = 7 >>> for n, item in zip(xrange(y, len(lis)*i+y, i), lis): print n, item 3 a 10 b 17 c 24 d >>> Duncan -- http://mail.python.org/mailman/listinfo/python-list
Re: omniorbpy: problems sending float values
Juergen wrote: > hi, > > I've got a problem sending floating point values to an corba server. > With other datatyes like short or string it works fine. It works fine for me with floats, too. You'd better ask this on the omniorb ML, and don't forget to give some more details on the python & omniorb & OS versions you're using. Diez -- http://mail.python.org/mailman/listinfo/python-list
omniorbpy: problems sending float values
hi, I've got a problem sending floating point values to an corba server. With other datatyes like short or string it works fine. So having this idl file : module Example{ interface User{ void setV( in float x ); }; interface Target{ void getV( out short x); }; }; I just receive zero ( -2.58265845332e-05) by sending an float to another client with the above interface. the client : ** import sys from omniORB import CORBA import _omnipy import Example, CosNaming orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) ior = sys.argv[1] obj = orb.string_to_object(ior) us = obj._narrow( Example.User ) if us is None: print "blabla" sys.exit(1) us.setV( 5.0 ) ** the server : ** import sys from omniORB import CORBA, PortableServer import CosNaming, Example, Example__POA class User_i( Example__POA.User ): def setV( self, x ): print x print type(x) y = float(x) print y print type(y) class Target_i( Example__POA.Target ): def getV( self ): return 5 orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) poa = orb.resolve_initial_references("RootPOA") us = User_i() tg = Target_i() uo = us._this() to = tg._this() print orb.object_to_string(uo) print print orb.object_to_string(to) poaManager = poa._get_the_POAManager() poaManager.activate() orb.run() ** does anyone have an answer to that kind of problem? I mean, it just like sending short values, or strings. -- http://mail.python.org/mailman/listinfo/python-list
Re: summarize text
robin wrote: > hello list, > > does anyone know of a library which permits to summarise text? i've > been looking at nltk but haven't found anything yet. any help would be unclear what you're asking, maybe look at: http://www.cs.waikato.ac.nz/~ml/weka/index.html http://www.kdnuggets.com/software/suites.html http://www.ailab.si/orange http://mallet.cs.umass.edu/index.php/Main_Page http://minorthird.sourceforge.net/ http://www.dia.uniroma3.it/db/roadRunner/ http://www.lemurproject.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
Thanks Serge. It's a gzip string. So the code is >>> import urllib2 >>> def takefeed(url): request=urllib2.Request(url) request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5;Windows NT') opener = urllib2.build_opener() data=opener.open(request).read() return data >>> url='http://news.google.it/?output=rss' >>> d=takefeed(url) >>> from StringIO import StringIO >>> zipdata=StringIO(d) >>> import gzip >>> gz=gzip.GzipFile(fileobj=zipdata) >>> rss=gz.read() >>> len(rss) 102529 >>> print rss[0:100] NFE/1.0>> -- http://mail.python.org/mailman/listinfo/python-list
Re: Ricerca Programmatore Python
Nic wrote: > Please accept my apologies for the use of the Italian language. accepted -- http://mail.python.org/mailman/listinfo/python-list
Re: unexpected behaviour for python regexp: caret symbol almost useless?
Thank you Paul. Since the only thing i'm doing is extracting this fields, and have no plans to include other stuff, a regexp is fine. However i will take into account 'pyparsing' when i need to do more complex parsing. As you can see in the example i send, i was trying to get info from a glade file, in particular i was tired of doing this everytime i need to access a widget: some_var = xml.get_widget('some_id') (doing this is tiresome when you have more than 10 widgets) So i do a little module to have all widgets instanciated as attributes of the object, for anyone interested it is on: http://www.lugmen.org.ar/~p10n/sources/conan/utilidades/GetWidgets.py However is still pretty unmature, since it lacks some checks. -- http://mail.python.org/mailman/listinfo/python-list
Re: unexpected behaviour for python regexp: caret symbol almost useless?
Thank you, i have read this but somehow a missed it when the issue arose. -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
Scott David Daniels wrote: > Max M wrote: > >> 90% of users are non-technical users who use standard email readers, >> that can easily read html messages. >> >> In my experience the kind of user that receives emails with html and >> pictures often prefer it that way. >> >> So why bother with the lecture? I cannot remember when I have last >> received a relevant email that I could not read in text mode. > > > Because > (A) This _is_ a technical newsgroup with mores you are violating. *I* am? How? By disagreeing on how technology should be used? > (B) Some of us "technical users" avoid such email/news readers > precisely because they can cause tracking across the web. Yes but some times it's just simpler to send formatted text and images. I also use text only email. But I don't believe everybody else has to. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ricerca Programmatore Python
Nic wrote: > Please accept my apologies for the use of the Italian language. > ... ... To be convivial it is not enough to simply begin by acknowledging that you know the rule you are violating and then violating it. You would not like: Please accept my apologies for a commercial message. ** Great prices on V146RA ... I understand there is an Italian-language Python group, but _here_ the language is English, even if you begin by an apology in English. The reason is not for the generally monolingual Americans, as some suspect, but for, example, the hapless native Chinese speaker who has put the work into learning enough English to get by and is confronted with yet another European language to decipher. In consideration for such people, please limit yourself to English. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
> that doesn't shock me :p > anyway you're talking about instalation while I'm talkig about single > standalone file. > Besides, if it was neccessary I bet MS would make that option (and it > wouldn't be a problem since installation is not done from a sinlge file > but from the CD (should be CD-RW in that case) with lots of files and > directories so they'd create just another directory on the installation > CD, say \All Documents\ ) But that is a folder then. Go put your config-file & program in a folder, and copy it. >> >> Seriously: Who is going to copy a executable around? > Obviously I am. :D > Do you know of any >> other program that behaves like that? > No, but for most programs I used I never bothered to check where did > they put their settings. > That's just the thing, I'm not a professional programmer so I was > wondering is it possible to do it, and if it is how much trouble would > it be. If nothing I will just make a config file right next to the > executable.. Nobody does it that way for a simple reason: lets say you stored some config-information like an IP-address. Now moving your program somewhere else makes that a wrong config option - and possibly your program crashes even before you have the chance to _change_ that config setting. Now you need either a fresh copy - or just edit/delete the config file. The latter sounds better to me - and most probably quite a few others programmers. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
Diez B. Roggisch wrote: > SuperHik wrote: > >> aum wrote: >>> On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote: >>> Hi, I was wondering how to make a single .exe file, say some kind od clock, and be able to save some settings (alarm for example) into the same file? Basically make code rewrite it self... thanks! >>> Yikes!!! >>> >>> I'd strongly suggest you read the doco for ConfigParser, and load/save >>> your config file to/from os.path.join(os.path.expanduser("~")). >>> >>> Another option - save your stuff in the Windows Registry >>> >> but if I copy this file on the other computer settings will be lost... > > It _might_ come as a shock to you, but when you install e.g. Word on another > computer, there aren't any documents coming with it. Especially not the > ones you wrote on that other machine. that doesn't shock me :p anyway you're talking about instalation while I'm talkig about single standalone file. Besides, if it was neccessary I bet MS would make that option (and it wouldn't be a problem since installation is not done from a sinlge file but from the CD (should be CD-RW in that case) with lots of files and directories so they'd create just another directory on the installation CD, say \All Documents\ ) > > Seriously: Who is going to copy a executable around? Obviously I am. :D Do you know of any > other program that behaves like that? No, but for most programs I used I never bothered to check where did they put their settings. That's just the thing, I'm not a professional programmer so I was wondering is it possible to do it, and if it is how much trouble would it be. If nothing I will just make a config file right next to the executable.. > > Diez thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Running Python scripts under a different user
Bernard Lebel a écrit : > On 5/26/06, Laszlo Nagy <[EMAIL PROTECTED]> wrote: >> For Windows, you can use the 'runas.exe' program. But it requires a >> password too. >> >> From what you wrote, I think that you need to change architecture. You >> should write your own service rather than write tricky programs. This >> way you can develop your own security system, and restrict access to >> specific files/programs. You can write tools that can connect to your >> service. The service program can be ran on the background, with >> sufficient privileges. How does it sound? > > [Bermard] Any ressource you could point me to as to write services? > I'm totally unexperienced with that. As you run under Unix, you may be interrested into the daemon.py script. See Unix Daemon in page http://homepage.hispeed.ch/py430/python/index.html And too: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 See also google links for python + daemon A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list
Re: Large Dictionaries
Thomas Ganss wrote: > Klaas schrieb: >> 4. Insert your keys in sorted order. > This advice is questionable - > > My gut feeling on this matter is: > IF the insert times of pre-sorted values is far better > than the times of unsorted values, there is a chance > that the resulting tree is unbalanced: only 1 compare > operation after insert and no re-balancing of the tree. > > re-indexing will probably give you far better access times > in this case. Another option is to drop non RI indexes used only > for query optimization and recreate them after batch insert. Don't use your gut for such issues. Pre-sorted data is such a common special case (in fact, the only easily describable special case) that many systems handle this specially. For example, time timsort (Python's internal sort) on pre-sorted data; you'll find it is handled faster than random data. If you are using your gut without testing, go ahead and presort. In any case, reading documents and testing beats gut feels every time. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
Max M wrote: > 90% of users are non-technical users who use standard email readers, > that can easily read html messages. > > In my experience the kind of user that receives emails with html and > pictures often prefer it that way. > > So why bother with the lecture? I cannot remember when I have last > received a relevant email that I could not read in text mode. Because (A) This _is_ a technical newsgroup with mores you are violating. (B) Some of us "technical users" avoid such email/news readers precisely because they can cause tracking across the web. -- --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: John Bokma harassment
Boris Borcic wrote: > [EMAIL PROTECTED] wrote: > > We seem to have strayed a long way from Voltaire's > > "I do not agree with what you say, but I will defend to the death your > > right to say it.", > > but that was of course the age of enlightenment. > > Obviously this wisdom is getting stale and should be updated to something > like "There is so much noise we can't hear each other, but I will defend > to the death a chance to get heard for whatever you might have to say that's > intelligent (while not necessarily from your own mouth)". > But we might not have enough intelligence to decide what is intelligent and what is not. :-) > Besides, it is not clear that Voltaire really said that. > > Cheers, BB > -- > python >>> filter(lambda W : W not in 'ILLITERATE','BULLSHIT') -- http://mail.python.org/mailman/listinfo/python-list
Re: Running Python scripts under a different user
Thanks Laszlo, I'll check it out. Bernard On 5/29/06, Laszlo Nagy <[EMAIL PROTECTED]> wrote: > > >> > >> From what you wrote, I think that you need to change architecture. You > >> should write your own service rather than write tricky programs. This > >> way you can develop your own security system, and restrict access to > >> specific files/programs. You can write tools that can connect to your > >> service. The service program can be ran on the background, with > >> sufficient privileges. How does it sound? > > > > [Bermard] Any ressource you could point me to as to write services? > > I'm totally unexperienced with that. > I'm sorry, I was out of town in the weekend. You can try to write a > multi-threaded application server that provides services through TCP/IP. > Probably, the easiest to start with an existing framework: > > http://twistedmatrix.com/projects/core/ > http://www.webwareforpython.org/ > > There are many other libraries, you can look for them in the cheeseshop. > > http://cheeseshop.python.org/pypi > > You can also develop your own protocol with SocketServer or xmlrpc: > > http://docs.python.org/lib/module-SocketServer.html > http://docs.python.org/lib/module-xmlrpclib.html > > > Best, > >Laszlo > > -- http://mail.python.org/mailman/listinfo/python-list
Re: deleting item from ListCtrl by pop-up menu
sendhil kumar wrote: > hi all, > i need more information on the EVT_LIST_DELETE_ITEM() > for a list ctrl! iam not able to delete the selected > list item from the popup menu...below i have given the > part of the code ... im using popup menu... wher am i > wrong any suggestions wud b of great help... This is a wxPython question, not a Python question. Ask on the wxPython group. Available on gmane as gmane.comp.python.wxpython --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: summarize text
> does anyone know of a library which permits to summarise text? > i've been looking at nltk but haven't found anything yet. any > help would be very welcome. Well, summarizing text is one of those things that generally takes a brain-cell or two to do. Automating the process would require doing it either smartly (some sort of neural-net/NLP/Markov-chain technology, which is a non-trivial task--something one might consider braving in the 3rd or 4th-year of a university computer-science program), or doing it fairly dumbly. As an example of a "dumb" solution, you can use regexps to trim off the first few words and the last few words and call that a "summary": >>> import re >>> r = re.compile(r'^(.{8}.*?\b)\s.*\s(\b.{8}.*?)', re.DOTALL) >>> s = """This is the first line ... and it has a second line ... and a third line ... and the last line is the fourth line.""" >>> result = r.sub(r"\1...\2",s.strip()) >>> result 'This is the...fourth line.' You can adjust the "{8}" portions for more or less leader/trailing context characters. The regexp might need a bit of tweaking for somewhat short strings, but if they're fairly short, one might not need to summarize them ;) -tkc -- http://mail.python.org/mailman/listinfo/python-list
os.tilmes() problem
i have a problem with the os.times() command, on different Python versions, i get different printout: Server1# python Python 2.3.4 (#1, Feb 2 2005, 11:44:13) [GCC 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] 4880406.62 -- Server2% python Python 2.3.2 (#4, Sep 14 2004, 09:41:45) [C] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] -21464227.74 --- Server3% python Python 2.4.1 (#1, May 16 2005, 15:19:29) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import time >>> import os >>> >>> print os.times()[4] 18390711.21 and on the 3 servers, the linux command: $date returns the same value. any suggestions??? -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
SuperHik wrote: > aum wrote: > > On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote: > > > >> Hi, > >> > >> I was wondering how to make a single .exe file, say some kind od clock, > >> and be able to save some settings (alarm for example) into the same > >> file? Basically make code rewrite it self... > >> > >> thanks! > > > > Yikes!!! > > > > I'd strongly suggest you read the doco for ConfigParser, and load/save > > your config file to/from os.path.join(os.path.expanduser("~")). > > > > Another option - save your stuff in the Windows Registry > > > > but if I copy this file on the other computer settings will be lost... Put your program in a writable folder and save configuration right into that folder. Then your can transfer the whole folder. Tip: sys.path[0] always contains the path to the directory where "__main__" module is located. -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
Rocco wrote: > Also with ascii the function does not work. Well, at least you fixed misconfiguration ;) Googling for 1F8B (that's two first bytes from your strange python 2.4 result) gives a hint: it's a beginning of gzip stream. Maybe urllib2 in python 2.4 reports to the server that it supports compressed data but doesn't decompress it when receives the reply? -- http://mail.python.org/mailman/listinfo/python-list
Re: John Bokma harassment
>"There is so much noise we can't hear each other, but I will defend >to the death a chance to get heard for whatever you might have to say that's >intelligent (while not necessarily from your own mouth)". You write a much cooler quote! >Besides, it is not clear that Voltaire really said that. No? well I guess it's alright to harrass Xah then. Immanuel Litzroth -- http://mail.python.org/mailman/listinfo/python-list
Re: (mostly-)POSIX regular expressions
John Machin wrote: > On 29/05/2006 7:46 AM, Sébastien Boisgérault wrote: > > Paddy a écrit : > > > >> maybe this: http://www.pcre.org/pcre.txt and ctypes might work for you? > > > > Well finally, it doesn't fit. What I need is a "longest match" policy > > in > > patterns like "(a)|(b)|(c)" and NOT a "left-to-right" policy. > > Additionaly, > > I need to be able to obtain the matched ("captured") substring and > > the PCRE does not allow this in DFA mode. > > > > Perhaps you might like to be somewhat more precise with your > requirements. Sure. More on this below. > "POSIX-compliant" made me think of yuckies like [:fubar:] > in character classes :-) Yep. I do not need POSIX *syntax* for regular expressions but POSIX *semantics*, at least the "leftmost-longest" part (in contrast to the "first then longest" used in Python, Perl, .NET, etc.) > The operands of | are such that the length is not fixed and so you can't > write them in descending length order? Care to tell us some more detail > about those operands? Basically, I'd like to use the (excellent) python module SPARK of John Aycock to build an (extended) C lexer. To do so, I need to specify the patterns that match my tokens as well as a priority between them. SPARK then builds a big alternate list of patterns that begins with the high priority patterns and ends with the low priority patterns and runs a match. The problem with to be very careful and to specify explicitely the priorities to get the desired results: "<=" shall be higher than "<", decimal stuff higher than integer, etc, when most of the time what you really want is to match the longest pattern ... Worse, the priority work-around does not work well when you compare keywords and (other) identifiers. To match "fortune" as a identifier, you would need to define identifier with a higher priority than keyword and it is a problem: "for" would be then match as a identifier when it is a keyword. I can come up with possible work-arounds for the "id vs keyword" issue, but nothing that really makes me happy ... Therefore, I was studying the possible replacement of the Python native regular expression engine with a "POSIX semantics" regular expression engine that would give the longest match and avoid me a lot of extra work ... I hope it's clearer now :) Any advice ? Cheers SB -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
SuperHik wrote: > aum wrote: >> On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote: >> >>> Hi, >>> >>> I was wondering how to make a single .exe file, say some kind od clock, >>> and be able to save some settings (alarm for example) into the same >>> file? Basically make code rewrite it self... >>> >>> thanks! >> >> Yikes!!! >> >> I'd strongly suggest you read the doco for ConfigParser, and load/save >> your config file to/from os.path.join(os.path.expanduser("~")). >> >> Another option - save your stuff in the Windows Registry >> > > but if I copy this file on the other computer settings will be lost... It _might_ come as a shock to you, but when you install e.g. Word on another computer, there aren't any documents coming with it. Especially not the ones you wrote on that other machine. Seriously: Who is going to copy a executable around? Do you know of any other program that behaves like that? Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: John Bokma harassment
[EMAIL PROTECTED] wrote: > We seem to have strayed a long way from Voltaire's > "I do not agree with what you say, but I will defend to the death your > right to say it.", > but that was of course the age of enlightenment. Obviously this wisdom is getting stale and should be updated to something like "There is so much noise we can't hear each other, but I will defend to the death a chance to get heard for whatever you might have to say that's intelligent (while not necessarily from your own mouth)". Besides, it is not clear that Voltaire really said that. Cheers, BB -- python >>> filter(lambda W : W not in 'ILLITERATE','BULLSHIT') -- http://mail.python.org/mailman/listinfo/python-list
summarize text
hello list, does anyone know of a library which permits to summarise text? i've been looking at nltk but haven't found anything yet. any help would be very welcome. thank you all in advance, robin -- http://mail.python.org/mailman/listinfo/python-list
Re: Running Python scripts under a different user
>> >> From what you wrote, I think that you need to change architecture. You >> should write your own service rather than write tricky programs. This >> way you can develop your own security system, and restrict access to >> specific files/programs. You can write tools that can connect to your >> service. The service program can be ran on the background, with >> sufficient privileges. How does it sound? > > [Bermard] Any ressource you could point me to as to write services? > I'm totally unexperienced with that. I'm sorry, I was out of town in the weekend. You can try to write a multi-threaded application server that provides services through TCP/IP. Probably, the easiest to start with an existing framework: http://twistedmatrix.com/projects/core/ http://www.webwareforpython.org/ There are many other libraries, you can look for them in the cheeseshop. http://cheeseshop.python.org/pypi You can also develop your own protocol with SocketServer or xmlrpc: http://docs.python.org/lib/module-SocketServer.html http://docs.python.org/lib/module-xmlrpclib.html Best, Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: saving settings
aum wrote: > On Mon, 29 May 2006 09:05:36 +0200, SuperHik wrote: > >> Hi, >> >> I was wondering how to make a single .exe file, say some kind od clock, >> and be able to save some settings (alarm for example) into the same >> file? Basically make code rewrite it self... >> >> thanks! > > Yikes!!! > > I'd strongly suggest you read the doco for ConfigParser, and load/save > your config file to/from os.path.join(os.path.expanduser("~")). > > Another option - save your stuff in the Windows Registry > but if I copy this file on the other computer settings will be lost... -- http://mail.python.org/mailman/listinfo/python-list
Ricerca Programmatore Python
Please accept my apologies for the use of the Italian language. * Salve a tutti, Scrivo per informarvi di una proposta di collaborazione. Sto cercando un programmatore per la realizzazione di un mini-software utile per analizzare e rappresentare multigrafi. Si richiede una ottima competenza nell'utilizzo di Python con i relativi pacchetti di rappresentazione matematica (es. matplotlib). Per la nozione di grafo si rimanda alle seguenti pagine: http://it.wikipedia.org/wiki/Teoria_dei_grafi (italiano). http://en.wikipedia.org/wiki/Graph_theory (inglese). È preferibile la residenza in provincia di Milano, in vista di un possibile incontro. Si tratta di una collaborazione esterna retribuita. Gli interessati possono contattarmi direttamente ai recapiti presenti in coda all'e-mail, inviando il relativo curriculum vitae. Spero di avere fatto cosa gradita postando questo annuncio. In caso contrario, mi scuso per il disturbo. Saluti, Giandomenico Sica Polimetrica Onlus Corso Milano 26 20052 Monza Mi Italia Tel/Fax: 039.2301829 E-mail: g.sica chiocciola polimetrica.org -- http://mail.python.org/mailman/listinfo/python-list
Re: send an email with picture/rich text format in the body
Ben Finney wrote: > "anya" <[EMAIL PROTECTED]> writes: > > >>Acctualy there is a solution: >>see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/473810 > > > Again, sending anything but plain text as the message body ensures > that your message is unreadable to a large number of people using a > variety of software. It's your choice whether to restrict your > audience in this way, but know that that's what you're doing. 90% of users are non-technical users who use standard email readers, that can easily read html messages. In my experience the kind of user that receives emails with html and pictures often prefer it that way. So why bother with the lecture? I cannot remember when I have last received a relevant email that I could not read in text mode. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 -- http://mail.python.org/mailman/listinfo/python-list
Re: how to clear up a List in python?
Op 2006-05-26, Steve Holden schreef <[EMAIL PROTECTED]>: > vbgunz wrote: >>>I guess Fredrik's message was more along the lines of ``don't try to >>>"help" others after a week or two toying with the language because you >>>might be offering disservice, despite your good intentions; leave this >>>to more experienced users``. The words might have been a bit harsher >>>but that's just his style; you'll get used to it if you hang around >>>here often. >> >> >> I much rather stand corrected than to silently remain ignorant. I take >> revision of my solution for all it's worth but to be belittled without >> correction is arrogant and unnecessary. I've been working with Python >> for several months now and I feel I know plenty *but* I am still >> learning. >> >> I personally never had to clear a list. I never thought of Roberts >> answer and my reasoning is in Roberts message. In the end I stood >> correct because Robert was nice enough to answer two birds with one >> stone. Fredrik on the other hand had nothing positive to add and his >> message seemed gestapo. >> >> Where I come from and how I grew up is quite simple. A wrong answer is >> better than no answer and a worthless remark is worth garbage. Why? >> Because no right answer is gospel and no answer no matter how dumb is >> cause for discourtesy. I tried and thats the bottom line. >> > Frankly I can't agree that a wrong answer is better than no answer, > despite my frequent strategy of opining that something is impossible > just so the cleverer denizens of c.l.py will prove me wrong. A wrong > answer requires correction by people who know the "right" answer, so you > end up consuming group bandwidth and mindshare unnecessarily. > > I am assuming the part of Fredrik's post that "seemed gestapo" to you > is """if you don't know how to do things, you don't need to post.""" But if we all wait until we are perfectly sure that the answer we will provide is correct, then no-one will need to answer. I have even seen Fredrik post an answer that IMO was at least outdated. > Please read this carefully, as Fredrik's use of language is precise: he > doesn't say you *shouldn't* post, he says you don't *need to*. This is > good advice, because posting a lame solution too quickly, while > reflecting an earnest and praiseworthy desire to help, can often lead to > trouble with some of the less patient members of our community. Maybe those less patient members should take the same advise: They don't need to react. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: why not in python 2.4.3
Also with ascii the function does not work. -- http://mail.python.org/mailman/listinfo/python-list
Re: sort a dictionary by keys in specific order
spohle wrote: > hi i have a normal dictionary with key and value pairs. now i wanna > sort by the keys BUT in a specific order i determine in a list !? any > ideas > > dic = {'key1':'value1', 'key2':'value2', 'key3':'value3'} > > list = [key2, key3, key1] > You could use the seqdict package at http://home.arcor.de/wolfgang.grafen/Python/Modules/Modules.html Regards Wolfgang -- http://mail.python.org/mailman/listinfo/python-list
Re: HTMLParser chokes on bad end tag in comment
Miki: >You can also check out BeautifulSoup >(http://www.crummy.com/software/BeautifulSoup/) which is less strict >than the regular HTML parser. Yes, thanks. Ik this case it was my sitechecker which checks for syntax and broken links, so it was supposed to find the syntax error. BeautifulSoup is not very well suited for validators :-) -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list
RE: Quote ? [was: John Bokma harassment]
Chris Uppal ([EMAIL PROTECTED]) wrote: > Geoffrey Summerhayes wrote: > > > After you kill Navarth, will it be nothing but gruff and deedle > > with a little wobbly to fill in the chinks? > > Where does that come from ? It sounds like a quote, > and Navarth is a Jack Vance name (and /what/ a character), > but I don't remember the rest of it occurring in Vance. Trullion: Alastor 2262, a planet with a collectivist, sort-of-communist government, a huge population, and a crumbling infrastructure -- 'gruff' and 'deedle' are sweet desserts much loved by the population. I think all three of the Alastor novels have been collected in a single volume... [click click click...] Yep, ISBN 0312869525. Classic Jack Vance, and well worth reading. -- Walt -- http://mail.python.org/mailman/listinfo/python-list
Re: Any other config parsing modules besides ConfigParser ?
ConfigObj? http://www.voidspace.org.uk/python/configobj.html - Pad. -- http://mail.python.org/mailman/listinfo/python-list
Re: dynamically loaded libraries
mhearne808 wrote: > I have a question about how dynamically loaded C++ modules work, which > I will phrase as a hypothetical scenario involving the Numeric module. > Please understand that I don't really care about Numeric per se, it's > just a useful example of a module that defines a generally useful data > type. > > Let's say I want to create a C++ Python extension module that has > methods accepting the Numeric array type as input, and also create > these arrays as output. > > In order to make this work, do I have to statically link against the > Numeric source, or do I only have to include the headers, under the > assumption (??) that the Numeric functionality will be available > because the Python executable has dynamically loaded it? You'll only need the dynamic libs. Of course they must be available on link- as well as run-time. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: itertools.count() as built-in
Zipping an xrange? I'm having trouble visualizing how you do that to avoid x*i+y. -Janto -- http://mail.python.org/mailman/listinfo/python-list
Any other config parsing modules besides ConfigParser ?
Are there any other good config parser modules for python? I am looking for something a bit more versatiles than ConfigParser. Thank you. -- To be updated... -- http://mail.python.org/mailman/listinfo/python-list
Re: html 2 plain text
[EMAIL PROTECTED] wrote: > text=re.sub(r'(?s)\<.+?\>', '', html_text) > (this will keep html entities, though) here's a variation that handles that too: http://effbot.org/zone/re-sub.htm#strip-html -- http://mail.python.org/mailman/listinfo/python-list
Re: itertools.count() as built-in
Oops. The messed-up version wasn't supposed to be messed-up. Two mistakes on one line. Which kinda proves my point :) I'd much rather use the count version than (1) or (2). (1) has the problem of having "incorrect" values the rest of the time in the loop and (2) is going to an extreme just to avoid an import of count. Your zipwithcount doesn't look as obvious as for n, a, b in zip(count(), A, B) but is still easier to read than for n, (a, b) in enumerate(zip(A, B)) -Janto -- http://mail.python.org/mailman/listinfo/python-list
Re: HTMLParser chokes on bad end tag in comment
Hello Rene, You can also check out BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/) which is less strict than the regular HTML parser. HTH, Miki http://pythonwise.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list
Last Call - proposals for talks in the business and application track at EP 2006
In 2006, EuroPython will be from the 3rd to the 5th of July at CERN, near Geneva in Switzerland. In business & applications we want to hear about how you made your fortune with Python. Show us YOUR interesting released Python applications. Describe your fabulous business models with Open Source Software. Report about your pub cashier solution in Python and how you solved the challenges of longer opening hours. Narrate the background stories about your next generation search engine which has just gone live. Explain us the technique, tell us the story, paint your business model! Show us how YOU got affluent, opulent, pecunious, proliferative, prosperous and wealthy - all using Python! Do you use Python to make big business in the lumber sawing or porn industrie? Let us know how! Move up to http://www.europython.org/sections/tracks_and_talks/announcements/call-for-proposals and submit your proposal. DEADLINE is 2006-05-31 - so do not hesitate any further! All who still need to know how to get rich and improve their love life using Python: you are heartly invited to register for EuroPython 2006 via the website http://www.europython.org The "normal fee" is 190 for three days of seminars and a fine conference dinner. In addition to our great conference, you have the possibility to visit CERN! Maybe you read about it in Angel & Demons ("Illuminati" in German) from Dan Brown; maybe you know that Sir Tim Berners-Lee invented the World Wide Web there. You will have the chance to eat in canteens with the highest probability anywhere in the world to stand in queue with a future or past Nobel Prize Winner. You can learn about the technologies that will power Web 2.5 and above at the place where Web 0.1 up to Web 1.0 were developed. CERN says about itself: "The world's largest particle physics laboratory ... where the web was born!". As a German you are culturally obligued to go the place where they try to find out "was die Welt / in ihrem innersten zusammenhält". (So that I may perceive whatever holds / The world together in its inmost folds (Faust I)) - learn about that place at www.cern.ch Harald Armin Massa persuadere et programmare -- http://mail.python.org/mailman/listinfo/python-list