ANN: Shakya PyGTK Framework/IDE 0.1.8 released
Shakya is a Free Software (GPL) framework for easy and quickly building powerfull applications with Python and PyGTK. Besides, there is also an IDE, made with this same framework, thus users can graphically desing Shakya/PyGTK applications -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Dr. Dobb's Python-URL! - weekly Python news and links (Apr 18)
QOTW: Darn. I finally say something that gets into Quote of the Week, and it's attributed to someone else! -- Greg Ewing (we think) http://groups-beta.google.com/group/comp.lang.python/msg/15b836a557afccb2 If there were something wrong with the API, Guido would have long since fired up the time machine and changed the timeline so that all would be as right as rain. - Raymond Hettinger Get real. I can't imagine using anything so complex. -- Scott David Daniels, in response to a suggestion to try (1j-1) as a counting base Continuations for Curmudgeons: http://www.intertwingly.net/blog/2005/04/13/Continuations-for-Curmudgeons Textual watermarks with Python Imaging Library: http://www.livejournal.com/users/gniemeyer/10279.html The new Python Cookbook is out of date already: http://42.blogs.warnock.me.uk/2005/04/oreillycom_onli.html Thunks for nothing: http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bbb6f71ff27f83a6/282bc755d5be3f62 http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/6e50601e8b1d8d18/db4f746b8b4d76ea A tutorial for building a simple to-do list application using WSGIKit, SQLObject, and Zope Page Templates: http://wsgikit.org/docs/TodoTutorial.html What can WSGIKit do for you? http://blog.ianbicking.org/what-can-wsgikit-do-for-you.html The Participatory Culture Foundation's desktop video player - video over BitTorrent: http://www.participatoryculture.org/ Next-generation distributed version control: http://www.bazaar-ng.org/ Will LAMP eclipse Java? http://news.com.com/2061-10795_3-5663085.html Does the fact that Python 2.4 is built using VC++ on Windows give us a problem? http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bccb45b7dae7ddd5/7a91ce5a9541221c Look up IP addresses by country: http://www.livejournal.com/users/zestyping/111325.html Python 2.3.2 for PalmOS: http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/1d835f30343cabec/4efb02adafe3f7b5 Everything Python-related you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the traditional center of Pythonia http://www.python.org Notice especially the master FAQ http://www.python.org/doc/FAQ.html PythonWare complements the digest you're reading with the marvelous daily python url http://www.pythonware.com/daily Mygale is a news-gathering webcrawler that specializes in (new) World-Wide Web articles related to Python. http://www.awaretek.com/nowak/mygale.html While cosmetically similar, Mygale and the Daily Python-URL are utterly different in their technologies and generally in their results. For far, FAR more Python reading than any one mind should absorb, much of it quite interesting, several pages index much of the universe of Pybloggers. http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog http://www.planetpython.org/ http://mechanicalcat.net/pyblagg.html comp.lang.python.announce announces new Python software. Be sure to scan this newsgroup weekly. http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce Brett Cannon continues the marvelous tradition established by Andrew Kuchling and Michael Hudson of intelligently summarizing action on the python-dev mailing list once every other week. http://www.python.org/dev/summary/ The Python Package Index catalogues packages. http://www.python.org/pypi/ The somewhat older Vaults of Parnassus ambitiously collects references to all sorts of Python resources. http://www.vex.net/~x/parnassus/ Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ The Python Business Forum further[s] the interests of companies that base their business on ... Python. http://www.python-in-business.org Python Success Stories--from air-traffic control to on-line match-making--can inspire you or decision-makers to whom you're subject with a vision of what the language makes practical. http://www.pythonology.com/success The Python Software Foundation (PSF) has replaced the Python Consortium as an independent nexus of activity. It has official responsibility for Python's development and maintenance. http://www.python.org/psf/ Among the ways you can support PSF is with a donation. http://www.python.org/psf/donate.html Kurt B. Kaiser publishes a weekly report on faults and patches.
PyFit 0.7a1
I'm pleased to announce that PyFit 0.7a1 is now available in the file sections of the Extreme Programming and FitNesse Yahoo groups. This version implements most of the Fit Library, and changes needed to bring the package into conformance with the Fit 1.1 specification. It also brings it to the level of FitNesse 20050405, plus additional features. John Roth April 18, 2005 -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Re: def a((b,c,d),e):
Thanks for pointing this out. However I see no atrocity potential here -- what did you have in mind? Bad choice of words. I meant obfuscated, something like def z(((a, b), (c, d)), e, f): pass but much worse. But it looks like there is nothing unusual about it after all. Oh, well... AdSR -- http://mail.python.org/mailman/listinfo/python-list
module MySQLdb is missing in python 2.3.3
Dear All, I am using python 2.3.3 version. If I try to import MySQLdb. Here I found the following error importError: No module named MySQLdb. So what I need to do for this ?. How I need to install this MySQLdbo. praba Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- http://mail.python.org/mailman/listinfo/python-list
Re: Inelegant
Bengt Richter wrote: I never liked any of the solutions that demand bracketing the string with expression brackets, but I just had an idea ;-) Or for an even more twisted idea: from textwrap import dedent class _Dedent(type): def __new__(cls, name, bases, dict): if name == *: # for bootstrapping return type.__new__(cls, name, bases, dict) return dedent(dict['__doc__']) DedentedString = _Dedent(*, (), {}) # # Usage example # class foo(DedentedString): This is a dedented (or perhaps demented?) string. It spans multiple lines. print type(foo) print foo The output is: type 'str' This is a dedented (or perhaps demented?) string. It spans multiple lines. -- Greg Ewing, Computer Science Dept, University of Canterbury, Christchurch, New Zealand http://www.cosc.canterbury.ac.nz/~greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating formatting strings
On Mon, 18 Apr 2005 16:24:39 -0400, Steve Holden [EMAIL PROTECTED] wrote: I was messing about with formatting and realized that the right kind of object could quite easily tell me exactly what accesses are made to the mapping in a string % mapping operation. This is a fairly well-known technique, modified to tell me what keys would need to be present in any mapping used with the format. snip code I've been wondering whether it's possible to perform a similar analysis on non-mapping-type format strings, so as to know how long a tuple to provide, or whether I'd be forced to lexical analysis of the form string. When I was playing with formatstring % mapping I thought it could be useful if you could get the full format specifier info an do your own complete formatting, even for invented format specifiers. This could be done without breaking backwards compatibility if str.__mod__ looked for a __format__ method on the other-wise-mapping-or-tuple-object. If found, it would call the method, which would expect def __format__(self, ix,# index from 0 counting every %... format name, # from %(name) or '' width, # from %width.prec prec, # ditto fc,# the format character F in %(x)F all# just a copy of whatever is between % and including F ): ... This would obviously let you handle non-mapping as you want, and more. The most popular use would probably be intercepting width in %(name)widths and doing custom formatting (e.g. centering in available space) for the object and returning the right size string. Since ix is an integer and doesn't help find the right object without the normal tuple, you could give your formatting object's __init__ method keyword arguments to specify arguments for anonymous slots in the format string, conventionally naming them a0, a1, a2 etc. Then later when you get an ix with no name, you could write self.kw.get('%as'%ix) to get the value, as in use like '%(name)s %s' % Formatter(a1=thevalue) # Formatter as base class knows how to do name lookup Or is this just idearrhea? Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: pre-PEP: Simple Thunks
On Mon, 18 Apr 2005 21:11:52 -0700, Brian Sabbey [EMAIL PROTECTED] wrote: Ron_Adam wrote: The load and dump would be private to the data class object. Here's a more complete example. import pickle class PickledData(object): def __init__(self, filename): self.filename = filename self.L = None try: self._load() except IOError: self.L = [] def _load(self): f = open(self.filename, 'r') self.L = pickle.load(f) f.close() def _update(self): f = open(self.filename, 'w') pickle.dump(self.L, f) f.close() def append(self, record): self.L.append(record) self._update() # add other methods as needed ie.. get, sort, clear, etc... pdata = PickledData('filename') pdata.append('more data') pdata.append('even more data') print pdata.L ['more data', 'even more data'] This has the same issues as with opening and closing files: losing the 'dump', having to always use try/finally if needed, accidentally re-binding 'p', significantly more lines. Moreover, class 'Pickled' won't be as readable as the 'pickled_file' function above since 'load' and 'dump' are separate methods that share data through 'self'. A few more lines to create the class, but it encapsulates the data object better. It is also reusable and extendable. This class isn't reusable in the case that one wants to pickle something other than an array. Every type of object that one would wish to pickle would require its own class. ...Or in a function, or the 3 to 6 lines of pickle code someplace. Many programs would load data when they start, and then save it when the user requests it to be saved. So there is no one method fits all situations. Your thunk example does handle some things better. Here's yet another way to do it, but it has some limitations as well. import pickle def pickle_it(filename, obj, commands): try: f = open(filename, 'r') obj = pickle.load(f) f.close() except IOError: pass for i in commands: i[0](i[1]) f = open(filename, 'w') pickle.dump(obj, f) f.close() file = 'filename' L = [] opps = [ (L.append,'more data'), (L.append,'even more data') ] pickle_it(file, L, opps) Also, this implementation behaves differently because the object is re-pickled after every modification. This could be a problem when writing over a network, or to a shared resource. -Brian In some cases writing to the file after ever modification would be desired. A way around that would be to use a buffer of some sort. But then again, that adds another level of complexity and you would have to insure it's flushed at some point which get's back to the issue of not closing a file. Thanks for explaining how thunks works. I'm still undecided on whether it should be built in feature or not. I would rather have a way to store a block of code and pass it to a function, then execute it at the desired time. That would solve both the issue where you would use a thunk, and replace lambdas as well. But I understand there's a lot of resistance to that because of the potential abuse. Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list
Re: Nokia to speak at Python-UK next week
Nick == Nick Craig-Wood [EMAIL PROTECTED] writes: Nick Not entirely on topic, but does anyone know if there is a Nick series 80 python? Or if the series 60 python runs on a Nick series 80 phone (eg communicator 9300/9500)? Nope nope. It would be easy-ish to get Python working on a console level on 9300/9500 if there was access to the source code... There's also an open source implementation of Python for UIQ (UI toolkit used by SonyEricsson) See http://www.mobilewhack.com/programming/python/ -- Ville Vainio http://tinyurl.com/2prnb -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: an unchanging URL for Python documentation
Steve [EMAIL PROTECTED] wrote: I propose that an additional a URL be set up for the Python HTML documentation. This URL will always contain the current version of the documentation. Suppose we call it current. Then (while 2.4 is still the current version) the documentation for the os module would also be available at http://python.org/doc/current/lib/module-os.html. did you check that link before you posted it? /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: an unchanging URL for Python documentation
Fredrik Lundh wrote: did you check that link before you posted it? Works here. Your browser is probably concluding the trailing . is part of the URL, rather than sentence punctuation :-). -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San Jose, CA, USA 37 20 N 121 53 W AIM erikmaxfrancis Dear World: I am leaving because I am bored. -- George Sanders (in his suicide note) -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: an unchanging URL for Python documentation
Erik Max Francis wrote: Fredrik Lundh wrote: did you check that link before you posted it? Works here. Your browser is probably concluding the trailing . is part of the URL, rather than sentence punctuation :-). No, Fredrik knows that it works. The OP seemed to be under the impression that it didn't (and was posting to propose that it should exist and behave as it actually does). -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the graves of dreams allowed to die. -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list
Re: module MySQLdb is missing in python 2.3.3
http://sourceforge.net/projects/mysql-python Arjen praba kar wrote: Dear All, I am using python 2.3.3 version. If I try to import MySQLdb. Here I found the following error importError: No module named MySQLdb. So what I need to do for this ?. How I need to install this MySQLdbo. praba Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- http://mail.python.org/mailman/listinfo/python-list
Re: pre-PEP: Suite-Based Keywords - syntax proposal
Bengt Richter wrote: [...] Um, I think that's too narrow for where. Consider foo = f1; bar=f2; x=k1; y=k2 foo(x)*bar(y)[3].attr now should foo(x)*bar(y)[3].attr where: foo = f1; bar=f2; x=k1; y=k2 I think we are diverging again. You are right with Your objection about my claim of generality but I'm completely against the latter statement not only because foo(x) where: foo = f1 is not much better than foo(x) where: def foo(): # do some stuff which should clearly raise an exception and be abandoned. After all I start backtracking: the purpose of defining suites is still prevention of namespaces pollution with helper-functions not a sake of it's own and not inventing of a suite-based programming style for everything. The examples You presented have become almost pathological examples of what should be prevented and where syntax cannot be rigid enough. So there are following requierements about we seem to agree: - define suites on a functions-call scope in order to define helper functions that would otherwise pollute external namespaces - mark the func-call-scope by some keyword either with or where because it has to be separated from the calling environment both for consistency and user friendlyness - Simple matching rules for both keyword-parameters and argument-tuples. Make explicit which kind of inference rule is selected. I think that my last proposal I finally distilled from our discussion would pretty much fullfill all three requirements whereas that of Andrey Tatarinov would be somewhat more restrictive and fullfills only the first two. Ciao, Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: Trouble Installing TTX/FontTools (asks for .NET Framework Packages)
This problem may be addressed here: http://sourceforge.net/mailarchive/message.php?msg_id=1702374 Apparently setup.py tries to compile a c file, which of course doesn't work if there's no compiler. -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python 2.3.2 for PalmOS available
Lucio Torre wrote: Make sure you write the expression in the lower text-area, and then press the send button. This should do it. Ah, that's the trick! It wasn't obvious that there were two text areas, and I intuitively wrote commands at the python prompt. Problem solved. Say, are floats implemented? Comparisons seem to work, but print'ing doesn't: #v+ 1.0 0.5 True print 1.23 %.*g #v- -- Klaus Alexander Seistrup Magnetic Ink, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Enumerating formatting strings
Steve Holden wrote: I was messing about with formatting and realized that the right kind of object could quite easily tell me exactly what accesses are made to the mapping in a string % mapping operation. This is a fairly well-known technique, modified to tell me what keys would need to be present in any mapping used with the format. ... I've been wondering whether it's possible to perform a similar analysis on non-mapping-type format strings, so as to know how long a tuple to provide, or whether I'd be forced to lexical analysis of the form string. PyString_Format() in stringobject.c determines the tuple length, then starts the formatting process and finally checks whether all items were used -- so no, it's not possible to feed it a tweaked (auto-growing) tuple like you did with the dictionary. Here's a brute-force equivalent to nameCount(), inspired by a post by Hans Nowak (http://mail.python.org/pipermail/python-list/2004-July/230392.html). def countArgs(format): args = (1,) * (format.count(%) - 2*format.count(%%)) while True: try: format % args except TypeError, e: args += (1,) else: return len(args) samples = [ (, 0), (%%, 0), (%s, 1), (%%%s, 1), (%%%*.*d, 3), (%*s, 2), (%s %*s %*d %*f, 7)] for f, n in samples: f % ((1,)*n) assert countArgs(f) == n Not tested beyond what you see. Peter -- http://mail.python.org/mailman/listinfo/python-list
Question about python 2.4 documentation
Hello all. I have a small question concerning the functions open(...) and file(...) with python 2.4 In the online version of the documentation in the build-in functions (section 2.1 http://docs.python.org/lib/built-in-funcs.html) here is an quote of the file(...) doc : The file() constructor is new in Python 2.2 and is an alias for open(). Both spellings are equivalent. The intent is for open() to continue to be preferred for use as a factory function which returns a new file object. The spelling, file is more suited to type testing (for example, writing isinstance(f, file)). In my installed python 2.4 documentation the correspondig quote : The file() constructor is new in Python 2.2. The previous spelling, open(), is retained for compatibility, and is an alias for file(). If I understand well, in my version it is recommended to use file() function instead of open(), and in the online version it is the opposite. what is the favorite function you recommend me to use ? Thanks for your responses . -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter Event Types
On 18 Apr 2005 13:48:50 -0700, codecraig [EMAIL PROTECTED] wrote: Hi, When I do something like. s = Scale(master) s.bind(ENTER, callback) def callback(self, event): print event.type I see 7 printed out. Where are these constants defined for various event types? Basically i want to do something like... def callback(self, event): if event.type == ENTER: print You entered The usual way is to bind different callbacks on different events. So you won't have to test the event type in your callback, since the callback itself will already have been selected from the event type. If you insist in doing it the way you mention, you can always do: ENTER_EVENT = 1 KEYPRESS_EVENT = 2 # ... def myCallback(evtType, evt): if evtType == ENTER_EVENT: # some action... elif evtType == KEYPRESS_EVENT: # some other action... # ... myWidget.bind('Enter', lambda evt: myCallback(ENTER_EVENT, evt)) myWidget.bind('KeyPress', lambda evt: myCallback(KEYPRESS_EVENT, evt)) I can't really see what it will be good for however... HTH -- python -c 'print .join([chr(154 - ord(c)) for c in U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-])' -- http://mail.python.org/mailman/listinfo/python-list
Re: def a((b,c,d),e):
François Pinard wrote: The most useful place for implicit tuple unpacking, in my experience, is likely at the left of the `in' keyword in `for' statements (and it is even nicer when one avoids extraneous parentheses). ... and would be nicest (IMO) if default arguments and *varargs were allowed too; check http://tinyurl.com/dcb2q for a relevant thread. George -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about python 2.4 documentation
Fouff wrote: I have a small question concerning the functions open(...) and file(...) with python 2.4 The intent is for open() to continue to be preferred for use as a factory function which returns a new file object. versus The previous spelling, open(), is retained for compatibility, and is an alias for file(). what is the favorite function you recommend me to use ? The former has BDFL blessing. Let Guido speak: http://mail.python.org/pipermail/python-dev/2004-July/045921.html Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: fpectl
Thanks for this answer. Did you forward this info to python-dev ? Cheers, SB -- http://mail.python.org/mailman/listinfo/python-list
Why does python class have not private methods? Will this never changed?
Python is an oop language, but why does it hava not private methods? And it even has not real private fields. Will this never changed? Private stuff always makes programming much easier. -- -- http://mail.python.org/mailman/listinfo/python-list
Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2
Hi, Many thanks for this. I am constrained to use MSVC6 (customer) but will look to see if I can run VC7.1 alongside VC6. However, I am still unable to decompress/unpack the downloaded source files even with their extensions amended. Am I really the only person having this difficulty? Hey ho, Bill James Carroll [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Bill, Python 2.4 requires VC7.1 I just ran into this recently. Once I installed VC7.1, I could easily compile the Python source to create a debug lib. Winzip should be able to read the python source tarball... There is one trick though. Once you download it, it might get renamed to python.tar.gz.tar and the trick is to rename the file's extension to .tar.gz or (my preference) .tgz. If it really is a bzip2 file, then you'll need some sort of bunzip. I use the cygnus version, but I don't remember having to do anything out of the way for the python source. -Jim On 4/18/05, Bill Davy [EMAIL PROTECTED] wrote: A.B., Khalid [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Bill Davy wrote: I downlaoded and installed http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi I'm trying to build an extension using SWIG 1.3.24 and the linker needs python24_d.lib (I do not have the DLL either). I've not found it in any of the downloads. I am no expert in MSVC6, but it sounds like maybe you need to supply the no-debug switch in your extention setup.py file: /d NDEBUG. In case that does not work and help on this is not forthcoming, you can always try pyMinGW[1]. Regards, Khalid Hmm, that's one possibility but I really do need to keep the debugger version going. I'm only just getting started. Any other suggestions? -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2
Hi Jim, I'm not sure that it would be the complete answer, but could you zip me python24_d.(lib/dll/exp) ? We are not on VC7.1 (our customer has a mountain of legacy code) and I do not want to be incompatible with them. I will see if I can run MSVC6 alongside VC7.1 but have to put customer compatibility firts (I have tried to edge them on but without success). Many thanks Bill -Original Message- From: James Carroll [mailto:[EMAIL PROTECTED] Sent: 18 April 2005 18:10 To: Bill Davy; python-list@python.org Subject: Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2 Hi Bill, Python 2.4 requires VC7.1 I just ran into this recently. Once I installed VC7.1, I could easily compile the Python source to create a debug lib. Winzip should be able to read the python source tarball... There is one trick though. Once you download it, it might get renamed to python.tar.gz.tar and the trick is to rename the file's extension to tar.gz or (my preference) .tgz. If it really is a bzip2 file, then you'll need some sort of bunzip. I use the cygnus version, but I don't remember having to do anything out of the way for the python source. -Jim On 4/18/05, Bill Davy [EMAIL PROTECTED] wrote: A.B., Khalid [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Bill Davy wrote: I downlaoded and installed http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi I'm trying to build an extension using SWIG 1.3.24 and the linker needs python24_d.lib (I do not have the DLL either). I've not found it in any of the downloads. I am no expert in MSVC6, but it sounds like maybe you need to supply the no-debug switch in your extention setup.py file: /d NDEBUG. In case that does not work and help on this is not forthcoming, you can always try pyMinGW[1]. Regards, Khalid Hmm, that's one possibility but I really do need to keep the debugger version going. I'm only just getting started. Any other suggestions? -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Nokia to speak at Python-UK next week
Ville Vainio [EMAIL PROTECTED] wrote: Nick == Nick Craig-Wood [EMAIL PROTECTED] writes: Nick Not entirely on topic, but does anyone know if there is a Nick series 80 python? Or if the series 60 python runs on a Nick series 80 phone (eg communicator 9300/9500)? Nope nope. It would be easy-ish to get Python working on a console level on 9300/9500 if there was access to the source code... Ah well... Well hopefully someone from c.l.py will go to the talk and can report back on progress on series 80 python. There's also an open source implementation of Python for UIQ (UI toolkit used by SonyEricsson) See http://www.mobilewhack.com/programming/python/ Interesting web site - thanks. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Name/ID of removable Media: how?
I am trying to find out (using Python under windows) the name of a CD that is currently in the drive specified by a path name. And while I am at it, I'd also like to know whether the specified drive contains a CD at all, and whether the drive is actually a CD drive. AFAIK, Python doesn't provide a way to do it, and a search in the web yielded only soutions for Linux. Can anyone show me a solution that works with windoze? TIA, Heiko -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this neverchanged?
could ildg [EMAIL PROTECTED] wrote: Private stuff always makes programming much easier. says who? /F -- http://mail.python.org/mailman/listinfo/python-list
RE: Name/ID of removable Media: how?
[Heiko Selber] | I am trying to find out (using Python under windows) the name | of a CD that | is currently in the drive specified by a path name. | | And while I am at it, I'd also like to know whether the | specified drive | contains a CD at all, and whether the drive is actually a CD drive. Try this: code import wmi c = wmi.WMI () for i in c.Win32_CDROMDrive (): print i.Caption, i.VolumeName, i.VolumeSerialNumber /code I haven't answered all your questions, but I'm willing to bet that you can do pretty much what you want with WMI. There are also the pywin32 functions which give you some of this (maybe all, don't know; haven't tried). More info here: http://timgolden.me.uk/python/wmi.html and here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_cdromdrive.asp and here: http://pywin32.sf.net TJG This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this neverchanged?
Trolls? On 4/19/05, Fredrik Lundh [EMAIL PROTECTED] wrote: could ildg [EMAIL PROTECTED] wrote: Private stuff always makes programming much easier. says who? /F -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: pre-PEP: Suite-Based Keywords - syntax proposal
On 19 Apr 2005 00:16:32 -0700, Kay Schluehr [EMAIL PROTECTED] wrote: Bengt Richter wrote: [...] Um, I think that's too narrow for where. Consider foo = f1; bar=f2; x=k1; y=k2 foo(x)*bar(y)[3].attr now should foo(x)*bar(y)[3].attr where: foo = f1; bar=f2; x=k1; y=k2 I think we are diverging again. You are right with Your objection about my claim of generality but I'm completely against the latter statement not only because foo(x) where: foo = f1 is not much better than foo(x) where: def foo(): # do some stuff which should clearly raise an exception and be abandoned. Why do you say that? foo(x) is just a call of whatever foo is bound to. The where: suite supplies a transient namespace where foo happens to be defined in the conventional way. This allows definition and call of foo without binding it in the caller's local namespace, much like (lambda(): do_some_stuff)() IMO that's a perfectly valid use. You don't have to worry that your def foo():... will clobber some other foo. After all I start backtracking: the purpose of defining suites is still prevention of namespaces pollution with helper-functions not a sake of it's own and not inventing of a suite-based programming style for everything. The examples You presented have become almost pathological examples of what should be prevented and where syntax cannot be rigid enough. You don't have to write what you consider to be pathological, but this becomes sort of a free speech issue. I.e., don't impose a style-censoring spell-checker on me please ;-) So there are following requierements about we seem to agree: - define suites on a functions-call scope in order to define helper functions that would otherwise pollute external namespaces Why just function call? You realize that a function call is just the effect of (arglist) tacked on the tail of an expression that is not necessarily just a name. E.g., notice the possibilities the parser goes through before finding that foo() is a simple name expression with a () trailer: [ 1:18] C:\pywk\parse\astpy24 debg.py -full foo() 'file_input' 'stmt' 'simple_stmt' 'small_stmt' 'expr_stmt' 'testlist' 'test' 'and_test' 'not_test' 'comparison' 'expr' 'xor_expr' 'and_expr' 'shift_expr' 'arith_expr' 'term' 'factor' 'power' 'atom' NAME 'foo' 'trailer' LPAR '(' RPAR ')' NEWLINE '' ENDMARKER '' What about instance.method(args) as a call? Should you not be able write instance.method(*args) where: args = [] # append various values to args here, # in single statements and/or using looping etc. to specify complex args in a where? That looks like [ 2:18] C:\pywk\parse\astpy24 debg.py -full instance.method(*args) 'file_input' 'stmt' 'simple_stmt' 'small_stmt' 'expr_stmt' 'testlist' 'test' 'and_test' 'not_test' 'comparison' 'expr' 'xor_expr' 'and_expr' 'shift_expr' 'arith_expr' 'term' 'factor' 'power' 'atom' NAME 'instance' 'trailer' DOT '.' NAME 'method' 'trailer' LPAR '(' 'arglist' STAR '*' 'test' 'and_test' 'not_test' 'comparison' 'expr' 'xor_expr' 'and_expr' 'shift_expr' 'arith_expr' 'term' 'factor' 'power' 'atom'
Re: Name/ID of removable Media: how?
There are sure thousand ways of doing it with windoze. Here one of them (NOT tested) in form of code snippets you can rearrange for your purpose: import win32com.client axFSO = win32com.client.Dispatch(Scripting.FileSystemObject) # SCRRUN.DLL axLstDrives = axFSO.Drives dctAXaxFSO_NumCodeAsKeyVsTypeDescrText = { 0 : unknown type of drive , 1 : drive with removable medium (e.g. Floppy) , 2 : fixed drive (e.g. harddisk) , 3 : remote (i.e. network) drive , 4 : CD-ROM drive , 5 : RAM-Disk drive } lstdriveLetterOFonSYSTstorageDevice = [] lstdriveTypeOFonSYSTstorageDevice = [] for axDrive in axLstDrives: if(axDrive.IsReady): # checks if a CD is inserted lstdriveLetterOFonSYSTstorageDevice.append( axDrive.DriveLetter.encode() ) lstdriveTypeOFonSYSTstorageDevice.append( dctAXaxFSO_NumCodeAsKeyVsTypeDescrText[axDrive.DriveType] ) # axDrive.SerialNumber # axDrive.VolumeName.encode() # for more of this kind just check out e.g. in the by Microsoft # free available JScript tutorial the chapter # FileSystemObject Sample Code #:if #:for Hope this helps. Claudio Heiko Selber [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I am trying to find out (using Python under windows) the name of a CD that is currently in the drive specified by a path name. And while I am at it, I'd also like to know whether the specified drive contains a CD at all, and whether the drive is actually a CD drive. AFAIK, Python doesn't provide a way to do it, and a search in the web yielded only soutions for Linux. Can anyone show me a solution that works with windoze? TIA, Heiko -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python regex Doc (was: Python documentation moronicities)
send your feedbacks to Steve Holden. (http://www.holdenweb.com/) If he deem it proper, he will paypal me $100 bucks, and you can thank him for the instigation and betterment of the Python doc. Meanwhile, feel free to incorporate my edits into python doc. Xah [EMAIL PROTECTED] http://xahlee.org/ Xah Lee wrote: i have rewrote the Python's re module documentation. See it here for table of content page: http://xahlee.org/perl-python/python_re-write/lib/module-re.html The doc is broken into 4 sections: * regex functions (node111.html) * regex OOP (re-objects.html) * matched objects (match-objects.html) * regex syntax (re-syntax.html) the regex syntax page i haven't edited, except the introductory first paragraph. The other pages are completely rewritten for about 80%. There are a couple fine points or 3 places in the original doc i can't understand. They are noted as NOTE DOC WRITERS or NEED EXAMPLE HERE. Xah [EMAIL PROTECTED] http://xahlee.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: New Python regex Doc (was: Python documentation moronicities)
On 4/18/05, Jeff Epler [EMAIL PROTECTED] wrote: On Mon, Apr 18, 2005 at 01:40:43PM -0700, Xah Lee wrote: i have rewrote the Python's re module documentation. See it here for table of content page: http://xahlee.org/perl-python/python_re-write/lib/module-re.html For those who have long ago consigned Mr. Lee to a killfile, it looks like he's making an honest attempt to improve Python's documentation here. Alright, I feel like I'm feeding the trolls just by posting in this thread. Just so that nobody else has to read the revised docs, no it doesn't: 1) He didn't really change anything besides the intro page and deleting the matching vs. searching page and the examples page. He also put a couple of hr breaks into the doc. 2) notes like NOTE TO DOC WRITERS: The doc sayz: ... followed by the same drum he's been beating for a while, instead of actually editing the section to be correct. 3) adding MAY NEED AN EXAMPLE HERE instead of actually putting one in Mr Lee, I hope you will submit your documentation changes to python's patch tracker on sourceforge.net. I don't fully agree with some of what you've written (e.g., you give top billing to the use of functions like re.search while I would encourage use of the search method on compiled RE objetcts, and I like examples to be given as though from interactive sessions, complete with and ...), but nits can always be picked and I'm not the gatekeeper to Python's documentation. I'd suggest that he actually make an effort at improving the docs before submitting them. Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Wrapping C++ Class Heirachy in Python
Steve Juranich wrote: I've found the tp_base and tp_bases elements and I've set them to the base type object (and a tuple containing the base type object) before I call PyType_Ready but in Python the base class isn't recognised. Is there anything obvious I'm missing? Well, I can't really recommend without seeing what you did (did you remember the preceding for the type struct? I realised it will be a little difficult to help without seeing my source, but I was hoping someone would point me to some documentation so I wouldn't have to cut my source down to an example suitable for a usenet post. Otherwise, I'd have to recommend Objects/unicodeobject.c in the Python source as a reference for how to do this. Thanks! I was trying to think of a built in object hierarchy in Python, I didn't think of unicode strings. Cheers! Andrew Simple distributed computing with Python... PyLinda - http://www-users.cs.york.ac.uk/~aw/pylinda -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this never changed?
On 4/19/05, could ildg [EMAIL PROTECTED] wrote: Python is an oop language, Yes. Private stuff always makes programming much easier. That contention is, at best, debatable. See http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Veusz 0.5 - a scientific plotting package
On Mon, 18 Apr 2005 13:40:09 -0700, jdh2358 wrote: I'll start by saying that I for one won't criticize you for rolling you own plotting package rather than join forces with an existing project. I've been accused of the same, on more than one occasion :-) But I'm also aware of the problem that this creates -- the tyranny of choice. python is so fun to code in that many developers are looking for a reason to find an existant package inadequate so they have an excuse to write their own replacement. Hence we have a proliferation of web-app frameworks, plotting packages, array objects and so on. There is a lot of duplicated effort in many arenas and it would be nice to collaborate more. True. It's sad that it's just more fun to go off and write something yourself, but it is fun :-) I'm afraid I'm not very good with using other people's codebases. I read over your scipy list of problems that you found in matplotlib -- some were helpful and some, as you note, have been long fixed. One critique you might flesh out for me is the notion that matplotlib's object model is baroque -- most of the developers feel the object model is fairly solid. You weren't by chance, trying to use the procedural pylab (aka matlab) interface, were you, since pylab itself is just a wrapper of the OO matplotlib API? One area in the object model that we plan to change is to make high level plot objects (scatter, error, histogram) etc, proper objects, ala gnuplot. Right now they are methods that generate primitive objects (lines, rectangles, text, etc). I thought I was using the object interface. It seemed strange to me that methods of the axes were used to plot data, draw legends, and so on... It seemed to make much more sense to have these as objects themselves. The main problem is that there's no object you can alter to change their appearance. I quite like the object system I've developed, where the external interface is completely based on building the object hierarchy and setting properties of the objects (plus there is a functional interface, but this is only used rarely for active operations, like fitting data). I wanted an interface where I could twiddle a bit, and change the axis from log to linear, or vertical to horizontal... I wasn't sure which variables in the matplotlib source I could touch and get away with in future releases :-) Another area you identify as a problem with matplotlib is the need to regenerate the entire graph when one property is changed. This is true in one way and false in another. matplotlib does have a proper object model -- eg, you can selectively change the facecolor of a marker w/o regenerating the graph scene. But the *drawing* hierarchy (as opposed to the object hierarchy) needs some work . Once you have changed a property, the entire graph is redrawn. This is a known limitation and will change in the not-too-distant-future. One advantage of working in mainstream in open source software is the network effect. With 10 some-odd developers including institutions such as the U of C, STScI, JPL and NOAA, bugs and limitations of matplotlib tend to be fixed within minutes, days, weeks or months. It looked to me that you could change some properties (like line style) after creating the graph, but other things were hard to change (marker style?). Therefore I deleted the graph and rebuilt it from scratch each time. The way you modify a property is different from how you set it when building a graph, and so it was difficult to create a transparent interface. Your package looks very nice. It specifically addresses two limitations in matplotlib that we would like to address -- a GUI interface for creating figures and a way to save the figure at any point as a high level description (rather than an image). I do wish you had publicly voiced the problems you ran into along the way; I just searched the archives and saw only one post from you on the users list which I answered 28 minutes later with http://sourceforge.net/mailarchive/message.php?msg_id=10124206 after which I never heard from you again. Such response times are fairly typical on the list, but if you don't report the bugs and follow up on the suggested fixes, we can't fix them. Sorry - much of my work was done when I didn't have a very good internet connection, and so it was hard for me to collaborate over bugs. I took the easy option of expanding the small codebase I already have (which I knew pretty well!), over debugging someone else's code. Anyway, nice work on veusz. Are you committed to the GPL license? matplotlib uses a more permissive license (PSF compatible) mainly to encourage contributions from the commercial sector. As you suggest, it is still possible for someone to take the work you've done on the GUI frontend and expose matplotlib as a backend based on your prior experiments. The NASA Jet Propulsion Laboroatory and others are supporting the QT backend, and
Re: uploading/streaming a file to a java servlet
Vasil Slavov wrote: I am working on a school project written in Python (using mod_python) and I need to upload a file to a java servlet. Here are the high-level instructions given by the servlet authors: - Open the file for reading. - Open an HTTP connection to the servlet and get the RequestStream object. - Read bytes from the file and write them to the stream until the entire file has been read. - Close the stream. Is the request supposed to be a GET or POST or ?? I'll assume POST because sending a data stream on a GET is just too ugly. Even so IMO this protocol is perverse and you will have to work around it. You have to avoid putting the request parameters in the request body (which is normal for a POST) and avoid making the data into another request parameter (which would also be normal). Here is how the url looks like: http://10.0.0.21/MillenniumMobile/servlet/com.cerner.capstone.dictation.FileStorageServlet?TransactionName=AddDictationFileFileName=myfile.wavUsername=team1Password=passwordDomain=mobj I am having a hard time figuring out how to translate the above instructions into something which can be implemented in Python. How am I supposed to stream the file. I would try something like this: url = 'http://10.0.0.21/MillenniumMobile/servlet/com.cerner.capstone.dictation.FileStorageServlet?TransactionName=AddDictationFileFileName=myfile.wavUsername=team1Password=passwordDomain=mobj' f = open(datafile, 'rb') data = f.read() # or whatever you need to do to get the actual data into a string f.close() req = urllib2.url_open(url, data) result = req.read() I get a successful XML response with the following code Your description of the protocol doesn't say anything about XML, did you leave something out? Kent -- http://mail.python.org/mailman/listinfo/python-list
MessageBox ONOK?
Hi, How do i connect the onOK of a win32ui MessageBox with the Ok button so that I get to know when the user clicks the Ok button? Regards, Ali -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this never changed?
In article [EMAIL PROTECTED], Simon Brunning [EMAIL PROTECTED] wrote: On 4/19/05, could ildg [EMAIL PROTECTED] wrote: Python is an oop language, Yes. Private stuff always makes programming much easier. That contention is, at best, debatable. See http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21. Nice essay. Now, for another look at the same issue... http://thedailywtf.com/forums/32534/ShowPost.aspx -- http://mail.python.org/mailman/listinfo/python-list
xmlrpclib and binary data as normal parameter strings
Trying something like:: import xmlrpclib svr = xmlrpclib.Server(http://127.0.0.1:8000;) svr.test(\x1btest) Failes on the server with:: xml.parsers.expat.ExpatError: not well-formed (invalid token) (Smaller test-case: xmlrpclib.loads(xmlrpclib.dumps(('\x1btest', Shouldn't this be allowed? From http://www.xmlrpc.com/spec :: Any characters are allowed in a string except and , which are encoded as lt; and amp;. A string can be used to encode binary data. From http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-character :: Consequently, XML processors MUST accept any character in the range specified for Char ... Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] (I'm aware that xmlrpclib.Binary can be used as an ugly work-around.) -- Rune Frøysa -- http://mail.python.org/mailman/listinfo/python-list
Re: Proposal: an unchanging URL for Python documentation
I stand corrected. Not only does what I wanted already exist, it seems to exist in TWO places. For the module index, for instance, there is http://docs.python.org/modindex.html and there also is http://python.org/doc/current/modindex.html Anybody know why there are two different URLs? Which one should be considered the official current documentation URL? (REASON: A person wanting to Wikalong annotate the official current documentation URL would want to know which one to annotate.) -- http://mail.python.org/mailman/listinfo/python-list
Re: xmlrpclib and binary data as normal parameter strings
Rune Froysa wrote: From http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-character :: Consequently, XML processors MUST accept any character in the range specified for Char ... Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] you're looking at the XML 1.1 specification. don't do that. nobody uses 1.1. here's the 1.0 version: http://www.w3.org/TR/REC-xml/#dt-character Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory leak in python
Abhishek S [EMAIL PROTECTED] wrote: I am seeing that the python application is very slowly eating up the memory. i need help to indentify it. what Python application? It start with 11MB and keeps growing by 1 MB around every 30mins. have you checked for growing lists (etc)? /F -- http://mail.python.org/mailman/listinfo/python-list
modules and namespaces
Hello, I thought that this will work: #m1.py def f1(): return string.join('a','a') #m2.py def f2(): return string.join('b','b') #main.py import string import m1 import m2 print f1() print f2() - However it doesn't work until I import the string module into m1 and m2 modules. I found in the manual that imported modules will be searched in the container module first. Is it more efficient to import the string module into main and m1 and m2 than importing only into m1 and m2? Mage -- http://mail.python.org/mailman/listinfo/python-list
Re: xmlrpclib and binary data as normal parameter strings
Rune Froysa [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://www.xmlrpc.com/spec :: Any characters are allowed in a string except and , which are encoded as lt; and amp;. A string can be used to encode binary data. the XMLRPC specification is worded pretty loosely. Obviously characters forbidden in XML will be problematic. From http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-character :: That's XML 1.1; it's very rarely used in practice. Can XMLRPC use XML 1.1? In principle, undefined, as far as I know. In practice, not in Python anyway. -- http://mail.python.org/mailman/listinfo/python-list
Variables variable
Hi folks, Someone know how to make variables variable like in PHP? It's something like this: $a = 'hi' $$a = 'testing' echo $hi 'testing' Regards -- Adriano Monteiro Marques www.gopython.com.br [EMAIL PROTECTED] I'm FREE... Are you? (PYTHON powered) -- http://mail.python.org/mailman/listinfo/python-list
Update Label when Scale value changes
Hi, I am using Tkinter and I have a Label and a Scale. I want to update my label everytime the Scale value changes. What is the best way of doing this? Do i have to bind for every event type? Or is there some better way? If I do have to bind each type of event to the scale, what types occur for a Scale? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: modules and namespaces
However it doesn't work until I import the string module into m1 and m2 modules. I found in the manual that imported modules will be searched in the container module first. Is it more efficient to import the string module into main and m1 and m2 than importing only into m1 and m2? I bet the most efficient is str.join( ('a','b')) The reason is that 'str' is a built-in type. But since new style classes were introduced, they are also real objects with methods. :-) p.s.: Hello Mage. I'm also known as nagylzs at enternet dot hu. Do you remember me from the SQL list? Good to see you here. :-) -- _ Laszlo Nagy web: http://designasign.biz IT Consultantmail: [EMAIL PROTECTED] Python forever! -- http://mail.python.org/mailman/listinfo/python-list
Re: Variables variable
Adriano Monteiro wrote: Hi folks, Someone know how to make variables variable like in PHP? It's something like this: $a = 'hi' $$a = 'testing' echo $hi 'testing' You are most certainly wanting to use dictionaries. Or, if you work with attributes of an object, use getattr. Reinhold -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this never changed?
Roy Smith wrote: Simon Brunning [EMAIL PROTECTED] wrote: On 4/19/05, could ildg [EMAIL PROTECTED] wrote: Private stuff always makes programming much easier. That contention is, at best, debatable. See http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21. Nice essay. Now, for another look at the same issue... http://thedailywtf.com/forums/32534/ShowPost.aspx Where in the original posting or in the 86 replies in that massive page are we supposed to find something pointed about this issue? Also, do any of the people there use a language like Python, or are you merely pointing to one example in another language (Java) where, perhaps, private should have been used? Or does this actually back up Simon's point? You don't say and it's really unclear what your point is. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Working with method-wrapper objects
I think I was a little bit unspecific in my last mail. I would like to see some description about method-wrapper and wrapper_descriptor objects. I dont' understand the following behaviour: type([].__str__) type 'method-wrapper' type(object.__str__) type 'wrapper_descriptor' type(object().__str__) type 'method-wrapper' import inspect inspect.isroutine([].__str__) False inspect.isroutine(object.__str__) True inspect.isroutine(object().__str__) False Why has [].__str__ a different type than object.__str__? Why is object.__str__ a routine while object().__str__ not? And one again my question: Can I extract some more information about a methed-wrapper object. E.g. can I somehow determine the arg spec? Thanks Peer __ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory leak in python
Abhishek S [EMAIL PROTECTED] wrote: I am seeing that the python application is very slowly eating up the memory. i need help to indentify it. It start with 11MB and keeps growing by 1 MB around every 30mins. #top | grep python 10351 root 15 0 26584 25M 3896 S 0.5 0.8 46:05 1 python2 [snip] 10351 root 15 0 26688 26M 3896 S 2.1 0.8 46:45 1 python2 Thats not a lot of leak - have you done that over a longer time period? let me know how to approch this. gc.collect - does not collect anything. Are there any objects in gc.garbage? Are you writing objects with __del__ methods? If so then that is your problem probably. Have you written any extension modules in C? -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: modules and namespaces
Each module has its own namespace, which is like a dictionary of objects that the module can see. I use the term dicitionary because locals() and globals() both return dictionaries -- someone may correct me on this (or confirm what I say)... You have local and global variables. Locals are variables in the scope of a function. def myfun(): localvar = 1 `globals' are really 'module' global only. # mymodule global_var = 3 def myfun() print global_var # This is a *gotcha* -- you can't change global variables this way. # here, a new local variable global_var is initialized. global_var = 3 def changeglobal(): # you have to use `global' to instruct python to use the `global' instance of the variable # instead of creating a new one when you assign to it. global global_var global_var = 3 You can only see variables you've created or modules you've imported. Becase you haven't imported string in m2 or m3, you can't see them. hth, jw On 4/19/05, Mage [EMAIL PROTECTED] wrote: Hello, I thought that this will work: #m1.py def f1(): return string.join('a','a') #m2.py def f2(): return string.join('b','b') #main.py import string import m1 import m2 print f1() print f2() - However it doesn't work until I import the string module into m1 and m2 modules. I found in the manual that imported modules will be searched in the container module first. Is it more efficient to import the string module into main and m1 and m2 than importing only into m1 and m2? Mage -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
New to Tkinter...
Good Morning. I am new to Tkinter. I have been testing the installation of Tkinter through the python web site. The first two test steps give no errors, 'import _tkinter' and 'import Tkinter'. However, the third step, 'Tkinter._test', gives the error: function _test at 0xb7ec8df4 Any suggestions? pete -- Peter G. Carswell The Ohio Supercomputer Center [EMAIL PROTECTED] work: 614.292.1091 fax: 614.292. DOC NOTE, I DISSENT. A FAST NEVER PREVENTS A FATNESS. I DIET ON COD. -Peter Hilton -- http://mail.python.org/mailman/listinfo/python-list
Re: Name/ID of removable Media: how?
Hi All-- Heiko Selber wrote: I am trying to find out (using Python under windows) the name of a CD that is currently in the drive specified by a path name. And while I am at it, I'd also like to know whether the specified drive contains a CD at all, and whether the drive is actually a CD drive. AFAIK, Python doesn't provide a way to do it, and a search in the web yielded only soutions for Linux. Can anyone show me a solution that works with windoze? This works. The only thing you have to do is stuff a floppy into the drive find out what the fstype is (that's inf[-1] in the code below) so you can key on it. Try the docs for Mark Hammond's Win32, and there's always his _Python Programming on Win32_. import os import os.path import win32api def findCDs(): cdDrives=[] print Searching for cd drives... drives=win32api.GetLogicalDriveStrings().split(:) for i in drives: dr=i[-1].lower() if dr.isalpha(): dr+=:\\ inf=None try: inf=win32api.GetVolumeInformation(dr) except: pass # Removable drive, not ready if inf!=None: if inf[-1].lower().endswith(cdfs): cdDrives.append([dr,inf]) elif inf[-1].lower().endswith(udf): cdDrives.append([dr,inf]) return cdDrives inf[0] contains the volume label if there is one and if there's a CD loaded: win32api.GetVolumeInformation(c:\\) ('God_C', -798323922, 255, 459007, 'NTFS') Note that you must use the full drive spec, letter:\\ or GetVolumeInformation() doesn't always work. There are probably better ways to do these things, but they do work; I've been using them constantly the last few days. Metta, Ivan -- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.com/ http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this never changed?
Have I missed something? Doesn't this mangle class methods: class Foo: def __bar(self): print bar Granted, you could probably figure out how the names are being mangled. In the example above __bar is a defacto private method. Griping about it not having `private' in front of it is asinine. If someone intentionally has to call a `private' method, then the design is at fault, not the language. jw On 4/19/05, Peter Hansen [EMAIL PROTECTED] wrote: Roy Smith wrote: Simon Brunning [EMAIL PROTECTED] wrote: On 4/19/05, could ildg [EMAIL PROTECTED] wrote: Private stuff always makes programming much easier. That contention is, at best, debatable. See http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21. Nice essay. Now, for another look at the same issue... http://thedailywtf.com/forums/32534/ShowPost.aspx Where in the original posting or in the 86 replies in that massive page are we supposed to find something pointed about this issue? Also, do any of the people there use a language like Python, or are you merely pointing to one example in another language (Java) where, perhaps, private should have been used? Or does this actually back up Simon's point? You don't say and it's really unclear what your point is. -Peter -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Name/ID of removable Media: how?
Aah, nice. Thank you. This should be included in pywin32, don't you think so? (Or is it? I didn't check before installing.) Heiko Tim Golden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [Heiko Selber] | I am trying to find out (using Python under windows) the name | of a CD that | is currently in the drive specified by a path name. | | And while I am at it, I'd also like to know whether the | specified drive | contains a CD at all, and whether the drive is actually a CD drive. Try this: code import wmi c = wmi.WMI () for i in c.Win32_CDROMDrive (): print i.Caption, i.VolumeName, i.VolumeSerialNumber /code I haven't answered all your questions, but I'm willing to bet that you can do pretty much what you want with WMI. There are also the pywin32 functions which give you some of this (maybe all, don't know; haven't tried). More info here: http://timgolden.me.uk/python/wmi.html and here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_cdromdrive.asp and here: http://pywin32.sf.net TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: Update Label when Scale value changes
codecraig wrote: Hi, I am using Tkinter and I have a Label and a Scale. I want to update my label everytime the Scale value changes. What is the best way of doing this? Do i have to bind for every event type? Or is there some better way? If I do have to bind each type of event to the scale, what types occur for a Scale? Thanks. Hi you could use a variable. Below is simple program that connects the value of the scale to the label. from Tkinter import * root = Tk() var = IntVar() Label(root, textvariable=var).pack() Scale(root, from_=-2.0, to=10.0, variable=var).pack() root.mainloop() Hope this helps Jorgen Cederberg -- http://mail.python.org/mailman/listinfo/python-list
Re: New to Tkinter...
On Tue, 19 Apr 2005 09:35:03 -0400, Peter G Carswell [EMAIL PROTECTED] wrote: Good Morning. I am new to Tkinter. I have been testing the installation of Tkinter through the python web site. The first two test steps give no errors, 'import _tkinter' and 'import Tkinter'. However, the third step, 'Tkinter._test', gives the error: function _test at 0xb7ec8df4 This is not an error. It's just the value of the _test function in the Tkinter module. You don't give the URL where you found the installation/test instructions, but you probably want: Tkinter._test() which *calls* the function. Tkinter._test just returns its value (functions are first class objects in Python...) HTH -- python -c 'print .join([chr(154 - ord(c)) for c in U(17zX(%,5.z^5(17l8(%,5.Z*(93-965$l7+-])' -- http://mail.python.org/mailman/listinfo/python-list
Re: def a((b,c,d),e):
[George Sakkis] François Pinard wrote: The most useful place for implicit tuple unpacking, in my experience, is likely at the left of the `in' keyword in `for' statements (and it is even nicer when one avoids extraneous parentheses). ... and would be nicest (IMO) if default arguments and *varargs were allowed too; check http://tinyurl.com/dcb2q for a relevant thread. It's appealing, indeed, trying to create more uniformity between tuple unpacking and argument passing. There are two approaches towards such uniformity, either upgrading tuple unpacking (as the above thread discusses) or downgrading argument passing (as suggested by those who found atrocious the current behaviour). I started recently to study the R system and language, and saw many good ideas in there about argument passing. Translated in Python terms, it would mean that `*varargs' and `**keywords' are not necessary last, that named keywords may be intermixed with positional keywords, that keywords may be abbreviated, and much more hairy, that the default values for keywords are not pre-evaluated at `def' time, and that the computation of actual expressions given as arguments is lazily postponed until their first use within the function. It surely looks all strange at first, but these choices are surprisingly productive in practice, as I merely begin to understand. Curious minds may start at http://cran.r-project.org/doc/manuals/R-lang.html#Arguments and read down. I do not know if there will ever be cross-pollinisation between R and Python, but I would guess good things might came out of this... -- François Pinard http://pinard.progiciels-bpi.ca -- http://mail.python.org/mailman/listinfo/python-list
Re: Twisted for online games
sir.shz [EMAIL PROTECTED] writes: Hi, I'm just starting to play with Twisted, and planning to use it for sone online games (e.g., casino games, etc.), have people done that before, are there any pointers? Thanks. Game Programming with Python by Sean Riley has good section about writing server-client stuff using Twisted. -- Petri Lankoski Hypermedia Laboratory, University of Tampere p. +358 3 215 7883, GSM: +358 50 329 8536 Email: [EMAIL PROTECTED] PGP: http://www.uta.fi/~ccpela/pgp.txt -- http://mail.python.org/mailman/listinfo/python-list
Extending base class methods
Hi, I am trying to extend an overridden base class method (printer) by printing some extra fields and then calling the base class method. Extract from the python tutorial: 'An overriding method in a derived class may in fact want to extend rather than simply replace the base class method of the same name. There is a simple way to call the base class method directly: just call BaseClassName.methodname(self, arguments). ' Any ideas why this does not work? I get the error TypeError: unbound method printer() must be called with Field_Collection instance as first argument (got MSD instance instead)): #= class Field_Collection: fieldList = [] def add(self, name, size, compression, responseValue, value, description): self.fieldList.append( Field(name, size, compression, responseValue, value, description) ) def update(self): print updating field def get(self): print getting field def printer(self): for x in self.fieldList: x.printer() #= class MSD(Field_Collection): standard = decField = def printer(self): print Standard: + self.standard print decField: + self.decField Field_Collection.printer(self) #= w2k, python 2.3 -- http://mail.python.org/mailman/listinfo/python-list
Re: Update Label when Scale value changes
Yea that is what i needed. Can you recommend a good Tkinter site (or book, but preferably site) about learning Tkinter. I've tried: http://www.python.org/moin/TkInter http://www.pythonware.com/library/tkinter/introduction/ But I am looking for more about events, etc. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: New to Tkinter...
Eric Brunel wrote: On Tue, 19 Apr 2005 09:35:03 -0400, Peter G Carswell [EMAIL PROTECTED] wrote: Good Morning. I am new to Tkinter. I have been testing the installation of Tkinter through the python web site. The first two test steps give no errors, 'import _tkinter' and 'import Tkinter'. However, the third step, 'Tkinter._test', gives the error: function _test at 0xb7ec8df4 This is not an error. It's just the value of the _test function in the Tkinter module. You don't give the URL where you found the installation/test instructions, but you probably want: Tkinter._test() which *calls* the function. Tkinter._test just returns its value (functions are first class objects in Python...) HTH Thanks, I realized my beginners' error just after I emailed the newgroup. I am sure this won't be my last question. pete -- Peter G. Carswell The Ohio Supercomputer Center [EMAIL PROTECTED] work: 614.292.1091 fax: 614.292. DOC NOTE, I DISSENT. A FAST NEVER PREVENTS A FATNESS. I DIET ON COD. -Peter Hilton -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending base class methods
On 19 Apr 2005 07:01:10 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Any ideas why this does not work? I get the error TypeError: unbound method printer() must be called with Field_Collection instance as first argument (got MSD instance instead)): My suggestion would be to make Field_Collection inheirit from object. Then you can make use of the super call inside of MSD. It would look something like this: class Field_Collection(object): # Some stuff. class MSD(Field_Collection): # More stuff def printer(self): print Standard: + self.standard print decField: + self.decField super(MSD, self).printer() HTH -- Steve Juranich Tucson, AZ USA -- http://mail.python.org/mailman/listinfo/python-list
Re: Update Label when Scale value changes
codecraig wrote: Yea that is what i needed. Can you recommend a good Tkinter site (or book, but preferably site) about learning Tkinter. I've tried: http://www.python.org/moin/TkInter http://www.pythonware.com/library/tkinter/introduction/ But I am looking for more about events, etc. Thanks Hi the above links are good. Also check out http://infohost.nmt.edu/tcc/help/pubs/tkinter/ which has a lot of information on events. /Jorgen Cederberg -- http://mail.python.org/mailman/listinfo/python-list
Re: Update Label when Scale value changes
codecraig wrote: Yea that is what i needed. Can you recommend a good Tkinter site (or book, but preferably site) about learning Tkinter. I've tried: http://www.python.org/moin/TkInter http://www.pythonware.com/library/tkinter/introduction/ I also like http://infohost.nmt.edu/tcc/help/pubs/tkinter/ Kent -- http://mail.python.org/mailman/listinfo/python-list
Re: New to Tkinter...
Eric Brunel wrote: This is not an error. It's just the value of the _test function in the Tkinter module. You don't give the URL where you found the installation/test instructions, but you probably want: Tkinter._test() which *calls* the function. Tkinter._test just returns its value (functions are first class objects in Python...) I did get a positive result on my linux desktop. However, on my laptop Fedora Core 1, the Tk window shell popped up with no buttons: Python 2.2.3 (#1, Oct 15 2003, 23:33:35) [GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2 Type help, copyright, credits or license for more information. import _tkinter import Tkinter Tkinter._test() Traceback (most recent call last): File stdin, line 1, in ? File /usr/lib/python2.2/lib-tk/Tkinter.py, line 3118, in _test label = Label(root, text=text) File /usr/lib/python2.2/lib-tk/Tkinter.py, line 2285, in __init__ Widget.__init__(self, master, 'label', cnf, kw) File /usr/lib/python2.2/lib-tk/Tkinter.py, line 1780, in __init__ self.tk.call( SystemError: Py_UNICODE and Tcl_UniChar differ in size pete -- Peter G. Carswell The Ohio Supercomputer Center [EMAIL PROTECTED] work: 614.292.1091 fax: 614.292. DOC NOTE, I DISSENT. A FAST NEVER PREVENTS A FATNESS. I DIET ON COD. -Peter Hilton -- http://mail.python.org/mailman/listinfo/python-list
Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2
Okay, let me have another stap at this. As you have probably noticed MSVC6 is no longer actively supported as far as Python 2.4 goes. The official distribution of Python 2.4 for Windows is built using MSVC7.1 (or whatever you wish to call it). We are told that building C extensions with MSVC6 for use in the official Python 2.4 (which uses the MSVCR71) is not safe, and mixing the different runtime libraries that your extension (or my extension) with that which official Python 2.4 uses will/might cause crashes. Google around for details on this. So, what to do? You seem to have four options. 1. Get and use the MSVC7.1 compiler. 2. Get and use the freely distributed MS compiler. 3. Download the Python source[1] and compile it yourself in MSVC6 (there are project files in the source to enable you to do that). Then use your MSVC6 to create the extension. 4. Get and use MinGW and pyMinGW[2] Regards, Khalid [1] Check to see if your archiever tool is working, or get the source from CVS. [2] pyMinGW: http://jove.prohosting.com/iwave/ipython/pyMinGW.html -- http://mail.python.org/mailman/listinfo/python-list
Dr. Dobb's Python-URL! - weekly Python news and links (Apr 18)
QOTW: Darn. I finally say something that gets into Quote of the Week, and it's attributed to someone else! -- Greg Ewing (we think) http://groups-beta.google.com/group/comp.lang.python/msg/15b836a557afccb2 If there were something wrong with the API, Guido would have long since fired up the time machine and changed the timeline so that all would be as right as rain. - Raymond Hettinger Get real. I can't imagine using anything so complex. -- Scott David Daniels, in response to a suggestion to try (1j-1) as a counting base Continuations for Curmudgeons: http://www.intertwingly.net/blog/2005/04/13/Continuations-for-Curmudgeons Textual watermarks with Python Imaging Library: http://www.livejournal.com/users/gniemeyer/10279.html The new Python Cookbook is out of date already: http://42.blogs.warnock.me.uk/2005/04/oreillycom_onli.html Thunks for nothing: http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bbb6f71ff27f83a6/282bc755d5be3f62 http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/6e50601e8b1d8d18/db4f746b8b4d76ea A tutorial for building a simple to-do list application using WSGIKit, SQLObject, and Zope Page Templates: http://wsgikit.org/docs/TodoTutorial.html What can WSGIKit do for you? http://blog.ianbicking.org/what-can-wsgikit-do-for-you.html The Participatory Culture Foundation's desktop video player - video over BitTorrent: http://www.participatoryculture.org/ Next-generation distributed version control: http://www.bazaar-ng.org/ Will LAMP eclipse Java? http://news.com.com/2061-10795_3-5663085.html Does the fact that Python 2.4 is built using VC++ on Windows give us a problem? http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/bccb45b7dae7ddd5/7a91ce5a9541221c Look up IP addresses by country: http://www.livejournal.com/users/zestyping/111325.html Python 2.3.2 for PalmOS: http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/1d835f30343cabec/4efb02adafe3f7b5 Everything Python-related you want is probably one or two clicks away in these pages: Python.org's Python Language Website is the traditional center of Pythonia http://www.python.org Notice especially the master FAQ http://www.python.org/doc/FAQ.html PythonWare complements the digest you're reading with the marvelous daily python url http://www.pythonware.com/daily Mygale is a news-gathering webcrawler that specializes in (new) World-Wide Web articles related to Python. http://www.awaretek.com/nowak/mygale.html While cosmetically similar, Mygale and the Daily Python-URL are utterly different in their technologies and generally in their results. For far, FAR more Python reading than any one mind should absorb, much of it quite interesting, several pages index much of the universe of Pybloggers. http://lowlife.jp/cgi-bin/moin.cgi/PythonProgrammersWeblog http://www.planetpython.org/ http://mechanicalcat.net/pyblagg.html comp.lang.python.announce announces new Python software. Be sure to scan this newsgroup weekly. http://groups.google.com/groups?oi=djqas_ugroup=comp.lang.python.announce Brett Cannon continues the marvelous tradition established by Andrew Kuchling and Michael Hudson of intelligently summarizing action on the python-dev mailing list once every other week. http://www.python.org/dev/summary/ The Python Package Index catalogues packages. http://www.python.org/pypi/ The somewhat older Vaults of Parnassus ambitiously collects references to all sorts of Python resources. http://www.vex.net/~x/parnassus/ Much of Python's real work takes place on Special-Interest Group mailing lists http://www.python.org/sigs/ The Python Business Forum further[s] the interests of companies that base their business on ... Python. http://www.python-in-business.org Python Success Stories--from air-traffic control to on-line match-making--can inspire you or decision-makers to whom you're subject with a vision of what the language makes practical. http://www.pythonology.com/success The Python Software Foundation (PSF) has replaced the Python Consortium as an independent nexus of activity. It has official responsibility for Python's development and maintenance. http://www.python.org/psf/ Among the ways you can support PSF is with a donation. http://www.python.org/psf/donate.html Kurt B. Kaiser publishes a weekly report on faults and patches.
XML-RPC -- send file
Hi, I want to use XML-RPC to send a file from client-to-server or from server-to-client. I know XML-RPC supports, int, string etc...not objects. I thought i read somewhere that by using pickle or something, that u could get a string representation of your object (or a file in my case) and send that. Any ideas? thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: (Python newbie) Using XP-SP2/MSVC6: No Python24_d.lib, winzip barfs on Python-2.4.1.tar, cannot download bzip2
I fight the python24_d.lib problem with swig daily. The way I got around it was to modify swig's python configuration module. Mine was located at /lib/swig1.3/python/python.swg (I'm using cygwin) At the top, I changed #include python.h to #ifdef _DEBUG #undef _DEBUG #include python.h #define _DEBUG #else #include python.h #endif Somewhere in the includes, python uses a pragma telling the MSVC compiler which library to link the object files against. Because you're building a _DEBUG build, you magically get the python24_d.lib library. hth, jw On 4/18/05, Bill Davy [EMAIL PROTECTED] wrote: I downlaoded and installed http://www.python.org/ftp/python/2.4.1/python-2.4.1.msi I'm trying to build an extension using SWIG 1.3.24 and the linker needs python24_d.lib (I do not have the DLL either). I've not found it in any of the downloads. So I tried to download the source to build it myself. Of http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tar.bz2 and http://www.python.org/ftp/python/2.4.1/Python-2.4.1.tgz, WinZip (9.0 SR1) just says Error reading header after processing 0 entries. Additionally, I've had no joy downloading the unzipper (ftp://sources.redhat.com/pub/bzip2/v102/bzip2-102-x86-win32.exe) from the site cited for the unzipper (http://sources.redhat.com/bzip2/). It flashed up a black console window momentarily. Oh, this is so frustrating! :-( Can anyone point me in the right direction? And then I can get to grips with my work. tia Bill -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Why does python class have not private methods? Will this never changed?
In article [EMAIL PROTECTED], Peter Hansen [EMAIL PROTECTED] wrote: Roy Smith wrote: Simon Brunning [EMAIL PROTECTED] wrote: On 4/19/05, could ildg [EMAIL PROTECTED] wrote: Private stuff always makes programming much easier. That contention is, at best, debatable. See http://groups-beta.google.com/group/comp.lang.python/msg/b977ed1312e10b21. Nice essay. Now, for another look at the same issue... http://thedailywtf.com/forums/32534/ShowPost.aspx Where in the original posting or in the 86 replies in that massive page are we supposed to find something pointed about this issue? There are several comments in there speculating that the intent was to find a way around private data hiding. It's a WTF -- you can't take it too seriously. -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python 2.3.2 for PalmOS available
Klaus Alexander Seistrup wrote: Lucio Torre wrote: Say, are floats implemented? Comparisons seem to work, but print'ing doesn't: #v+ 1.0 0.5 True print 1.23 %.*g I think thats a problem with the printf implementation. Im using one that came with codewarrior and maybe it doesnt parse %.*g .. (never seen that format before).. Lucio. -- http://mail.python.org/mailman/listinfo/python-list
Re: modules and namespaces
Laszlo Zsolt Nagy [EMAIL PROTECTED] writes: However it doesn't work until I import the string module into m1 and m2 modules. I found in the manual that imported modules will be searched in the container module first. Is it more efficient to import the string module into main and m1 and m2 than importing only into m1 and m2? I bet the most efficient is But is is not working. str.join( ('a','b')) Python 2.4.1 (#1, Mar 31 2005, 09:19:04) [GCC 3.2.2] on linux2 Type help, copyright, credits or license for more information. str.join(('a','b')) Traceback (most recent call last): File stdin, line 1, in ? TypeError: descriptor 'join' requires a 'str' object but received a 'tuple' str.join('a','bcdefg') 'bacadaeafag' str().join(('a','b')) 'ab' Kind regards Berthold -- [EMAIL PROTECTED] __ Address: G / \ L Germanischer Lloyd phone: +49-40-36149-7374-++- Vorsetzen 35 P.O.Box 111606 fax : +49-40-36149-7320 \__/ D-20459 HamburgD-20416 Hamburg -- http://mail.python.org/mailman/listinfo/python-list
Tkinter and Scrollbar
Hi, I am trying to use a Scrollbar for a Listbox. I want a scrollbar which which has the vertical and horizontal scroll bars. Here is how i am doing it now, is the only way or best way to do it? # vertical scroll bar for list self._scrollbarY = Scrollbar(self.myContainer) self._scrollbarY.pack(side=RIGHT, fill=Y) # horizontal scroll bar for list self._scrollbarX = Scrollbar(self.myContainer, orient=HORIZONTAL) self._scrollbarX.pack(side=BOTTOM, fill=X) self._list = Listbox(self.myContainer) self._list.pack() for i in range(100): self._list.insert(END, a*i) self._list.config(yscrollcommand=self._scrollbarY.set) self._list.config(xscrollcommand=self._scrollbarX.set) self._scrollbarY.config(command = self._list.yview) self._scrollbarX.config(command = self._list.xview) Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending base class methods
Ok, i'll try that. But what about the recommendation in the tutorial, is that not possible? /H -- http://mail.python.org/mailman/listinfo/python-list
Re: Name/ID of removable Media: how?
Hi All-- Tim's wmi stuff looked interesting, so I tried it out, and now I have a question. - #!/usr/bin/python import wmi import win32api c=wmi.WMI() for i in c.Win32_CDROMDrive(): v=i.VolumeSerialNumber print WMI serial,v,long(v,0x10) vn,sn,ln,flg,fstype=win32api.GetVolumeInformation(d:\\) print win32api serial,sn,long(sn) The output from the above script (drive d contains cd) is: WMI serial D0ADBEE7 3501047527 win32api serial -793919769 -793919769 What's the difference between the two serial numbers? WMI is returning a long converted to a hex repr string, while win32api is returning an int (type(sn) is type 'int'), converting to hex bears no resemblance to what WMI shows. What am I missing? Metta, Ivan -- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.com/ http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe - create one EXE
what about trying cx_freeze -- http://mail.python.org/mailman/listinfo/python-list
RE: Name/ID of removable Media: how?
[Ivan Van Laningham] | Hi All-- | Tim's wmi stuff looked interesting, so I tried it out, and | now I have a | question. | [... snip code ...] | The output from the above script (drive d contains cd) is: | | WMI serial D0ADBEE7 3501047527 | | win32api serial -793919769 -793919769 | | | What's the difference between the two serial numbers? Try this: hex (-793919769) You might need to check back on recent discussions here re negative / positive numbers and hexadecimal. (Short version: we used to treat hex numbers with the top bit set as negative decimal numbers; now only negative hex numbers are negative decimals) TJG This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- http://mail.python.org/mailman/listinfo/python-list
The value of the entry widget doesn't get updated
Hi, can somebody help me,..I have an assignment due next week but now I'm stuck with this problem I tried to get values from entry widget using the widgetcontrolvariable.get(),..but it seems that it won't work I can't print the value I input in the entry widget...However when I first set the value to something I can get the value just fine... This is my code Help please... msg='*~*Please Login to use the system*~*' class LoginMenu(Frame): def createWidgets(self, msg): import tkFont self.x = StringVar() self.y = StringVar() self.x.set(Type here) self.messageLabel= Label(self, text=msg, pady=15, font=tkFont.Font(weight='bold' ,size=10)) self.messageLabel.grid(row=0, columnspan=6) self.nameLabel= Label(self, text='UserName :', padx=12, justify=LEFT) self.nameLabel.grid(row=1, column=0, ipadx=9, ipady=5) self.nameEntry= Entry(self,justify=LEFT, textvariable=self.x) self.nameEntry.grid(row=1, column=3, columnspan=2) self.nameEntry.update_idletasks() self.passLabel= Label(self, text='Password :', padx=12, justify=LEFT) self.passLabel.grid(row=2, column=0,ipadx=9, ipady=5) self.passEntry= Entry(self,justify=LEFT, show='*', textvariable=self.y) self.passEntry.grid(row=2, column=3, columnspan=2) self.passEntry.update_idletasks() self.loginButton = Button(self, text='Login', command = VerifyProcessor(self.x.get(), self.y.get()) ) self.loginButton.grid(row=4, column=3, ipadx=15, ipady=3, pady=20) self.quitButton = Button(self, text='Exit', command = self.quit) self.quitButton.grid(row=4, column=4, ipadx=20, ipady=3, pady=20, padx=10) def __init__(self, msg, master=None): Frame.__init__(self, master) self.grid(column=4, row=4) self.createWidgets(msg) class VerifyProcessor: def __init__(self, thename, thepass): self.username = thename self.password = thepass def __call__(self): print self.username print self.password app = LoginMenu(msg) app.master.title(Login Menu) app.master.maxsize(280,200) app.mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python 2.3.2 for PalmOS available
I get odd results when trying to use exponents. For example: 4^2 6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Name/ID of removable Media: how?
Hi All-- Tim Golden wrote: Try this: hex (-793919769) You might need to check back on recent discussions here re negative / positive numbers and hexadecimal. (Short version: we used to treat hex numbers with the top bit set as negative decimal numbers; now only negative hex numbers are negative decimals) Of course I tried that. Did you? Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. hex (-793919769) '-0x2f524119' Metta, Ivan -- Ivan Van Laningham God N Locomotive Works http://www.andi-holmes.com/ http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list
RE: Name/ID of removable Media: how?
[Ivan Van Laningham] | Hi All-- | | Tim Golden wrote: | | Try this: hex (-793919769) | | You might need to check back on recent discussions here re | negative / positive numbers and hexadecimal. | | (Short version: we used to treat hex numbers with the top bit | set as negative decimal numbers; now only negative hex numbers | are negative decimals) | | | | Of course I tried that. Did you? | | | Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on | win32 | Type help, copyright, credits or license for more information. | hex (-793919769) | '-0x2f524119' | | Yes I did. I just forgot to mention the critical fact that I'm still using 2.3.5: dump Python 2.3.5c1 (#61, Jan 25 2005, 19:52:06) [MSC v.1200 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. hex (-793919769) __main__:1: FutureWarning: hex()/oct() of negative int will return a signed string in Python 2.4 and up '0xd0adbee7' /dump TJG This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk -- http://mail.python.org/mailman/listinfo/python-list
Re: Extending base class methods
On 19 Apr 2005 08:27:28 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Ok, i'll try that. But what about the recommendation in the tutorial, is that not possible? In the new (2.4) version of the Tutorial, that statement has been removed. What you're using has been called old-style classes for quite a while now (since 2.0?). Any new Python code should really be using the new-style classes (inherit from object and use things like super. But FWIW, it appears to still work with Python 2.4: #-- snip FILE=Foo.py - class Foo: def foo(self): print foo class Bar(Foo): def foo(self): print bar Foo.foo(self) #--- /snip # Now in the Python interpreter: from Foo import * f = Foo() f.foo() foo b = Bar() b.foo() bar foo So nothing jumps out to me that you did obviously wrong, sorry. But in general my advice would be to switch to using new-style classes. HTH -- Steve Juranich Tucson, AZ USA -- http://mail.python.org/mailman/listinfo/python-list
RE: ANN: Python 2.3.2 for PalmOS available
Isn't ** used for exponents? 4**2 -Original Message- Sent: Tuesday, April 19, 2005 10:39 AM By: RM To: python-list@python.org Subject: Re: ANN: Python 2.3.2 for PalmOS available I get odd results when trying to use exponents. For example: 4^2 6 -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] How do you get yesterday from a time object
On 4/19/05, Ralph Hilton [EMAIL PROTECTED] wrote: i'm a beginning python programmer. I want to get the date for yesterday nowTime = time.localtime(time.time()) print nowTime. oneDay = 60*60*24 # number seconds in a day yday = nowTime - oneDay # -- generates an error print yday.strftime(%Y-%m-%d) today = datetime.date.today() previous_working = today - datetime.timedelta(days=1) -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python 2.3.2 for PalmOS available
Oops. Sorry, you are right. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Do You Want To Know For Sure That You Are Going To Heaven? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven which is described in the Holy Bible as a beautiful place with no death, sorrow, sickness or pain. (newsgroup-post 142)
!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Strings and Lists
Thank you all very much for your responses. It's especially reassuring to hear about other Python GA's as I have had some scepticism about Python's speed (or lack of it) being too big a problem for such an application. With regard to using numeric, arrays or integer lists -- I didn't mention that these strings can also contain wild cards (so I suppose it's not really binary -- sorry). This is traditionally done using a '#' symbol, but I was imagining using a value of None in a boolean list to represent this. Also there is currently a fair bit of research going into other representations (floating-point values, paired values etc) so I was hoping to be able to keep my framework extensible for the future. Many thanks again for your help. I will ``take the plunge'' and give the boolean list a go I think! -- http://mail.python.org/mailman/listinfo/python-list
Re: please unsubscibe
Thank you, Bill NorrisJohn Roth [EMAIL PROTECTED] wrote: I'm pleased to announce that PyFit 0.7a1is now available in the file sections ofthe Extreme Programming and FitNesseYahoo groups. This version implementsmost of the Fit Library, and changesneeded to bring the package into conformance with the Fit 1.1 specification.It also brings it to the level of FitNesse20050405, plus additional features.John RothApril 18, 2005-- http://mail.python.org/mailman/listinfo/python-announce-listSupport the Python Software Foundation:http://www.python.org/psf/donations.html-- http://mail.python.org/mailman/listinfo/python-list
Re: fpectl
On Tue, Apr 19, 2005 at 02:05:11AM -0700, Sébastien Boisgérault wrote: Thanks for this answer. Did you forward this info to python-dev ? I created a patch on the sf tracker. It's been responded to by several developers. You can read what they said there. http://python.org/sf/1185529 Jeff pgpzLX8Ht47YG.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: Do You Want To Know For Sure That You Are Going To Heaven? The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven wh
The only people who know they are going to heaven, clearly aren't [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] The reason some people don't know for sure if they are going to Heaven when they die is because they just don't know. The good news is that you can know for sure that you are going to Heaven which is described in the Holy Bible as a beautiful place with no death, sorrow, sickness or pain. God tells us in the Holy Bible how simple it is to be saved so that we can live forever with Him in Heaven. For if you confess with your mouth Jesus is Lord and believe in your heart that God raised Him from the dead, you WILL BE SAVED. (Romans 10:9) Over 2000 years ago God came from Heaven to earth in the person of Jesus Christ to shed His blood and die on a cross to pay our sin debt in full. Jesus Christ was born in Israel supernaturally to a virgin Jewish woman named Mary and lived a sinless life for thirty-three years. At the age of thirty-three Jesus was scourged and had a crown of thorns pressed onto His head then Jesus was crucified. Three days after Jesus died on a cross and was placed in a grave Jesus rose from the dead as Jesus said would happen before Jesus died. If someone tells you that they are going to die and in three days come back to life again and it happens then this person must be the real deal. Jesus Christ is the only person that ever lived a perfect sinless life. This is why Jesus is able to cover our sins(misdeeds) with His own blood because Jesus is sinless. The Holy Bible says, In Him(Jesus) we have redemption through His blood, the forgiveness of sins... (Ephesians 1:7) If you would like God to forgive you of your past, present and future sins just ask Jesus Christ to be your Lord and Saviour. It doesn't matter how old you are or how many bad things that you have done in your life including lying and stealing all the way up to murder. Just pray the prayer below with your mouth and mean it from your heart and God will hear you and save you. Dear Jesus Christ, I want to be saved so that I can have a home in Heaven with You when I die. I agree with You that I am a sinner. I believe that You love me and want to save me. I believe that You bled and died on the cross to pay the penalty for my sins and that You rose from the dead. Please forgive my sins and come into my heart and be my Lord and Saviour. Thanks Lord Jesus Christ for forgiving me and saving me through Your merciful grace. Amen. Welcome to the family of God if you just allowed God to save you. Now you are a real Christian and you can know for sure that you will live in Heaven forever when this life comes to an end. As a child of God we are to avoid sin(wrongdoing), but if you do sin the Holy Bible says, My dear children, I write this to you so that you will not sin. But if anybody does sin, we have one who speaks to the Father in our defense Jesus Christ, the Righteous One. Those of you that have not yet decided to place your trust in the Lord Jesus Christ may never get another chance to do so because you do not know when you will die. Jesus said I am the way, the truth and the life: no one can come to the Father(God)(in Heaven), but by me. (John 14:6) This means that if you die without trusting in Jesus Christ as your Lord and Saviour you will be forever separated from the love of God in a place called Hell. The Holy Bible descibes Hell as a place of eternal torment, suffering, pain and agony for all those who have rejected Jesus Christ. The good news is that you can avoid Hell by allowing Jesus Christ to save you today. Only then will you have true peace in your life knowing that no matter what happens you are on your way to Heaven. Praise the Lord! Servant of the Lord Jesus Christ Ronald L. Grossi *Show this to your family and friends so they can know that they have a choice where they will spend eternity. Thanks! Got Questions? http://www.gotquestions.org/archive.html Other Languages http://www.godssimpleplan.org/gsps.html Free Movie: To Hell and Back http://www.tbn.org/index.php/8/1.html Animation http://www.browser.to/jesus-animation The Passion Of The Christ http://www.thepassionofthechrist.com Beware Of Cults http://www.carm.org/cults/cultlist.htm About Hell http://www.equip.org/free/DH198.htm Is Jesus God? http://www.powertochange.com/questions/qna2.html Free Online Bible http://www.biblegateway.com -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC -- send file
codecraig I thought i read somewhere that by using pickle or something, codecraig that u could get a string representation of your object (or a codecraig file in my case) and send that. Any ideas? Sure: stuff = xmlrpclib.Binary(open(somefile).read()) server.call_some_remote_function(stuff) At the other end a similar decoding will have to be done. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Dr. Dobb's Python-URL! - weekly Python news and links (Apr 18)
Simon Brunning wrote: Get real. I can't imagine using anything so complex. -- Scott David Daniels, in response to a suggestion to try (1j-1) as a counting base Oops -- once again I get credit for someone's response to my post. (I was the try (1j-1) poster). --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Refactoring in Python.
I am trying to write Master Thesis on refactoring Python code. Where should I look for information? -- http://www.dembiski.prv.pl -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC -- send file
how would I decode it? -- http://mail.python.org/mailman/listinfo/python-list
Re: Refactoring in Python.
Peter I am trying to write Master Thesis on refactoring Python code. Peter Where should I look for information? I'm not sure, but one piece of code to check out would probably be Bicycle Repair Man, a early-stage prototype refactoring tool for Python. I don't recall where it's hosted. Google will know. Skip -- http://mail.python.org/mailman/listinfo/python-list
Using Paramiko
Can anyone point me to a how-to on Paramiko? I need to use sftp for file transfer, have installed Paramiko and have a connection (that was pretty easy, actually), but cannot find documentation on how to transfer a file (I have demo_simple.py but can't figure it out). Perhaps I missed a section of the documentation; if I did, I apologize. Can anyone show me how to use this package? Thanks, --greg -- Greg Lindstrom 501 975.4859 (office) Senior Programmer501 219-4455 (fax) NovaSys Health [EMAIL PROTECTED] Little Rock, Arkansas We are the music makers, and we are the dreamers of dreams. W.W. -- http://mail.python.org/mailman/listinfo/python-list