Re: C#3.0 and lambdas
[amk] > Similar things happen on the catalog SIG: people suggest, or even implement, > an automatic package management system, But bring up the question of whether > it should be called PyPI or Cheeseshop or the Catalog, and *everyone* can make > a suggestion. This is known as the "bike shed effect": http://linuxmafia.com/~rick/lexicon.html#bikeshed -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: A rather unpythonic way of doing things
[Peter] > http://www.pick.ucam.org/~ptc24/yvfc.html Beautiful! Greenspun's Tenth Rule[1] performed before your very eyes! (Not quite, because you started with Python so you were already half way there. And yours probably isn't buggy. 8-) [1] http://en.wikipedia.org/wiki/Greenspun's_Tenth_Rule -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: A quick c.l.p netiquette question
[Peter] > Does it really have to be 158 lines to demonstrate these few issues? I think you missed the other Peter's second post, where he points to his program: http://www.pick.ucam.org/~ptc24/yvfc.html I didn't read every one of his 158 lines, but his code is pure poetry, or possibly triple-distilled evil, depending on your point of view. 158 lines very well spent either way! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: A rather unpythonic way of doing things
[Peter] > http://www.pick.ucam.org/~ptc24/yvfc.html [Jeff] > Yuma Valley Agricultural Center? > Yaak Valley Forest Council? I went through the same process. My guess is "Yes, Very F'ing Clever." Peter? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: A rather unpythonic way of doing things
[Peter] > http://www.pick.ucam.org/~ptc24/yvfc.html [fraca7] > print ''.join(map(lambda x: chrord(x) - ord('a')) + 13) % 26) + > ord('a')), 'yvfc')) Ah! Or more easily, Edit / Apply ROT13. Thanks! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Google Not Universal Panacea [was: Re: Where to find python c-sources]
[Steve] > In short, this group is a broad church, and those readers with brain s > the size of planets should remember that they are just as much in a > minority as the readers who appear on the list for the first time this > week. The vast majority are here to learn and grow, and I think that's > the sort of behaviour we should be encouraging. +1 (and +1 QOTW). > As time goes by I find myself more and more likely, getting to the end > of a possibly sharp or vindictive response, to simply kill the post and > take what pleasure I can from not having shared that particular piece of > small-mindedness with the group. In the end our most valuable > contributions to groups like this can be the gift of being able to walk > away from a fight simply to keep the noise level down. +1 (and +1 QONW). -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [Info] PEP 308 accepted - new conditional expressions
[Fredrik] > > X if C else Y > > hopefully, only one of Y or X is actually evaluated ? Yes. From Guido's announcement at http://mail.python.org/pipermail/python-dev/2005-September/056846.html: > The syntax will be > > A if C else B > > This first evaluates C; if it is true, A is evaluated to give the > result, otherwise, B is evaluated to give the result. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Not defined
[Rob] > >>> from cgkit import * > >>> Sphere() > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'Sphere' is not defined Do you have a file of your own called cgkit.py? You're probably importing that rather than the real thing. Try this: >>> import cgkit >>> print cgkit.__file__ >>> dir(cgkit) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Reply-To header
[Andrew] > Is it just me, or does python-list@python.org not send with a Reply- > To header? It's not just you. I don't get one either. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Excel library with unicode support
[Mike] > Is there a python library, that is able to create Excel files with > unicode characters. pyExcelerator claims to do this, but I've never used it. http://sourceforge.net/projects/pyexcelerator/ -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: When someone from Britain speaks, Americans hear a "British accent"...
[Steve] > and yes, I split that infinitive just to > annoy any pedants who may be reading [Steven] > *Real* pedants will know that English is not Latin, does not follow the > grammatical rules of Latin, and that just because split infinitives are > impossible -- not forbidden, impossible -- in Latin is no reason to forbid > them in English. Your previous post to this thread was chock-full of split nominatives: "The Hollywood voice", "the specific regional accent", "the English-speaking world", "the original French". And you call yourself a grammarian. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: When someone from Britain speaks, Americans hear a "British accent"...
[Richie] > Your previous post to this thread was chock-full of split nominatives: "The > Hollywood voice", "the specific regional accent", "the English-speaking > world", "the original French". And you call yourself a grammarian. [Steve] > I am presuming this post was meant to be a joke? It was. > No smileys, though, so you force us to make up our own minds. Yes. 8-) > Or is "the green tomato" also unacceptable? It ought to be considered unacceptable by people who think that "to correctly apply" is unacceptable, which is the point that Stephen was making: > *Real* pedants will know that English is not Latin, does not follow the > grammatical rules of Latin, and that just because split infinitives are > impossible -- not forbidden, impossible -- in Latin is no reason to forbid > them in English. Split nominatives like "the green tomato" are also impossible in Latin, but no-one seems to object to their use in English. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
> > Not so: you disable Java, Javascript and plugins. You leave the ability > > to format, colour and hint documents. This is not /that/ difficult. > > Don't forget disabling Unicode. http://news.netcraft.com/archives/2005/02/15/firefox_to_disable_idn_support_as_phishing_defense.html -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: UI toolkits for Python
[Ken] > Web interfaces are missing a lot more than this. Here are just a few > things that cannot be done with web-based interfaces (correct me > where I'm wrong): > > 1) A real word processor. http://www.writely.com/ http://www.goffice.com/ > 2) Keybindings in a web application http://rememberthemilk.com/ Google Keys (but what happened to it? It's disappeared!) > 3) Drag and drop http://www.walterzorn.com/dragdrop/dragdrop_e.htm http://qooxdoo.oss.schlund.de/demo/release/public/test/user/Index.html (pick "Drag and Drop N" from the dropdown on the right hand side of the top bar) > 4) Resizable windows (i.e. not the browser window) within the > application. http://qooxdoo.oss.schlund.de/demo/release/public/test/user/Index.html (pick "Window N" from the dropdown on the right hand side of the top bar) http://www.bindows.net/ (click "Click for a quick DEMO") > 5) Anything other than absolutely trivial graphical programs. Not sure what you mean by this... Google maps? > web interfaces are still basically forms that can contain > buttons, checkboxes, text fields, and a few other basic controls. I > wish it were otherwise. It *is* otherwise. You should follow the Ajaxian weblog here: http://www.ajaxian.com/ -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing a dll from Python
[Daniel] > I tried the ctypes module. ctypes is the right way to do it. You need to post your code and whatever errors you received. Here's an example of using ctypes to call a DLL: >>> from ctypes import * >>> windll.user32.MessageBoxA(None, "Hello world", "ctypes", 0); You use "windll" for stdcall functions (eg. the Windows API) and "cdll" for cdecl functions. I don't know which one VB defaults to. If you get it wrong, ctypes will give you an error talking about using the "wrong calling convention". -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Goto XY
[ale.of.ginger] > WConio.gotoxy(10,10) > error: GetConOut Failed Are you running at a Windows Command Prompt, or in an IDE? As I understand it, WConio will only work in a Windows Command Prompt. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: generate HTML
[ss2003] > I am stuck at above after doing a lot of f.write for every line of HTML > . Any betterways to do this in python? See the "Templating Engines" section of http://wiki.python.org/moin/WebProgramming - I hope you have a few hours to spare! 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: compare list
[Shi] > Yes, i am using python 2.3, > I have used from sets import * > but still report the same error: > > > Traceback (most recent call last): > > > File "", line 1, in ? > > > NameError: name 'set' is not defined It's 'Set', not 'set'. Try this: >>> import sets >>> dir(sets) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: compare list
Ben, > But the logic output is wrong. > from sets import Set as set > lisA=[1,2,5,9] > lisB=[9,5,0,2] > lisC=[9,5,0,1] > def two(sequence1, sequence2): > set1, set2 = set(sequence1), set(sequence2) > return len(set1.intersection(set2)) == 2 > print two(lisA,lisB) > False(should be true!) Slow down. The intersection of A and B is [2, 5, 9]. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: win32com 'catastrophic failure'
[gerd] > com_error: (-2147418113, 'catastrophic failure', None, None) The last time I saw this error it was because I'd created a control instance but hadn't initialised it before trying to use it. I had to do something like this (apologies for the C++): IPersistStreamInit* IPSI = NULL; pUnknown->QueryInterface(IID_IPersistStreamInit, (void**) &IPSI); IPSI->InitNew(); IPSI->Release(); (pUnknown is the IUnknown of my newly-created control; error checking omitted). There are probably a million reasons why you might be getting that error, but if this doesn't help then at least you'll have narrowed it down to 999,999. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: hidding the "console" window + system global shortcut keys
[Gabriel] > 2. Set global key biddings. You can do this using ctypes: http://groups.google.co.uk/groups?selm=mailman.929.1069345408.702.python-list%40python.org -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Python! Is! Truly! Amazing!
[Erik] > I am now a super gushing fan-boy. +1 Quote of the Week! -- Richie Hindle <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: MoinMoin and Mediawiki?
[Paul] > [MoinMoin] doesn't have [...] automatic update notification for > specific pages of your choice Yes it does. See http://entrian.com/sbwiki for example - register there and you'll see in your preferences "Subscribed wiki pages (one regex per line)" > The BogusMixedCaseLinkNames. I'd rather have ordinary words with > spaces between them, like we use in ordinary writing. MoinMoin has an option to display WikiWords with spaces between them (albeit still capitalised), again in the user preferences. I'm not saying that MoinMoin is better than MediaWiki, just that it really does have some of the features you say it doesn't (perhaps you've been looking at an old version). -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
ElementTree.findtext()
Hi, I can't get ElementTree.findtext() to work with anything other than a single-level path: >>> from elementtree import ElementTree >>> tree = ElementTree.fromstring("""\ ... ... ... ... The title ... ... ... """) >>> print tree.findtext("*/title") The title >>> print tree.findtext("html/head/title") None >>> What am I missing? I'm using elementtree-1.2.4-20041228 on Windows with Python 2.3. -- Richie Hindle <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list
Re: ElementTree.findtext()
[me] > >>> print tree.findtext("html/head/title") > None I realised what the problem was the second after I hit Send (why is it never the second *before*?) The tree represents the top-level element, so of course searching within it for 'html' fails. What I should say is this: >>> print tree.findtext("head/title") The title Sorry to waste people's time! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Weakref.ref callbacks and eliminating __del__ methods
[Tim] > I'll note that one fairly obvious pattern works very well for weakrefs > and __del__ methods (mutatis mutandis): don't put the __del__ method > in self, put it in a dead-simple object hanging *off* of self. Like > the simple: > > class BTreeCloser: > def __init__(self, btree): > self.btree = btree > > def __del__(self): > if self.btree: > self.btree.close() > self.btree = None > > Then give self an attribute refererring to a BTreeCloser instance, and > keep self's class free of a __del__ method. The operational > definition of "dead simple" is "may or may not be reachable only from > cycles, but is never itself part of a cycle". This is very nice - I've been wondering about just this problem recently, and this will be very useful. Many thanks! One question: why the `self.btree = None` in the last line? Isn't `self.btree` guaranteed to go away at this point anyway? (If the answer is "it's necessary for weird cases that would take an hour to explain" then I'll be more than happy to simply use it. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Weakref.ref callbacks and eliminating __del__ methods
[me] > why the `self.btree = None` in the last line? [Mike] > It's to allow the Closer object to act as a substitute for a .close() > method on the object [...] If the user explicitly calls storage.close() > we don't want the __del__ trying to re-close the storage later. In > other words, its an explicit requirement for *this* __del__, not a general > requirement. I see, yes. Very clever - thanks for the explanation! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Weakref.ref callbacks and eliminating __del__ methods
[Tim] > there's no 100% guarantee that a __del__ method will ever get called Can anyone point me to any definitive documentation on why this is the case? I was under the impression that __del__ would always be called: 1. for objects not in cycles and with no references 2. for objects whose only references are from cycles which themselves have no external references and no __del__methods, assuming that garbage collection runs. > __del__ methods (weakref callbacks too, for that matter) triggered > while Python is tearing itself down at exit may suffer bizarre > exceptions (due to trying to use facilities in partially-torn down > modules, including the module the __del__ method appears in). Good point. > In general, __del__ is a user-visible method like any other, and user > code may call it explicitly. For that reason, it's safest to write > __del__ methods in library objects such that they can be invoked > multiple times gracefully. Another good point - thanks. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: "private" variables a.k.a. name mangling (WAS: What is print? A function?)
[Steven] > Can someone give me an example of where __-mangling really solved a problem > for them, where a simple leading underscore wouldn't have solved the > same problem? http://cvs.sourceforge.net/viewcvs.py/spambayes/spambayes/spambayes/Dibbler.py?r1=1.13&r2=1.13.4.1 That's a bugfix to SpamBayes, where I'd inadvertently named an instance variable '_map' without realising that the base class (asynchat.async_chat) also had an instance variable of that name. Using double underscores fixed it, and had I used them from the beginning the bug would never have cropped up (even if asynchat.async_chat had an instance variable named '__map', which is the whole point (which you know, Steven, but others might not)). -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: "private" variables a.k.a. name mangling (WAS: What is print? A function?)
[Toby] > The problem occured because the double-underscore mangling uses the class > name, but ignores module names. A related project already had a class named C > derived from B (same name - different module). Yikes! A pretty bizarre case, but nasty when it hits. I guess the double-underscore system can give you a false sense of security. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Who should security issues be reported to?
[Duncan] > I'm intrigued how you managed to come up with something you > consider to be a security issue with Python since Python offers no > security. Perhaps, without revealing the actual issue in question, you > could give an example of some other situation which, if it came up in > Python you would consider to be a security issue? I can't speak for the OP, but one hypothetical example might be a buffer overrun vulnerability in the socket module. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE history, Python IDE, and Interactive Python with Vim
[Ashot] > I have been frustrated for quite some time with a lack of a history > command in IDLE To recall a line from your history in IDLE, cursor up to that line and hit Enter. > I've tried something called pyCrust, but this too didn't have history To recall a line from your history in PyCrust, press Ctrl+UpArrow. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE history, Python IDE, and Interactive Python with Vim
[Steve] > The history is required to be available in a chunk, to copy and paste > into a file. I see, sorry, I didn't catch that the first time round. (In PyCrust you can use Alt+LeftDrag to copy a rectangular selection - you'll still need to remove any output, but at least you can get rid of the >>> prompts in one go.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there something similar to ?: operator (C/C++) in Python?
[Dave Brueck] > Please keep the discussion civil; please help keep c.l.py a nice place to > visit. +1 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: FlashMX and Py2exe doesn't fly...
[Jim] > They did it with Gush: (I think) >http://2entwine.com/ > > It's a py program that embeds Flash very nice. Very nice indeed! Does anyone know any details about the technology they used for this? It appears to be closed source, and I couldn't see anything on their site about the architecture (other than a list of credits that includes ctypes, win32all, Macromedia and SciTE|Flash). -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Better console for Windows?
[Christos, on widening the Windows Command Prompt] > Hm... right-click the cmd.exe window's title bar (or click on the > top-left icon, or press Alt-Space), go to Properties, Layout tab, Window > Size, Width. Just to take this thread *completely* off-topic: does anyone know of a way to scroll a Command Prompt window using the keyboard? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: MS Compiler to build Python 2.3 extension
[Gary] > I recenly built a C API Python extension for Python 2.3 > on OS X, and now I need to build it for Windows. Will > [MS Visual Studio Pro 6.0] do the trick? Yes. That's exactly the compiler that Python 2.3 itself, and most 2.3 extensions, were built with. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: MS Compiler to build Python 2.3 extension
[woodsplitter] > MS Visual C++ 6 is indeed the compiler that the python.org > distributions are built with Just to add back some context for people not following the thread: this is Python 2.3 we're talking about. 2.4 is built with Visual Studio.NET. > but MinGW works fine too. In fact, the > code generated by MinGW-GCC 3.4.4 outpaces that generated by MSVC++ 6.0 > by a considerable margin in some of my performance-critical extensions, > and the size of the binaries is often smaller. Interesting! -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Better console for Windows?
[Richie] > does anyone know of a way to scroll a Command Prompt window using the > keyboard? [Bengt] > Alt-spacebar, e, l, (uparrow/downarrow)*, Esc > (lower case L)--^ ^--does the scrolling. Esc ends the > scrolling mode. [Christos] > Damn! it says Scroll in there in the system menu, doesn't it? Talk > about blindness... Me too! Many thanks, Bengt. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: When someone from Britain speaks, Americans hear a "British accent"...
[Chan] > T can be silent in England too .. > > frui' > cricke' [Stephen] > Both of those words (fruit and cricket) have the letter T sounded. > > Stephen (Nationality: English). Not necessarily - in my native accent they'd be replaced with glottal stops. Richie (Nationality: West Yorkshire 8-) (Having a daughter has improved my speech - I'm much more careful about enunciating my words properly so that she doesn't pick up my bad habits.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Software needed
[Fuzzy] > There's a Python interface to TWAIN (the scanner protocol) [Alexis] > Where I could find the TWAIN python interface ? Try typing "python twain" into Google. The first hit is: http://twainmodule.sourceforge.net/ "The Python TWAIN module provides an interface to scanners, digital cameras and other devices which implement TWAIN, for the Windows platform. It provides the functionality to allow a Python application to connect to the scanner/camera and to retrieve images from that device." -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Lots of pdf files
[Duncan] > a mere $29.90, except it is GPL'd so I'm not sure what the money is for "Tech support [...] free forever for registered users." But I've often wondered whether you could charge for mass-market GPL software simply because your ordinary punter doesn't know what the GPL is, and doesn't mind paying a small amount of money for decent software. Whether it's ethical, given that presumably the thing is GPL because it inherits GPL code from other developers, I don't know. Certainly the GPL itself has no objection to charging for binaries provided you ship the source as well. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Py: a very dangerous language
[Harald] > Always go to bed exactly when you want to write the first lambda. [Peter] > Eureka. The Twentieth Pythonic Thesis has finally surfaced. +1 QOTW. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: .pth files
[Sylvain] > I've some questions regarding pth files (which btw are undocumented in the > python reference, is this intentional ?) http://google.com/search?q=site:docs.python.org%20pth The first hit explains how .pth files work (although it's the sort of documentation that makes Xah Lee explode with fury). -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Database of non standard library modules...
[Steve] > While cheeseshop might resonate with the Monty Python fans I have to > say I think the name sucks in terms of explaining what to expect. If I > ask someone where I can find a piece of code and the direct me to the > cheese shop, I might look for another language. +1 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Network performance
[Roland] > The client sends a number of lines (each ending with \n) and ends one > set of lines with a empty line. > [...] > I was surprised to find that the performance was [poor]. Are you sending all the lines in a single packet: >>> sock.send('\n'.join(lines)) or sending them one at a time: >>> for line in lines: >>> sock.send(line + '\n') ? If the latter, you are probably experiencing "Nagle delays". Google will furnish you with any number of explanations of what that means, but in summary, one end of a TCP/IP connection should never send two consecutive small packets without receiving a packet from the other end. ('Small' typically means less than about 1400 bytes.) Each time you do that, you'll suffer an artificial delay introduced by TCP/IP itself. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: The ONLY thing that prevents me from using Python
[Chris] > Not to be a shill, but I'd be interested in testimonials on > http://linode.org/ > I wonder if virtualization is the next killer app. > Certainly blows the WTF my ISP? question away... I can't speak for linode.org, but I have a Xen VPS from rimuhosting.com and it's early days but so far I've been very impressed. It's $19/mo (normally $20 but they kindly gave me a 5% Open Source Developer discount) which is not that much more than a decent shared hosting account. You need to be comfortable with administering your own Linux box, but these days that's not difficult. (NB. entrian.com is not running on it yet.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Does any1 use pcapy module on win32 platforms?
[billiejoex] > Hi. I'm trying to use pcapy module on Windows XP prof sp2 [...] > On Windows machines the findalldevs() function (an output on the bottom) > gives an unicode object that can't be processed by open_live function > that tipically accept strings. > > >>> pcapy.findalldevs() > [u'\u445c\u7665\u6369\u5c65\u504e\u5f46\u6547\u656e\u6972\u4e63\u6964\u5773\u6e6 > [...] For what it's worth, I can run that on my XP Professional SP2 machine and it works perfectly: >>> pcapy.findalldevs() [u'\\Device\\NPF_{15310604-FCFC-4016-9D36-14DAA948A600}', u'\\Device\\NPF_{62280C1D-DC5C-42AF-BA0F-6BDB48418CA5}'] I'm using WinPcap 3.0. My packet.dll is stamped as version 3.0.0.18. Maybe you're running a different version? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Code run from IDLE but not via double-clicking on its *.py
[n00m] > WHY ON THE EARTH <'module' object has no attribute 'AF_INET'> ??? Because you have a socket.py in d:\python23\00 which is being picked up instead of Python's own socket module. You shouldn't give your modules the same name as Python's own modules. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Code run from IDLE but not via double-clicking on its *.py
[n00m] > Funnily but I still can't get the code working... WITHOUT IDLE. > I think it's because of "import thread" line. Seems something > wrong with "opening" this module. In IDLE it works OK. It's difficult to diagnose your problem with so little information. Please post: o The command you're typing into the command prompt o The error message you're getting o The full traceback o The code you're trying to run, or if it's too big then the piece that the last line of the traceback refers to Thanks, -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Code run from IDLE but not via double-clicking on its *.py
[n00m] > D:\>python23\python d:\python23\socket6.py [Enter] > > It's OK so far. Python code is launched and starts listening > to port 1434 (see the code below; it's the same code as in my > neibouring topic). > Now I launch a vbs script (which will connect to port 1434). > I.e. I just double-click "my.vbs" file. > And... voila! In a moment & silently console window closes > without any error messages (or I just don't see them). > But VBS reports a network error. Tested on win2k and win98. That sounds impossible, so I must be misunderstanding something. What happens when you do this (forgive me if this seems patronising, but I'm missing something about the way you're working) 1. Start a new Command Prompt via Start / Programs / Accessories / Command Prompt (or the equivalent on your machine) 2. Type the following: d:\python23\python d:\python23\socket6.py [Enter] 3. Double-click your .vbs file in Windows Explorer. Now what does the python Command Prompt say? By your description above, it sounds like it disappears, but that ought to be impossible. -- Richie Hindle [EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list
Re: SpamBayes wins PCW Editors Choice Award for anti-spam software.
[Alan] > SpamBayes has won the Personal Computer World (pcw.co.uk) Editors Choice > award for anti-spam software Yay! Do we get one of those cheesy medals to put on our website? 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Code run from IDLE but not via double-clicking on its *.py
[Richie] > Now what does the python Command Prompt say? [n00m] > It says... NOTHING! It just DISAPPEARS! That's the strangest thing I've heard all week. 8-) OK, one more thing to try - redirect the output of Python to some files and see whether anything useful appears in the files: C:\> d: D:\> cd \python23 D:\> python d:\python23\socket6.py > out.txt 2> err.txt Does anything appear in d:\python23\out.txt or d:\python23\err.txt? [Dennis] > I'd be tempted to blame the VBS script then... n00m, can you post the vbs? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: ANNOUNCEMENT: The ring of the friendly serpent in business suite: Python, Zope, Plone
[Miklos] > The ring of the friendly serpent in business suite: Python, Zope, Plone > http://www.jegenye.com/ Did you mean "business suit"? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Zeus Programmers Editor V3.94
[Jussi] > The latest release of the Zeus for Windows programmer's > editor is now available. [Gabriel] > So is this mentioned here on the Python mailing list because Zeus was > written in Python, or is this just targeted spam for a commerical product? >From the features page: > o Syntax highlighting for C\C++, Clipper, Cobol, Fortran, Java, Pascal, Perl, > Python, PHP, SQL etc > o Fully Scriptable using the Python, Lua or SmallC, VB Script, Java Script, > Ruby Script languages > o Integrated debugger supports the Java, Perl, Python and C# languages IMHO that makes it of general interest to Python programmers. Whether or not it's a commercial product seems irrelevant. For myself, announcements of Python-related products, whether free or commercial, are welcome here (though python-announce / c.l.p.a might be a better place, from the point of view of both readers and announcers). -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Is Python as capable as Perl for sysadmin work?
[Steve] > Was it INTERCAL that had the COMEFROM statement instead of > GOTO? I REALLY like the idea of a COMEFROM statement. I think python should > have a COMEFROM statement It does - see http://entrian.com/goto/ (In case you doubt it: yes, it works, but note that it doesn't work at the interactive prompt, only in a real source file.) (The fact that I felt obliged to add the first paragraph on that page is the funniest part of the whole thing. I really did have people genuinely thanking me for the module, asking for features, asking for help with using it, and so on.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: lambda and for that matter goto not forgetting sugar
[Philip] > For that matter I would find implementing the classical algorithms far > easier if python had 'goto' I can't believe it - first a request for COMEFROM and now one for GOTO, both on the same day. I should have put http://entrian.com/goto/ under a commercial license. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: OT: Anyone want a GMail account?
[Chris] > I've got 50 so if you want a GMail invite reply directly to me and > I'll send our an invite. You can share your GMail invites here: http://isnoop.net/gmailomatic.php "This page offers a place for people with Gmail invites and those who want them to come together with minimal effort and fuss. Currently, we have 1,500,443 invites available to share. Thanks to the generosity of folks like you, we've distributed 248,204 invites since this page went up on Sep 13, 2004." Hitting Reload a couple of times, they seem to be accumulating and distributing several invites per second. Shame it's written in PHP 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: lambda and for that matter goto not forgetting sugar
[Christos] > *Three* requests --check the thread "goto, cls, wait commands". I saw that too, and was too freaked out to respond. > BTW, my sincere congratulations for what I presume best computer related > April's > Fool joke of all time; I love double-bluffs. The worst of all is I've often > referenced your joke when advocating python... :) Thanks! I think the fact that it was possible at all is a *genuine* advert for Python's power and flexibility. (Though modifying Python itself in order to make the joke possible was quite a lot of work: http://sf.net/tracker/?func=detail&atid=305470&aid=643835&group_id=5470 8-) [John] > from goto.py ( http://entrian.com/goto/ ): > .# Label: "label .x" XXX Computed labels. > > :-) Yay! I've been waiting nearly a year for someone to spot that. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Is there way to determine which class a method is bound to?
[vic] > I'm doing some evil things in Python and I would find it useful to > determine which class a method is bound to when I'm given a method > pointer. Here you go: >>> class Foo: ... def bar(self): ... pass ... >>> Foo.bar.im_class >>> Foo().bar.im_class >>> -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Gordon McMillan installer and Python 2.4
[Svein] > According to the command line help for cx_Freeze and py2exe, they > cannot pack my program with additional installation files into one > self-extracting .exe file (which is what I want to do). [Peter] > On the other hand, there are readily available utilities that > will do what you are asking for, independent of Python and py2exe > and everything else. Standalone single-file packagers. InnoSetup is the most popular free single-file-installer generator for Windows. NSIS is probably second. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: os.system()
[Nick] > $ ps axf > 5121 ?S 0:00 rxvt > 5123 pts/77 Ss 0:00 \_ bash > 5126 pts/77 S+ 0:00 \_ python > 5149 pts/77 S+ 0:00 \_ sh -c sleep 60 > z > 5150 pts/77 S+ 0:00 \_ sleep 60 Wow, good feature of ps - thanks for the education! I learn something valuable from comp.lang.python every week, and most of it has nothing to do with Python. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python- xxxxxxxxxxxxxx Dev] RELEASED Python 2.4.1, release candidate 1
[Martin] > I'd like to encourage feedback on whether the Windows installer works > for people. It worked fine for me, upgrading from 2.4 on XPsp2. The only glitch was that it hung for 30 seconds between hitting Next on the directory-choosing page and the feature-choosing page. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1
[Martin] > I'd like to encourage feedback on whether the Windows installer works > for people. [Me] > It worked fine for me, upgrading from 2.4 on XPsp2. Gah! I didn't mean to send that. It *didn't* work, as it turns out. It didn't overwrite python24.dll. It's possible that there was a process running at the time that was using python24.dll (I have a bunch of scheduled jobs that run in the background), but the installer didn't say anything about being unable to write the file. I could try again, but maybe there's some useful information you can get from the partially upgraded environment. Here's how the \python24 directory looks: C:\Python24>dir /od Volume in drive C has no label. Volume Serial Number is E031-65A3 Directory of C:\Python24 26/11/1997 06:14 766 py.ico 11/04/2002 06:40 766 pyc.ico 24/03/2003 22:33 633 python.exe.manifest 24/03/2003 22:33 633 pythonw.exe.manifest 03/11/2004 15:3713,499 LICENSE.txt 09/11/2004 16:2761,440 Removepywin32.exe 09/11/2004 16:2899,601 pywin32-wininst.log 30/11/2004 11:49 1,867,776 python24.dll 21/01/2005 14:2120,992 Removeelementtree.exe 21/01/2005 14:21 3,191 elementtree-wininst.log 31/01/2005 14:4661,440 Removectypes.exe 31/01/2005 14:4625,371 ctypes-wininst.log 15/02/2005 14:3061,440 Removepy2exe.exe 15/02/2005 14:30 Scripts 15/02/2005 14:30 5,621 py2exe-wininst.log 18/02/2005 16:5950,963 README.txt 10/03/2005 10:13 228,444 NEWS.txt 10/03/2005 10:36 4,608 w9xpopen.exe 10/03/2005 10:46 4,608 python.exe 10/03/2005 10:46 5,120 pythonw.exe 11/03/2005 08:55 DLLs 11/03/2005 08:55 include 11/03/2005 08:55 libs 11/03/2005 08:55 tcl 11/03/2005 08:55 Tools 11/03/2005 08:55 .. 11/03/2005 08:55 . 11/03/2005 08:55 Doc 11/03/2005 08:56 Lib 19 File(s) 2,516,912 bytes 10 Dir(s) 14,520,340,480 bytes free And here's what Python thinks it is: C:\Python24>python 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. >>> -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1
[Martin] > However, I just noticed that the python24.dll is in c:\python24. Could > it be that you have another one in \windows\system32? I do, yes. > If so, could it > also be that the installer has told you that the target directory > exists, and asked whether you want to proceed anyway? It probably did, yes. > In that case, your 2.4 installation was a per-user installation, and the > 2.4.1c1 installation was a per-machine (allusers) installation. These > are mutually not upgradable, so you should now have the option of > uninstalling both in add-and-remove programs. I'd be surprised if the existing 2.4 was per-user, because I usually ask for all-users. It's possibly that it was an all-users installation but I copied the DLL into C:\Python24 for some reason [...digs around...] yes, I think that must be the case. It has a creation date much later than C:\python24\Lib, for example. The python24.dll in C:\windows\system32 is 2.4.1c1. In which case, I think it all worked perfectly but didn't take into account my manual addition of python24.dll to C:\python24 - which is fair enough, really. [ I only see "Python 2.4.1c1" in the Add/Remove list, and no other Python 2.4 entries (apart from the likes of "Python 2.4 ctypes-0.9.2") but that's to be expected. ] Thanks for looking into this, and sorry to take up your time with something that boils down to user error. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] RELEASED Python 2.4.1, release candidate 1
[Richie] > It's possibly that it was an all-users installation but I > copied the DLL into C:\Python24 for some reason [Martin] > Ah, ok. I could not have thought of *that*. That also explains it: the > upgrading simply did not manage to remove/replace your copy of > python24.dll. > > It's easy to see the effect, then: Windows looks for python24.dll first > in the directory of python.exe (where no DLL should have been found), > and would only fallback to system32 then (which it didn't in your case). Yes, that's what's happened. I've copied the new python24.dll into C:\python24, and everything now thinks it's 2.4.1c1. Sorry about that. (I wish I could remember why I'd copied the DLL, but I can't. I'd like to think there was a good reason. 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Docs. Hardcopy 2.4 Library Reference, interested?
[Brad] > Is anyone interested in purchasing a hardcopy version of the Python 2.4 > Library reference? Have you seen http://www.network-theory.co.uk/python/ ? (I don't know anything about it beyond what's on that page.) For what it's worth, I wouldn't want a hardcopy manual - I find the electronic one easier to use. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Docs. Hardcopy 2.4 Library Reference, interested?
[Brian] > I have one in the pipeline but I'm waiting for sales of the Python > Tutorial and Python Language Reference to justify bringing it out. I'd be interested to know how many of these manuals you sell...? This is only idle curiosity, and if you don't want to say then that's no problem. (I'd briefly considered doing this myself, until I found your site.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: gather information from various files efficiently
[Keith] > Sigh, this reminds me of a discussion I had at my work once... It seems > to write optimal Python code one must understand various probabilites of > your data, and code according to the likely scenario. 8-) s/Python //g -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Tibia 0.1 DOM-based website editor
[Robert] > Tibia is an in-browser editor for web pages. It allows you to quickly > and easily modify the content of your web pages. It allows you to > directly view, edit, and save files on your webserver. Very impressive! I ran into a couple of difficulties but otherwise it's a great tool. I had to hard-code a username - does it require you to use HTTP authentication before it will work? If so, it would be good if you mentioned that in the documentation. It also erased my HTML file when I tried to save my changes. 8-) I'll try to track that one down if I get the chance. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: uptime for Win XP?
[Esmail] > Is there a way to display how long a Win XP system has been up? > Somewhat analogous to the *nix uptime command. [Greg] >>> import win32api >>> print "Uptime:", win32api.GetTickCount(), "Milliseconds" Note that in the unlikely event of your Windows machine being up for longer than 2^32 ms (about 49 days), GetTickCount() will wrap back to zero. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: ANN: Python Test Environment
[Michael / Fuzzyman] > http://www.voidspace.org.uk/atlantibots/pythonutils.html#testenv I've seen this announcement four times now - I don't whether you're seeing problems with it, but it's definitely reaching the mailing list. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
wxPython documentation [was: Best GUI for small-scale accounting app?]
[Gerhard, quoting a blog] > wxPython doesn't seem bad, but it lacks any documentation I see this a lot, and it baffles me. wxPython is a thin wrapper over wxWidgets, which is very well documented. Where they differ, the wxWidgets documentation discusses those differences. Add the excellent wxPython demo, and you've got better documentation than some commercial toolkits (MFC, for instance). Is it just a communication problem - do newcomers not realise that the wxWidgets documentation applies to wxPython? (The latest version of the wxPython demo even lets you modify the demo code at runtime, and compare the behaviour of your modified version with the original, all without leaving the demo - fantastic! Huge thanks to whoever did that.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: newbie question
[Doug] > I'm only halfway through his message. It would take me all day to point > out all [Peter Hansen's] flames. Doug, this is not worth your time. It certainly isn't worth mine, nor that of the other thousands of people who are being subjected to this argument. Please, consider putting your energies into something more positive, either here or elsewhere. Peter, Fredrik: Please consider giving up the argument. Hopefully Doug will either lighten up and return to contributing usefully, or give up and go away. (For what it's worth, I'd rather it was the former.) the-last-haven-of-civilisation-on-the-net-is-under-threat-ly yrs, -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: subclassing list
[Uwe] > How [do] you clear the contents of a list subclass > without creating a new object? Use the paranoia emoticon: "del x[:]". For example: >>> class L(list): ... pass ... >>> x = L() >>> x.append("Spam") >>> del x[:] >>> x [] >>> type(x) >>> with-thanks-to-Gordon-McMillan-ly y'rs, -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Python limericks (was Re: Text-to-speech)
[Michael] > from itertools import repeat > for feet in [3,3,2,2,3]: > print " ".join("DA-DA-DUM" > for dummy in [None] > for foot in repeat("metric", feet)) Spectacular! +1 QOTW -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Things you shouldn't do
[Steven] > If you have access to a syntax-aware editor, it will > help avoid such problems Seconded. Here's my favourite real-world example of where the lack of syntax colouring cost several man-days of work (though this couldn't happen with modern C compilers): extern void get_s(short* s); void f() { int i;/* An integer to do something /* short s; /* A short to do something */ get_s(&s); /* Do something with s */ } -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [perl-python] Python documentation moronicities (continued)
[Xah] > motherfucking ... fucking ... fucking ... fucking ... fuck ... fucking > fucking ... fucking ... mother fucking ... fucking ... piece of shit ... > motherfucking ... fucking ... fucking ... big asshole ... masturbation ... > Fucking morons ... fucking stupid ... fuckhead coders ... fuckheads ... > you fucking asses. > paypal me a hundred dollars and i'll rewrite the whole re doc in a few > hours. Can we paypal you a hundred dollars to leave us alone? I'll pledge $10. Are there another nine people here who'll do the same? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Compute pi to base 12 using Python?
[Dan] > Now you've got me curious. Why would an artist want the first 3003 > digits of pi to the base 12? [Dick] > He says, > Do you know how I can get "base12 pi"? > Because the chromatic scale is base12. > c c# d d# e f f# g g# a a# b He should read Douglas Adams' fictional essay "Music and Fractal Landscapes", from "Dirk Gently's Holistic Detective Agency": "I believe that there must be a form of music inherent in nature, in natural objects, in the patterns of natural processes. A music that would be as deeply satisfying as any naturally occurring beauty [...]" You can see the text here: http://66.102.9.104/search?q=cache:3Ni6gRXCcJgJ:tash.dns2go.com/FTP/P800/Books%2520txt/Douglas%2520Adams%2520-%2520Dirk%2520Gently%27s%2520Holistic%2520Detective%2520Agency.txt+%22douglas+adams%22+%22Music+and+Fractal+Landscapes%22&hl=en or via this tinyurl: http://tinyurl.com/6ugnk (Search within that page for the phrase "Music and Fractal Landscapes". Or Google for it, which is how I found the link.) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Python documentation moronicities (continued)
[Xah] > I have produced my doc. > ( http://xahlee.org/perl-python/python_re-write/lib/module-re.html ) > > isn't there a hundred dollars due to me? I don't have the time to write a full review of your version, but for the record I've compared it with the original and I don't think it's a significant improvement (apart from the title - "String Pattern Matching" is a better title than "Regular expression operations"). (And no, I'm not sure I could do any better, but that's not the question.) [Xah] > it is published and announced here on April 18th. [Steve] > I'll have to take your word for that. Xah is right - I have a copy here of his message of 18th April, saying "i have rewrote the Python's re module documentation.". -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Why and how "there is only one way to do something"?
[Steve] > Since Python is Turing-complete Is there some equivalent of Godwin's Law that we can invoke at this point? 8-) -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: ANNOUNCE; Try python beta
[Claudio] > The page doesn't work for me in MSIE (I am on a Windows system) [Mike] > Yeah, I know. I poked at it briefly, but couldn't figure out what was > goiing on. MSIE on the Mac doesn't work at all (no AJAT), and I don't > have regular access to a Windows box to try it on. I think it's your JavaScript '\r' processing that's broken. Certainly the error ("unexpected EOF while parsing") is consistent with having a \r on the end of the expression. Won't this: if (input.length == 1) always fail in the case where the user has typed a newline? I'd ditch that code and do it at the server end: expr = expr[4:].strip() -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: pythonic equivalent of upvar?
[David] > I'm trying to write something with the same brevity > as perl's one-liner > > eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; import sys, re for arg in sys.argv[1:]: if re.match(r'\w+=.*', arg): exec arg else: break -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Disable 'windows key'
[Paul] > I wonder if there might be a way of disabling [the windows key] within > my program. IHateThisKey will do this globally: http://www.bytegems.com/ihatethiskey.shtml The free edition blocks the Windows key, and the paid one ($10) lets you control all kinds of keys in quite flexible ways. You can still use the Windows key as a modifier (as in Windows+E for Explorer). No affiliation other than as a happy customer. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: ANNOUNCE; Try python beta
[Richie] > I think it's your JavaScript '\r' processing that's broken. Certainly the > error ("unexpected EOF while parsing") is consistent with having a \r on the > end of the expression. [Mike] > Python doesn't care about the trailing newline. That's a carriage return, not a newline: >>> eval("1+2\r") Traceback (most recent call last): File "", line 1, in ? File "", line 1 1+2 ^ SyntaxError: unexpected EOF while parsing > My assumption is that if splitting on '\n' leaves us with one > thing, we may have gotten a string that used \r for newlines Ah, OK. Your comment talks about DOS - that won't happen on DOS (or Windows) which uses \r\n. I don't know about the Mac. But the \r\n pair isn't handled by your code - strip() on the server side will make it work if that's the problem: >>> eval("1+2\r".strip()) 3 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Disable 'windows key'
> But can it change "Fn" key mapping? I don't think so, no. There's no obvious user interface for that, anyway. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Which Python web framework is most like Ruby on Rails?
[Pierre] > I am Karrigell's author. I have chosen the GPL licence almost at random > (I saw that the Python licence was GPL-compatible), so I don't mind > switching to another Open Source licence if the GPL is liable to cause > problems. Which one would you advice : BSD ? Python licence ? another ? Well done on being open-minded! You will hear valid arguments for GPL, LGPL, BSD and other licenses (though the Python license is unsuitable for anything other than Python - see http://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq) A good solution would be multiple-licensing. You state that the code is (for example) triple-licensed under the GPL, LGPL and BSD licenses. The user of your code decides which license to obey. It's no more work for you, and you can please almost everyone (the only people you won't please are those who believe that there is One True License, and frankly you should ignore them - it's your code). The only downside of allowing people to choose the BSD license rather than the GPL is that potentially someone can choose the BSD license, improve Karrigell, ship their product based on the improved code, and not give those improvements back to the community. But the Python license allows for this too, and Python hasn't suffered for it. IMO choosing a BSD license will get you more users than GPL, and the benefits of that will outweigh the potential downside. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: os.path.splitext() and case sensitivity
[rbt] > Is there a way to make os.path.splitext() case agnostic? > > def remove_file_type(target_dir, file_type): > for root, dirs, files in os.walk(target_dir): > for f in files: > if os.path.splitext(os.path.join(root, f))[1] in file_type: > pass > > remove_file_type(sysroot, ['.tmp', '.TMP']) def remove_file_type(target_dir, file_type): [...] if os.path.splitext(f)[1].lower() == file_type.lower(): pass remove_file_type(sysroot, '.tmp') -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Which Python web framework is most like Ruby on Rails?
[Paul] > The web app gets run by Karrigell like a CGI script > is run by Apache, like a Linux app is run by the Linux kernel. Paul, you keep making comparisons between Python web frameworks and the Linux kernel. Are you aware that there is a special note attached to the Linux GPL[1] explaining that user-space code is not considered a derived work of the Linux kernel? Without that note, user-space code *could* be considered a derived work of the kernel (obviously, or Linus Torvalds would not have included the note). Unless a GPL web framework carries a similar notice, the comparison doesn't hold up. [1] http://www.linux-m32r.org/lxr/http/source/COPYING -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: URL 'special character' replacements
[Claude] > I have a huge list of URLs. These URLs all have ASCII codes for special > characters, like "%20" for a space or "%21" for an exclamation mark. You need urllib.unquote: >>> import urllib >>> help(urllib.unquote) Help on function unquote in module urllib: unquote(s) unquote('abc%20def') -> 'abc def'. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: recursively removing files and directories
[rbt] > What is the most efficient way to recursively remove files and directories? shutil.rmtree: http://docs.python.org/lib/module-shutil.html#l2h-2356 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: undefined SW_MAXIMIZE for ShowWindow function
[Etayki] > How do I get SW_MAXIMIZE to be defined? It's in win32con. Like this: >>> from win32con import * >>> SW_MAXIMIZE 3 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: undefined SW_MAXIMIZE for ShowWindow function
[Etayki] > OK, so it it turns out, the window will maximize when SW_MAXIMIZE =3. > But where can I find some documentation for that? ShowWindow is a Win32 API call, so Googling within msdn.microsoft.com will usually get you straight to the relevant documentation: http://www.google.com/search?q=ShowWindow+site%3Amsdn.microsoft.com -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: undefined SW_MAXIMIZE for ShowWindow function
[Fredrik] > oops. thought you were using ctypes, not the pythonwin extensions. Even when I'm using ctypes I use win32con for the constants, unless there's some special reason why I need the code to be independent of pywin32. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: List match
[Stephen] > [...] compare 2 lists and generate a new list that does not copy similar > entries. An example below > > list= ["apple", "banana", "grape"] > list2=["orange","banana", "pear"] > > now I want to compare these lits and generate a third list after > comparison > > list3 would be ["apple", "banana","grape","orange", "pear"] Use sets: >>> from sets import Set as set # For compatibility with Python 2.3 >>> one = ["apple", "banana", "grape"] >>> two = ["orange","banana", "pear"] >>> print list(set(one) | set(two)) ['grape', 'apple', 'orange', 'pear', 'banana'] -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: [OT] Re: can't open word document after string replacements
[Antoine] > I have a word document containing pictures and text. This documents > holds several 'ABCDEF' strings which serve as a placeholder for names. > Now I want to replace these occurences with names in a list (members). [Bruno] > I don't know how it's named in english, but in french it's (well - it > was last time I used MS Word, which is quite some times ago???) "fusion > de documents". "Mail Merge"? -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Having problems with strings in HTML
[Kiana] > http://bbc.botany.utoronto.ca/[...]?input=&max=2[...]";> [Lawrence] > By the way, you _do_ realize that your "&" characters should be escaped > as "&", don't you? [Sion] > No they shouldn't. They part of the url, which is (IIRC) a CDATA > attribute of the A element, not PCDATA. The W3C validator at http://validator.w3.org/ disagrees with you. It accepts this: http://www.w3.org/TR/html4/strict.dtd";> Test http://somewhere.com?a=1&b=2";>link but rejects this: http://www.w3.org/TR/html4/strict.dtd";> Test http://somewhere.com?a=1&b=2";>link saying "cannot generate system identifier for general entity "b" [...] The most common cause of this error is unencoded ampersands in URLs". -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: getting current UNIX uid
[Johhny] > I am trying to get the user that is running the scripts uid, I have had > a look at the pwd module and it does not appear to offer that > functionality. Is there any way within python to get that information ? It's in the 'os' module: >>> import os >>> os.getuid() 553 -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Django website
[Antal] > is there something wrong with django's website (djangoproject.com) > or I have problems? > It looks ugly, the css files can't be found, I even cannot download > the source from there. It's broken for me too, so it's not a problem at your end. -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: What's going on here?
> What is subclassing adding to the class here? A __dict__: >>> o = object() >>> dir(o) ['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__'] >>> class C(object): pass ... >>> c = C() >>> dir(c) ['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__'] -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list