Re: socket client server... simple example... not working...
SpreadTooThin wrote: Jean-Paul many thanks for this and your effort. but why is it every time I try to do something with 'stock' python I need another package? Twisted has it's fan, but you don't need it. Your code had a few specific problems, and fixing them has little or nothing to do with Twisted. By the time I've finished my project there are like 5 3rd party add-ons to be installed. I know I'm a python newbie... but I'm far from a developer newbie and that can be a recipe for disaster. The stock socket should work and I think I've missed an obvious bug in the code other than checking the return status. Obviously you wanted to recv() on your 'clientsocket' not your 'seversocket'. You can use sendall() to send all the given data; it will raise an exception if it fails so there's no return code to check. Since TCP is a stream protocol and does not have any concept of message boundaries, you'll need to delimit messages within your protocol, and call recv() until you have an entire message. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 5 Oct 2006 22:54:46 -0700, MonkeeSage [EMAIL PROTECTED] wrote: hanumizzle wrote: Why a subset? I don't think JSON is a subset of YAML. Apparent slip of the fingers by OP. From JSON website: JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. I'm happy with my Pythonesque YAML syntax, thank you. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Pysqlite tables in RAM
Fredrik Lundh wrote: Ranjitha wrote: I want to store my data in a database on the disk. I also want to be able to reload the tables into the RAM whenever I have a lot of disk accesses and commit the changes back to the database. using the cache_size and synchronous pragmas sounds like a better way to trade reliability against speed/memory use. e.g. table_memory = 1 # bytes cur.execute(pragma cache_size = %d; % (table_memory / 1500)) ... cur.execute(pragma synchronous = off;) # do lots of stuff cur.execute(pragma synchronous = full;) for more on this, see: http://www.sqlite.org/pragma.html /F Thanks a lot for the help but could you please elaborate on this. I'm finding it difficult to follow the link you sent me. The jargon seems all too new for me. Thanks, Ranjitha -- http://mail.python.org/mailman/listinfo/python-list
Re: socket client server... simple example... not working...
SpreadTooThin wrote: but why is it every time I try to do something with 'stock' python I need another package? it's well known that all problems known to man can be solved by down- loading Twisted, PyParsing, the Stream Editor, or that other programming language that cannot be named. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On Oct 6, 1:06 am, hanumizzle [EMAIL PROTECTED] wrote: I'm happy with my Pythonesque YAML syntax, thank you. :) YAML is a little more complex, and a little more mature. But JSON should not be ruled out. I actually like JSON personally. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 5 Oct 2006 23:19:18 -0700, MonkeeSage [EMAIL PROTECTED] wrote: On Oct 6, 1:06 am, hanumizzle [EMAIL PROTECTED] wrote: I'm happy with my Pythonesque YAML syntax, thank you. :) YAML is a little more complex, and a little more mature. But JSON should not be ruled out. I actually like JSON personally. I guess I'll keep an open mind. But I like editing YAML for the same reason that I like editing Python. (Although I admit I usually I gen my data structures in ipython and then dump them.) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
MonkeeSage wrote: YAML is a little more complex a little? when did you last look at the spec? and a little more mature. than JavaScript's expression syntax? are you sure you're not confusing libraries with standards here? (has anyone even managed to write a YAML library that's small and simple enough to be obviously correct?) /F -- http://mail.python.org/mailman/listinfo/python-list
Re: profiling memory usage
On 5 Oct 2006 16:21:50 -0700, Eddie [EMAIL PROTECTED] wrote: Hi, I am looking for a method to profile memory usage in my python program. The program provides web service and therefore is intended to run for a long time. However, the memory usage tends to increase all the time, until in a day or two the system cannot handle it any more and starts to do constant swapping. Is there a way to look at which objects or variables are taking the huge amount of memory space? Have a look at: http://www.velocityreviews.com/forums/t353289-memory-profiler.html -- Remember that time Thotsakan punched Neil Bush in the dick? -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 10/6/06, Fredrik Lundh [EMAIL PROTECTED] wrote: MonkeeSage wrote: YAML is a little more complex a little? when did you last look at the spec? and a little more mature. than JavaScript's expression syntax? are you sure you're not confusing libraries with standards here? (has anyone even managed to write a YAML library that's small and simple enough to be obviously correct?) Tell. I'm interested in knowing. -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
hanumizzle wrote: I guess I'll keep an open mind. But I like editing YAML for the same reason that I like editing Python. JSON is almost identical to Python's expression syntax, of course, while YAML isn't even close. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I correct an error in an old post?
Blair P. Houghton wrote: But they do about 10 things totally wrong with Google groups that I'd've fixed in my spare time in my first week if they'd hired me back when I was interviewing with them. So if they want it to work, they know where to find me. Doesn't seem likely, does it? But don't let it stop you. You don't need Google's permission to build a better Usenet service. They don't have any copyright on the posts, or other special protection. I'm a former Googler myself and I use their service all the time, but if yours is better I'll switch. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 10/6/06, Fredrik Lundh [EMAIL PROTECTED] wrote: hanumizzle wrote: I guess I'll keep an open mind. But I like editing YAML for the same reason that I like editing Python. JSON is almost identical to Python's expression syntax, of course, while YAML isn't even close. Getting the source now. S'pose it isn't too late to convert my project over... -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: Pysqlite tables in RAM
Ranjitha wrote: Fredrik Lundh wrote: Ranjitha wrote: I want to store my data in a database on the disk. I also want to be able to reload the tables into the RAM whenever I have a lot of disk accesses and commit the changes back to the database. using the cache_size and synchronous pragmas sounds like a better way to trade reliability against speed/memory use. e.g. table_memory = 1 # bytes cur.execute(pragma cache_size = %d; % (table_memory / 1500)) ... cur.execute(pragma synchronous = off;) # do lots of stuff cur.execute(pragma synchronous = full;) for more on this, see: http://www.sqlite.org/pragma.html /F Thanks a lot for the help but could you please elaborate on this. I'm finding it difficult to follow the link you sent me. The jargon seems all too new for me. For a start, you don't need to read the whole page, just the sections on cache_size [the more memory in the cache, the faster it will run -- up to a point, which you could experiment with] and synchronous [off = faster/dangerous, on = slower/safer]. It would help greatly if you said which particular words or phrases you don't understand, plus give an assurance that you have made *some* effort to help yourself e.g. googled the puzzling words/phrases ... Have you actually tried doing what Fredrik suggested? -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On Oct 6, 1:28 am, Fredrik Lundh [EMAIL PROTECTED] wrote: when did you last look at the spec? I'm fairly versed in JS objects, having written 10 or so extensions for firefox; but I've only used YAML for trivial tasks like config files. So I can't really say how they stack up in the big picture. But from what I have seen, JSON is a simpler and easier to use format than YAML. Regards, Jordan -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 5 Oct 2006 23:43:50 -0700, MonkeeSage [EMAIL PROTECTED] wrote: On Oct 6, 1:28 am, Fredrik Lundh [EMAIL PROTECTED] wrote: when did you last look at the spec? I'm fairly versed in JS objects, having written 10 or so extensions for firefox; but I've only used YAML for trivial tasks like config files. So I can't really say how they stack up in the big picture. But from what I have seen, JSON is a simpler and easier to use format than YAML. That and it sounds like Strongbad pronouncing the name 'Jason'. -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange sorting error message
Dustan wrote: Neil Cerutti wrote: On 2006-10-05, Dustan [EMAIL PROTECTED] wrote: Steve Holden wrote: Dustan wrote: I'm hiding some of the details here, because I don't want to say what I'm actually doing. [...] I have the answer to your problem but I don't actually want to tell you what it is. That's great, seeing as I already figured out the answer, as I have already posted in a reply. I had a good laugh at it. Are you saying I broke one of these rules? http://www.catb.org/~esr/faqs/smart-questions.html Or are you just being plain rude? A lack of a response from you implies the latter... SPOILER SPACE It was a joke, based on you hiding what you are doing, he decided to hide the solution to your problem. Get it? Ah, now I get it... Well, not really. I'm not outgoing, so it's hard for me to spot a joke when I see one. Even when it smacks you in the face, apparently. Anyway, I'm sorry if you thought I was getting at you in any way. Just trying to amuse the group ... regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Ilias Lazaridis wrote: You need just 2 active contributors - and the python community, not more Hmm, this number does not say much. It really depends on the required service level and how much time these two people can spend for maintaining the tracker service. Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list
Re: Block Structure Parsing
On 10/4/06, Blacktiger [EMAIL PROTECTED] wrote: Hi all, I'm new to this list because I had a question about parsing python block structure. I am taking a programming languages course this semester and for our final project we are writing an interperator in scheme(awful language) for whatever language that we want. The language that I want to do is one I have been designing for a little while and it shares some syntactic features of Python; most notably the block structure. What dialect of scheme are you limited to, if any? Because PLT and Chicken appear to have the widest selection of extensions, it might be good to look at them. Already on the chicken website (the cumbersome http://www.call-with-current-continuation.org/eggs/) I found this: http://www.iro.umontreal.ca/~boucherd/Lalr/documentation/lalr.html. Might be what you need, might not, can't be sure. Or you can just cheat, use s-exp syntax with unique semantics, and then use (read) as your 'parser'. :) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange sorting error message
Steve Holden wrote: Even when it smacks you in the face, apparently. Anyway, I'm sorry if you thought I was getting at you in any way. Just trying to amuse the group ... time to reinstate mandatory use of the wink tag ? /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Strange sorting error message
On 10/5/06, Neil Cerutti [EMAIL PROTECTED] wrote: It was a joke, based on you hiding what you are doing, he decided to hide the solution to your problem. Get it? What if it was for a proprietary software of some kind? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
RE: CGI Tutorial
content is great, my comments are editorial. I prefer PDF with bookmarks rather than HTML. 1. easy to print the whole thing and read offline. 2. easy to find a secion from bookmarks, rather that chasing links 3. easy to save on my local doc folder so I can be sure It will always be there. (i.e. I don't have to try to find it when you change servers) Of course that's just my opinion, I could be wrong ;) If you choose to go the PDF route, I've found OpenOffice 2.0 pretty good at generating PDF with bookmarks. Just don't get too complex or OO may hose you. -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
On 2006-10-04, Fredrik Lundh [EMAIL PROTECTED] wrote: Georg Brandl wrote: This is an issue in most Python documentation: you're not told if the described function is implemented in C, and if it is keyword arg-enabled. The arguments must be given names though, to be able to document them. the general rule is that if the documentation doesn't explicitly say that something is a keyword argument, it isn't, and shouldn't be treated as such. Is this general rules documeted somewhere? My impression is that readers of the documentation will treat arguments as keyword arguments unless this is explicitly contradicted. The reason for this is that when they learn about writing functions, parameters can be used as keuword arguments by default. So I don't think you can fault the readers for treating the documentation as if it is talking about python functions. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do this?
On 10/6/06, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 5 Oct 2006 11:28:08 +0100, Matthew Warren [EMAIL PROTECTED] declaimed the following in comp.lang.python: Now, I started programming when I was 8 with BBC Basic. Remember what the acronym BASIC stands for? Boobie-drawing Adolescent Symbolic Instruction Code. -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: OT Request
Dennis Lee Bieber wrote: On Thu, 5 Oct 2006 14:40:23 +0100, Matthew Warren [EMAIL PROTECTED] declaimed the following in comp.lang.python: This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email. Pardon, but is there any possibility you can disable this rather long block? I'm presuming you are accessing via the mailing list, but that mailing list is gatewayed to a Usenet news group (and unless you've managed to embed an X-noarchive header in email, Google Groups is going to have the message available in perpetuity). There is no single intended recipient -- the messages are being sent to anyone in the world interested in reading comp.lang.python, so all this overhead is meaningless. Or, at least, somehow fit a Usenet/email conventional signature marker -- (dash, dash, space, newline) before it... Most decent clients are designed not to quote material below such a marker. Sadly such garbage is usually appended at the insistence of pointy-haired corporate typess, many of them lawyers who need to justify their existence by helping companies to avoid liability. Since these declarations usually don't contain any definition of the phrase intended recipient we are presumably left to read the monds of the originators before deciding whether to notify the sender immediately and delete the email from your computer. For some reason the mail administrators of the same companies often appear to believe that Microsoft Exchange defines email standards for the Internet, and they don't even know what a signature separator is. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: CGI Tutorial
On 10/5/06, Sells, Fred [EMAIL PROTECTED] wrote: content is great, my comments are editorial. wrt what document? I prefer PDF with bookmarks rather than HTML. 1. easy to print the whole thing and read offline. 2. easy to find a secion from bookmarks, rather that chasing links 3. easy to save on my local doc folder so I can be sure It will always be there. (i.e. I don't have to try to find it when you change servers) wget will save you everytime. Of course that's just my opinion, I could be wrong ;) If you choose to go the PDF route, I've found OpenOffice 2.0 pretty good at generating PDF with bookmarks. Just don't get too complex or OO may hose you. LyX + pdflatex :) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Package to handle table text render (handle space or tab between the columns) ?
Hi, I would like print tabular values on terminal (stdout). Are there package to handle table text render ? Thanks for your help, Stephane -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
Ilias Lazaridis wrote: Ben Finney wrote: Ilias Lazaridis [EMAIL PROTECTED] writes: I admit it is difficult to detect that this post is in-topic. But it is. Really, it's not. If you want a voice, you already have your website. Mailing lists and other discussion forums have conventions about topic for a good reason. of course. http://case.lazaridis.com/wiki/Host http://case.lazaridis.com/wiki/License http://case.lazaridis.com/wiki/Copyright I should have posted them immediately. No, you should have found a forum where you know that the topic is appropriate -- even if that restricts it to your own website. ??? my website is not a forum (and I'm currently reducing it to the minimum necessary information.) and once more: this topic _is_ appropriate for a python / ruby / java crosspost. really very important (if you don't look to much at the subject but the message contents). Well if you can't even be bothered to formulate a subject line that makes its signinficance immediately important you can hrdly be surprised at our failure to wade through reams of irrelevant drivel. If you have a dispute, go resolve it. But not here, please. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Package to handle table text render (handle space or tab between the columns) ?
On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, I would like print tabular values on terminal (stdout). Are there package to handle table text render ? Have a look at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662 -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to static members from inside a method decorator?
[EMAIL PROTECTED] wrote: Thanks for all the help guys ... in almost every way using a metaclass seems to be the right solution for what I'm trying to do here. I say almost because there is one thing that is still confusing me: what is the most elegant way to provide base-class implementations of methods that are expected to be overriden by some of the derived classes (or in the case of metaclasses, the classes that either declare __metaclass__ = Exposed or are derived from such classes). Here's what I've just knocked out: [snip example] The problem here is that the implementation of 'bar' inside Exposed.__init__ overrides the implementation of bar() in Process, which makes sense I guess seeing as Exposed.__init__() is called after the class has been initialised. It's not a problem for getExposedMethods() seeing as it's not overriden by any derived classes. So what is the accepted way of doing this? Do I need two Exposed classes, one is the metaclass that handles all the static mapping stuff, and another provides base implementations of methods and is what is actually derived from? E.g.: You define one base type with a custom metaclass and inherit from that. Your example then becomes: import sys class ExposedType( type ): def __init__( cls, *args, **kw ): # Track marked exposed methods cls.s_exposedMethods = [] for superclass in cls.__mro__: for name, meth in superclass.__dict__.items(): if hasattr( meth, exposed ): cls.s_exposedMethods.append( name ) class Exposed: __metaclass__ = ExposedType def getExposedMethods(self): return self.s_exposedMethods def bar(self): print bar\n @staticmethod def expose( f ): f.exposed = True return f class Process( Exposed): @Exposed.expose def foo( self ): pass def bar( self ): print BAR class BotProcess( Process ): @Exposed.expose def addBots( self ): pass p = Process() p.bar() This prints BAR as expected. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Metaprogramming question
Steve Menard wrote: I have a need to create class instance without invokking the class' __init__ method. Were I using old-style classes, I'd use new.instance() function. However, I am using new-style classes and new.instance() complain TypeError: instance() argument 1 must be classobj, not type ... So my question is, how to replicate new.instance() functionality with new classes? Use object.__new__. Georg -- http://mail.python.org/mailman/listinfo/python-list
Re: Package to handle table text render (handle space or tab between the columns) ?
hanumizzle a écrit : On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, I would like print tabular values on terminal (stdout). Are there package to handle table text render ? Have a look at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662 Thanks, this package is very useful ! But I'm suprised than this package isn't in python standard library ! Regards, Stephane -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Martin v. Löwis wrote: That, in principle, could happen to any other free software as well. What is critical here is that SF *hosted* the installation. If we would use a tracker that is free software, yet hosted it elsewhere, the same thing could happen: the hoster could make modifications to it which are non-free. Not even the GPL could protect from this case: the hoster would be required to publish source only if he publishes binaries, but he wouldn't publish any binaries, so he wouldn't need to release the source changes, either. Also, even if it the software is open source and unmodified, there still wouldn't be a guarantee that you can get the data out of it if you want to. You *only* get the advantages of free software if you also run it yourself. Unfortunately, there is a significant cost associated with running the software yourself. You have many good points here, Martin. Let me notice, though, that people providing hosting not necessarily want to maintain the software by themselves alone: some python developers could still have admin access to the boxes so to double check if weird things are being done behind the curtain. I think the point of uncertainty araises only if you totally trust someone else to do the job for you. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
[EMAIL PROTECTED] wrote: Martin The regular admin tasks likely include stuff like this: Martin - the system is unavailable, bring it back to work Martin This is really the worst case, and a short response time Martin is the major factor in how users perceive the service Martin - the system is responding very slowly To all those people who have been moaning about needing 6-10 people to administer the system, in my opinion these are the most important reasons to have more than one person available to help. Python isn't only used in the USofA. It has been very helpful to have administrators scattered around the globe who were awake and alert to handle problems with python.org when folks in the US were asleep. Of course, spreading the load among several people helps with the other tasks as well. As Martin pointed out in an earlier post, with only one person actively administering Subversion (Martin), new requests for access had to wait if he was away for an extended period of time. This is true of many open source projects. I don't dispute that having 6-10 people to administer Roundup would not be good. I dispute that it is the minimum requirement to make a Roundup installation acceptable for Python development. Are bug-tracker configuration issues so critical that having to wait 48-72hrs to have them fixed is absolutely unacceptable for Python development? It looks like an overexaggeration. People easily cope with 2-3 days of SVN freezing, when they are politically (rather than technically) stopped from committing to SVN. I guess they can wait 48 hrs to be able to close that bug, or open that other one, or run that query. -- Giovanni Bajo -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Giovanni Bajo [EMAIL PROTECTED] writes: Are bug-tracker configuration issues so critical that having to wait 48-72hrs to have them fixed is absolutely unacceptable for Python development? It looks like an overexaggeration. People easily cope with 2-3 days of SVN freezing, when they are politically (rather than technically) stopped from committing to SVN. I guess they can wait 48 hrs to be able to close that bug, or open that other one, or run that query. How often should a tracker freeze anyway? People with no technical knowledge at all run BBS systems that almost never freeze. Is a tracker somehow more failure-prone? It's just a special purpose BBS, I'd have thought. -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
Hi, The data is simple dictionary with one or more keys. If i use YAML at the client (webui) do i have to change serialisation method to YAML at server also. Without changing serialisation method at server, can i use any of the deserialisation methods at the client. We cannot change the serialisation methods at the server since it is not under our control. Thanks reagards virg hanumizzle wrote: On 5 Oct 2006 21:52:56 -0700, virg [EMAIL PROTECTED] wrote: Hi, i have client-server application which is written in python using XMLRPC protocol. The existing client is a command line. Now client application we are converting it as Web UI using java. I have seen some problems in writing a java client. At the server for each request from client, the server sends a response in hashtable and is serialized using pickle. The python function we call at the server is... What kind of data are we talking about? Is it strictly dictionary / list stuff or is it more complex (functions other objects)? I can see 2 possible options: Jython or YAML. (I have been answering a lot of questions re: serialization today and mentioned YAML in all of them :)) -- http://mail.python.org/mailman/listinfo/python-list
Re: Package to handle table text render (handle space or tab between the columns) ?
On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: hanumizzle a écrit : On 10/6/06, KLEIN Stéphane [EMAIL PROTECTED] wrote: Hi, I would like print tabular values on terminal (stdout). Are there package to handle table text render ? Have a look at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662 Thanks, this package is very useful ! But I'm suprised than this package isn't in python standard library ! The occurence of such a problem is relatively rare I would imagine. Rendering anything formatted to a character cell terminal is inherently limited, which is why I like lynx: it eliminates all the dumb formatting crap that people put on their websites, and even collapses multiple columns into a single stream of pages. Yay! See also reStructuredText for rendering plain text input to HTML and other formats (includes tables), sil vous plait. -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 6 Oct 2006 01:41:48 -0700, virg [EMAIL PROTECTED] wrote: Hi, The data is simple dictionary with one or more keys. If i use YAML at the client (webui) do i have to change serialisation method to YAML at server also. Without changing serialisation method at server, can i use any of the deserialisation methods at the client. We cannot change the serialisation methods at the server since it is not under our control. Oh, poopy. What do you have at the server end? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter newsgroup or mailing list
Franz Steinhaeusler [EMAIL PROTECTED] wrote: Hello NG, I'm asking this, (although I know a mailing list on gmane gmane.comp.python.tkinter and there is so little traffic compared to the mailing list of wxPython also mirrored on gmane gmane.comp.python.wxpython. I cannot imagine, that there is no more interest in exchanging opinions, or is this really the case? Is tkinter so simple, that no more questions appear? Or is it simply so uninteresting? :) -- Franz Steinhaeusler It is neither uninteresting, nor simple - see my very recent posts here... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Python/Tkinter crash.
Steve Holden [EMAIL PROTECTED] wrote: Hendrik van Rooyen wrote: Fredrik Lundh [EMAIL PROTECTED] wrote: Eric Brunel wrote: AFAIK, Tkinter is not thread safe. Using some kind of lock to serialize the calls from different threads may seem to work (I never tested it actually), but the safest way I found to use threads with Tkinter was to call it only from the thread where the main loop executes. the Tkinter binding contains some code that attempts to deal with re- entrant calls, but I don't know/remember to what extent it's actually supposed to work (in other words, if the observed problems are bugs or just limitations). (maybe Martin's memory is better?) anyway, I usually play it safe and make sure to use a single thread to deal with the UI. /F I must be dense - After I have called mainloop, if I have not started another thread to respond to events that are not generated by the user on the screen (in this case values of variables to display from the field generated by different processes - there is other hardware out there), how do I get control back to do the necessary updating? - I suppose I can use the call back after some time thingy to implement a polling loop - possibly as Russel Owen suggested - by polling a queue - but queues are for between threads - and I have seen here somewhere that sockets also want to be the main thread - so that leaves a pipe - and I have had bad experiences with pipes that are unblocked, and if I don't unblock it, then the gui will grind to a haltso I need a thread for the pipe between processes, and a queue between threads, and a time out based polling loop to read the queue, it seems - is it even safe to change a main loop variable from another thread? , or should I do it all via commands through a queue, implementing a whole goddam serial protocol just between threads? and If I don't have another thread to do the timing for the animation bits, then I must base that on a timed callback too, and somehow keep state between callbacks... now is it ok to call widget command methods from a callback in the same thread, or do I have to use invoke? My head is beginning to hurt... - what was a nice simple threaded implementation is turning into a spaghetti monster of timed callbacks - you thought gotos was bad? - you aint seen nothing yet... See if this helps: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 It's Jacob Hallen's description of how he solved the problem. regards Steve Thanks Steve - It is the same one Paul Rubin pointed me to and it describes nicely how to get the worker thread going, and the queue between it and the GUI thread. In my case, I will have a thread for input, as well as one for output to send commands away. The bit I was complaining about above is the replacement of a thread to do the animation timing with a stutter machine inside the gui thread, where the timing is handled by callbacks. A piece of feedback - the stutter machine animation timing is much smoother than the timing based on threaded sleep calls - less jittery - looks much better... So I am kind of glad the thing fell over because this implementation is going to be much better. Thank You All. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
Antoon Pardon wrote: Is this general rules documeted somewhere? My impression is that readers of the documentation will treat arguments as keyword arguments unless this is explicitly contradicted. Sorry, I missed that this was comp.lang.python.alternate.reality. My mistake. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
Fredrik Lundh wrote: MonkeeSage wrote: YAML is a little more complex a little? when did you last look at the spec? and a little more mature. than JavaScript's expression syntax? are you sure you're not confusing libraries with standards here? (has anyone even managed to write a YAML library that's small and simple enough to be obviously correct?) I have to agree that YAML, having started out with simplicity in mind, has become a monster that threatens to collapse under its own weight. The very existence of JSON is a good indicator that YAML has failed to meet its design goals for a significant proportion of application developers. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
At the server, based on client request it does some computations , it sends the result as dictionary (serialized) to the client. hanumizzle wrote: On 6 Oct 2006 01:41:48 -0700, virg [EMAIL PROTECTED] wrote: Hi, The data is simple dictionary with one or more keys. If i use YAML at the client (webui) do i have to change serialisation method to YAML at server also. Without changing serialisation method at server, can i use any of the deserialisation methods at the client. We cannot change the serialisation methods at the server since it is not under our control. Oh, poopy. What do you have at the server end? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 10/6/06, Steve Holden [EMAIL PROTECTED] wrote: I have to agree that YAML, having started out with simplicity in mind, has become a monster that threatens to collapse under its own weight. The very existence of JSON is a good indicator that YAML has failed to meet its design goals for a significant proportion of application developers. I am looking at JSON, but YAML does work fine for my purposes w/ no discernable disadvantages. Of course I didn't implement the library, so I can't really speak with any kind of expertise on this matter. I'm just saying that, at least at the front end, it's pretty simple to use. (JMO) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 6 Oct 2006 02:03:07 -0700, virg [EMAIL PROTECTED] wrote: At the server, based on client request it does some computations , it sends the result as dictionary (serialized) to the client. If I interpret your message correctly, you are receiving a Python dictionary object from the server. Yes? In this case, I guess it might be necessary to use Jython. I'm drawing a blank otherwise. (This may be naive, but can you write the client in Python as well?) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
groupby and itemgetter
Hello, there is an example how to use groupby in the itertools documentation (http://docs.python.org/lib/itertools-example.html): # Show a dictionary sorted and grouped by value from operator import itemgetter d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) di = sorted(d.iteritems(), key=itemgetter(1)) for k, g in groupby(di, key=itemgetter(1)): ... print k, map(itemgetter(0), g) ... 1 ['a', 'c', 'e'] 2 ['b', 'd', 'f'] 3 ['g'] Now i wonder why itemgetter is used in this example. More straightforward is: d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) di = sorted(d.iterkeys(), key=d.get) for k, g in groupby(di, key=d.get): ... print k, list(g) ... 1 ['a', 'c', 'e'] 2 ['b', 'd', 'f'] 3 ['g'] This code does not need the operator module, and its also faster (tested using timeit). Why was the, imho, more complicated version used as example in the documentation? Regards, Roman -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do this?
Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Thu, 5 Oct 2006 11:28:08 +0100, Matthew Warren [EMAIL PROTECTED] declaimed the following in comp.lang.python: Now, I started programming when I was 8 with BBC Basic. Remember what the acronym BASIC stands for? 8--- yes - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I read Excel file in Python?
On 5 Oct 2006 12:49:53 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Actually was about to post same solution and got same results. (BTW Simon, the OP date is Aug 9th, 2006). Scratched head and googled for excel date calculations... found this bug where it treats 1900 as leap year incorrectly: http://www.ozgrid.com/Excel/ExcelDateandTimes.htm Ah - I was reading the OP's 8/9/2006 in the European way - DD/MM/. One might argue over whether DD/MM/ or MM/DD/ are more rational, but I find it best to avoid *both* those formats, 'cos they are so easily confused. -- Cheers, Simon B [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list
Re: printing variables
On 2006-10-06 04:50:33 +0200, [EMAIL PROTECTED] wrote: say i have variables like these var1 = blah var2 = blahblah var3 = blahblahblah var4 = var5 = . bcos all the variable names start with var, is there a way to conveniently print those variables out... eg print var* ?? i don't want to do : print var1, var2, var3, var4 ..etc... Don't do this: import fnmatch var1, var2, var3 = foo, bar, baz for k in fnmatch.filter(locals(), var*): ... print locals()[k] ... foo baz bar This is evil. It's unpythonic. This is yet another way to do it - QED. Gerrit. -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
On 2006-10-06, Fredrik Lundh [EMAIL PROTECTED] wrote: Antoon Pardon wrote: Is this general rules documeted somewhere? My impression is that readers of the documentation will treat arguments as keyword arguments unless this is explicitly contradicted. Sorry, I missed that this was comp.lang.python.alternate.reality. My mistake. A personal attack won't make my argument go away. It also doesn't answer my question. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
Yes your are right. I will send a dictionary object from the server to the client. I already have client which is written in python. But we are migrating the python client which is a command line tool to Web UI client (java). If it is possible to call python function from java, i need to read more about jython, i am new to this. hanumizzle wrote: On 6 Oct 2006 02:03:07 -0700, virg [EMAIL PROTECTED] wrote: At the server, based on client request it does some computations , it sends the result as dictionary (serialized) to the client. If I interpret your message correctly, you are receiving a Python dictionary object from the server. Yes? In this case, I guess it might be necessary to use Jython. I'm drawing a blank otherwise. (This may be naive, but can you write the client in Python as well?) -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do this?
Nobody's mentioned the ability to save a formatted string and then substitute the variables later... string = There are %s ways to skin a %s print string % (3, furry animal) print string % (166, beast) ~half.italian Matthew Warren wrote: Ok, not really python focused, but it feels like the people here could explain it for me :) Now, I started programming when I was 8 with BBC Basic. I never took any formal classes however, and I have never become an expert programmer. I'm an average/hobbyist programmer with quite a few languages under my belt but I cant do any really fancy tricks with any of them. (although Python might be nudging me into more advanced things, now I'm starting to get what all the __method__ thingies and operators are all about) I learned over the years to do things like the following, and I like doing it like this because of readability, something Python seems to focus on :- Print There are +number+ ways to skin a +furryanimal But nowadays, I see things like this all over the place; print(There are %s ways to skin a %s % (number, furryanimal)) Now I understand there can be additional formatting benefits when dealing with numbers, decimal places etc.. But to me, for strings, the second case is much harder to read than the first. I hope I'm not being dense. The result is that I have pathalogically avoided print %s % (thing) because it seems to just over complicate things. Ta, :) Matt. This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email. UK: Phoenix House, Colliers Way, Nottingham, NG8 6AT UK Reception Tel: + 44 (0) 115 977 1177 Support Centre: 0845 607 7070 Fax: + 44 (0) 115 977 7000 http://www.digica.com SOUTH AFRICA: Building 3, Parc du Cap, Mispel Road, Bellville, 7535, South Africa Tel: + 27 (0) 21 957 4900 Fax: + 27 (0) 21 948 3135 http://www.digica.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Request for recommendations: shared database without a server
EP wrote: [Client-only application with shared storage and concurrent access] Can I get there with MySQL? Or do I need to pair a pure python approach (including the database) with py2exe? Has anyone achieved this with a db framework like Dabo? Or is there another, entirely different and better approach? One of the features of SQLite version 3 is supposedly the possibility of having multiple processes safely access an SQLite database: http://www.sqlite.org/faq.html#q7 Unfortunately, networked storage may not be supported to any level acceptable for your application. Paul -- http://mail.python.org/mailman/listinfo/python-list
extract certain values from file with re
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different log files. The first file looks like: ... 'some text' ... ITER I- GLOBAL ABSOLUTE RESIDUAL -I I FIELD VALUES AT MONITORING LOCATION --I NOUMOM VMOM WMOM MASS T EN DISS ENTH UVWP TE EDT 1 9.70E-02 8.61E-02 9.85E-02 1.00E+00 1.61E+01 7.65E+04 0.00E+00 1.04E-01-8.61E-04 3.49E-02 1.38E-03 7.51E-05 1.63E-05 2.00E+01 2 3.71E-02 3.07E-02 3.57E-02 1.00E+00 3.58E-01 6.55E-01 0.00E+00 1.08E-01-1.96E-03 4.98E-02 7.11E-04 1.70E-04 4.52E-05 2.00E+01 3 2.64E-02 1.99E-02 2.40E-02 1.00E+00 1.85E-01 3.75E-01 0.00E+00 1.17E-01-3.27E-03 6.07E-02 4.02E-04 4.15E-04 1.38E-04 2.00E+01 4 2.18E-02 1.52E-02 1.92E-02 1.00E+00 1.21E-01 2.53E-01 0.00E+00 1.23E-01-4.85E-03 6.77E-02 1.96E-05 9.01E-04 3.88E-04 2.00E+01 5 1.91E-02 1.27E-02 1.70E-02 1.00E+00 8.99E-02 1.82E-01 0.00E+00 1.42E-01-6.61E-03 7.65E-02 1.78E-04 1.70E-03 9.36E-04 2.00E+01 ... ... ... 2997 3.77E-04 2.89E-04 3.05E-04 2.71E-02 5.66E-04 6.28E-04 0.00E+00 -3.02E-01 3.56E-02-7.97E-02-7.11E-02 4.08E-02 1.86E-01 2.00E+01 2998 3.77E-04 2.89E-04 3.05E-04 2.71E-02 5.65E-04 6.26E-04 0.00E+00 -3.02E-01 3.63E-02-8.01E-02-7.10E-02 4.02E-02 1.83E-01 2.00E+01 2999 3.76E-04 2.89E-04 3.05E-04 2.70E-02 5.64E-04 6.26E-04 0.00E+00 -3.02E-01 3.69E-02-8.04E-02-7.10E-02 3.96E-02 1.81E-01 2.00E+01 3000 3.78E-04 2.91E-04 3.07E-04 2.74E-02 5.64E-04 6.26E-04 0.00E+00 -3.01E-01 3.75E-02-8.07E-02-7.09E-02 3.91E-02 1.78E-01 2.00E+01 -- 'some text' I actually want to extract the lines with the numbers, write them to a file and finally use gnuplot for plotting them. A nicer and more python way would be to extract those numbers, write them into an array according to their column and plot those using the gnuplot or matplotlib module :-) Unfortunately, I am pretty new to the re module and tried the following so far: import re pat = re.compile('\ \ \ NO.*?', re.DOTALL) print re.sub(pat, '', open('log_star_orig').read()) but this works just the other way around, which means that the original log file is printed without the number part. So the next step would be to delete the part from the first line to '\ \ \ \ NO' and the part from '' to the end, but I do not know how to address the first and last line!? Would be nice, if you can give me a hint and especially interesting would it be, when you have an idea, how I can put those columns in arrays, so I can plot them right away! A more difficult log file looks like: == OUTER LOOP ITERATION =1 CPU SECONDS = 2.40E+01 -- | Equation | Rate | RMS Res | Max Res | Linear Solution | +--+--+-+-+--+ | U-Mom| 0.00 | 1.0E-02 | 5.0E-01 | 4.9E-03 OK| | V-Mom| 0.00 | 2.4E-14 | 5.6E-13 | 3.8E+09 ok| | W-Mom| 0.00 | 2.5E-14 | 8.2E-13 | 8.3E+09 ok| | P-Mass | 0.00 | 1.1E-02 | 3.4E-01 | 8.9 2.7E-02 OK| +--+--+-+-+--+ | K-TurbKE | 0.00 | 1.8E+00 | 1.8E+00 | 5.8 2.2E-08 OK| | E-Diss.K | 0.00 | 1.9E+00 | 2.0E+00 | 12.4 2.2E-08 OK| +--+--+-+-+--+ == OUTER LOOP ITERATION =2 CPU SECONDS = 8.57E+01 -- | Equation | Rate | RMS Res | Max Res | Linear Solution | +--+--+-+-+--+ | U-Mom| 1.44 | 1.5E-02 | 5.3E-01 | 9.6E-03 OK| | V-Mom|99.99 | 1.1E-03 | 6.2E-02 | 5.7E-02 OK| | W-Mom|99.99 | 1.9E-03 | 6.0E-02 | 5.9E-02 OK| | P-Mass | 0.27 | 3.0E-03 | 2.0E-01 | 8.9 7.9E-02 OK| +--+--+-+-+--+ | K-TurbKE | 0.03 | 5.4E-02 | 4.4E-01 | 5.8 2.9E-08 OK| | E-Diss.K | 0.05 | 8.9E-02 | 9.3E-01 | 12.4 2.6E-08 OK| +--+--+-+-+--+ ... ... ... == OUTER LOOP ITERATION = 416 CPU SECONDS = 2.28E+04
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
No, you should have found a forum where you know that the topic is appropriate -- even if that restricts it to your own website. ??? my website is not a forum (and I'm currently reducing it to the minimum necessary information.) You obviously lack the skill to comprehend that a forum isn't meant to be a web-forum, but more generally a place where you can express your opinions. Which is your website by all means. So, go, restrict yourself and voice your private opinions there. Not here. and once more: this topic _is_ appropriate for a python / ruby / java crosspost. Why should a private quabble over some neglectable open source contributions be of any interest to a community, let alone even three of them? really very important (if you don't look to much at the subject but the message contents). All that I have seen were some accusations + a few ridiculously small subversion entries that showed default parameters changed and the like. This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
On 6 Oct 2006 09:21:11 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2006-10-06, Fredrik Lundh [EMAIL PROTECTED] wrote: Antoon Pardon wrote: Is this general rules documeted somewhere? My impression is that readers of the documentation will treat arguments as keyword arguments unless this is explicitly contradicted. Sorry, I missed that this was comp.lang.python.alternate.reality. My mistake. A personal attack won't make my argument go away. It also doesn't answer my question. Not sure exactly what is going on / being argued about in this thread but HTH :? http://docs.python.org/tut/node6.html This doesn't say anything positive or negative about the practice in question, but does point out that it is possible. I think it is a reasonable assumption that if it isn't necessary, most users will elide the keywords. -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: printing variables
On 10/6/06, Gerrit Holl [EMAIL PROTECTED] wrote: import fnmatch var1, var2, var3 = foo, bar, baz for k in fnmatch.filter(locals(), var*): ... print locals()[k] ... foo baz bar This is evil. It's unpythonic. It's so evil, Perl 4 would look upon it in scorn. -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: Subclassing built-in classes
Le jeudi 05 octobre 2006 20:24, Steve Holden a écrit : class mystr(oldstr): ... def __new__(*a, **kw): ... print called:, a, kw ... you don't return the string here... import __builtin__ __builtin__.str = mystr Readline internal error Traceback (most recent call last): File C:\Python24\lib\site-packages\readline\Console.py, line 644, in hook_wrapper_23 raise TypeError, 'readline must return a string.' ...It should explain this error. So, what are you trying to say? The type of the literal strings is clearly just what it always was. Where, when and how exactly does this magical monkey patch affect literals? ooops, maybe we aren't on the same plan. As the first post said ...couldn't python (in theory)..., I was discussing if it would be possible for python (in some future version) to manage the literals so that they use the constructors in the __builtin__ module, I didn't say it works actually (I'm aware it's not the case). -- _ Maric Michaud _ Aristote - www.aristote.info 3 place des tapis 69004 Lyon Tel: +33 426 880 097 -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do this?
On Thu, Oct 05, 2006 at 10:48:36AM +, Duncan Booth wrote: The other main reason for preferring format strings is that they make it easier to refactor the code. If you ever want to move the message away from where the formatting is done then it's a lot easier to extract a single string than it is to clean up the concatenation. This is a good point imho. I often do things like this: sql = a_complex_select_sql % (id_foo, value_bar, ...) cursor.execute(sql) inside the body of a function (or a class method), where a_complex_select_sql is a string, containing several %s, %d ecc., that is defined globally (or somewhere else in the class). c. -- Thought is only a flash between two long nights, but this flash is everything. (H. Poincaré) -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
On 6 Oct 2006 02:29:59 -0700, virg [EMAIL PROTECTED] wrote: Yes your are right. I will send a dictionary object from the server to the client. I already have client which is written in python. But we are migrating the python client which is a command line tool to Web UI client (java). Please explain 'Web UI'. Can Python perform an equivalent function? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Using twisted, not telnetlib for interactive telnet (WAS: RE: Improving telnetlib)
The trouble is, I havent got a clue where to start and would appreciate a couple of pointers to get me going... I'd suggest taking a look at Twisted, which contains a more complete telnet implementation (not as important for being able to launch vi), an ssh implementation (which you might want to use instead of telnet), a VT102 implementation (which is actually what will help you run programs that want to fiddle around with the cursor in fancy ways), as well as a fair amount of work towards a simple terminal emulator (to help you keep track of what vi has done to your virtual terminal). API docs for insults: http://twistedmatrix.com/documents/current/api/twisted.conch.i nsults.html And for the telnet implementation: http://twistedmatrix.com/documents/current/api/twisted.conch.t elnet.html Looking through those docs quickly leads me into quite a bewildering maze. As a kind of way to perhaps get me heading in the right direction and understanding how I start to hang all that together to get what I want, I would appreciate it if anyone could look at this little code snippet I have, and illustrate how I can end up doing the same thing with twisted, but end up with an interactive connection that can handle vi... From there I will happily trundle off by myself. I think I'm looking for help in getting that AhA! moment :) Snippet; C=telnetlib.Telnet(self.TCPAddress) . . ((connection / password handling etc..)) . . if AliasedSubbedCmd=='__interact': if system=='UNIX': retkey='^D' else: retkey='^Z' print '\nTELNET entity '+self.Name+' entering interactive mode. Use '+retkey+' to come back\n' C.mt_interact() ...at this point I am essentially on the remote system command line, with a very dumb terminal. How could I do this in twisted and end up with a fairly clever terminal? Thanks, Matt. This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email. UK: Phoenix House, Colliers Way, Nottingham, NG8 6AT UK Reception Tel: + 44 (0) 115 977 1177 Support Centre: 0845 607 7070 Fax: + 44 (0) 115 977 7000 http://www.digica.com SOUTH AFRICA: Building 3, Parc du Cap, Mispel Road, Bellville, 7535, South Africa Tel: + 27 (0) 21 957 4900 Fax: + 27 (0) 21 948 3135 http://www.digica.com -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
Diez B. Roggisch wrote: [...] really very important (if you don't look to much at the subject but the message contents). All that I have seen were some accusations + a few ridiculously small subversion entries that showed default parameters changed and the like. This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. I have to say I find the colour of your socks *much* more interesting. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Ian Bicking wrote: It handles some other kinds of repositories now (bzr, I think?). From what I understand fully abstracting out the repository format seems to still be a work in progress, but it is in progress and you can write repository plugins right now. That covers Trac, but other projects probably need to get up to speed with providing similar functionality, too. This is another case where people should work together rather than developing an interoperability layer specific to their own project. Certainly, the Bazaar APIs looked like some kind of promising umbrella project for that kind of thing. Trac now includes a WSGI backend, and someone has written a WSGI backend for ViewVC (though I don't know if it is included with the project). Clearly you need to get on the WSGI bandwagon ;) Hey, WebStack supports WSGI, too, you know. ;-) Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
Diez B. Roggisch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. I did find Andy's claim that he expected contributors to sing a copyright transfer agreement somewhat unreasonable. It would depend on the tune though, I guess. -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do this?
Corrado Gioannini [EMAIL PROTECTED] wrote: I often do things like this: sql = a_complex_select_sql % (id_foo, value_bar, ...) cursor.execute(sql) inside the body of a function (or a class method), where a_complex_select_sql is a string, containing several %s, %d ecc., that is defined globally (or somewhere else in the class). I hope you have a good reason why you don't do: cursor.execute(a_complex_select_sql, (id_foo, value_bar, ...)) instead. -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
On 10/6/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. Where did you get these? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
hanumizzle wrote: Not sure exactly what is going on / being argued about in this thread I'm describing best practices based on long experience of using and developing and teaching and writing about Python stuff. Others have other priorities, it seems. This doesn't say anything positive or negative about the practice in question The tutorial tends to describe mechanisms, not best practices, and it also assumes prior programming experience. After all, basic stuff like minimize coupling and don't depend on implementation artifacts apply to all software engineering, not just Python. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
Steve Holden wrote: I have to say I find the colour of your socks *much* more interesting. Especially what with the skulls and all. -- Erik Max Francis [EMAIL PROTECTED] http://www.alcyone.com/max/ San Jose, CA, USA 37 20 N 121 53 W AIM, Y!M erikmaxfrancis Can I lay with you / As your wife -- India Arie -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
Diez B. Roggisch wrote: This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. are they perhaps red or green? and look something like the skulls on this: http://www.rusta.se/images/products/31101067_l.jpg /F -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
On 2006-10-06, hanumizzle [EMAIL PROTECTED] wrote: On 6 Oct 2006 09:21:11 GMT, Antoon Pardon [EMAIL PROTECTED] wrote: On 2006-10-06, Fredrik Lundh [EMAIL PROTECTED] wrote: Antoon Pardon wrote: Is this general rules documeted somewhere? My impression is that readers of the documentation will treat arguments as keyword arguments unless this is explicitly contradicted. Sorry, I missed that this was comp.lang.python.alternate.reality. My mistake. A personal attack won't make my argument go away. It also doesn't answer my question. Not sure exactly what is going on / being argued about in this thread but HTH :? http://docs.python.org/tut/node6.html This doesn't say anything positive or negative about the practice in question, but does point out that it is possible. I think it is a reasonable assumption that if it isn't necessary, most users will elide the keywords. What I am argueing is that it is very natural for python programmers to assume that keyword arguments will work if they see a signature. IMO if a python programmer sees something like: abs(x) It is very natural to envision a corresponding def statement like: def abs(x): and a python function written like this will work if called as follows: abs(x=5) IMO this is a very natural thought process for a python programmer. So a python programmer seeing the first will tend to expect that last call to work. Now frederic claims that the general rule is different. Now I'm perfectly happy to accept that those who write the documentation do so based aacording to the rule frederic stated (you can't/shouldn't use a parameter as a keyword argument unless explictly stated in the documentation), but that doesn't contradict that readers may have different expectations. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I read Excel file in Python?
John Machin wrote: [EMAIL PROTECTED] wrote: excel_date = 38938.0 python_date = datetime.date(1900, 1, 1) + datetime.timedelta(days=excel_date) python_date datetime.date(2006, 8, 11) Err, that's the wrong answer, isn't it? Perhaps it shoud be datetime.date(1900, 1, 29)? Actually was about to post same solution and got same results. (BTW Simon, the OP date is Aug 9th, 2006). Scratched head and googled for excel date calculations... found this bug where it treats 1900 as leap year incorrectly: http://www.ozgrid.com/Excel/ExcelDateandTimes.htm Plus it treats 1 jan 1900 as day 1, not 0 so just subtract 2 in the calc: python_date = datetime.date(1900, 1, 1) + datetime.timedelta(days=excel_date - 2) python_date datetime.date(2006, 8, 9) ... and 2006-08-09 is only the correct answer if the spreadsheet was, when last saved, using the 1900 (Windows) date system, not the 1904 (Macintosh) date system. John, Just for me own curiosity, is this Excel concept of date numbers same as the OLE concept (see http://msdn2.microsoft.com/en-us/library/82ab7w69.aspx or search MFC DATE on MSDN). I put in some test cases for conversion code here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496683 But would be interested to add any additional info on variations on this theme. Cheers, Giles -- http://mail.python.org/mailman/listinfo/python-list
Re: Automatic import PEP
In message [EMAIL PROTECTED], Robert Kern wrote: Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Connelly Barnes wrote: The main point of autoimp is to make usage of the interactive Python prompt more productive by including from autoimp import * in the PYTHONSTARTUP file. The main problem I have with your idea is that any kind of import statement with wildcards in it automatically starts my bogosity meter flashing its RED ALERT sign and clanging all its alarm bells. from ... import * was *designed* for interactive use, which is exactly what Connelly is suggesting. It's not a bad thing in that context. But there is nothing in the language that constrains its use to that context, is there? Clang, clang... -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
On 2006-10-06, Fredrik Lundh [EMAIL PROTECTED] wrote: hanumizzle wrote: Not sure exactly what is going on / being argued about in this thread I'm describing best practices based on long experience of using and developing and teaching and writing about Python stuff. Others have other priorities, it seems. I just think you shouldn't assume the readers of the documentation are aware of best practices. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Makin search on the other site and getting data and writing in xml
In message [EMAIL PROTECTED], Paul Boddie wrote: Various sites forbid wget and friends as a rule, understandably ... No, that is not understandable. -- http://mail.python.org/mailman/listinfo/python-list
Re: Recursive descent algorithm able to parse Python?
In message [EMAIL PROTECTED], Diez B. Roggisch wrote: I have to admit that I have difficulties to compare LR(k) to recursive descent, but the fact that the latter contains backtracking makes it at least more powerful than LL(k) LR(k) is more powerful than LL(k). -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I read Excel file in Python?
John Machin wrote: [EMAIL PROTECTED] wrote: excel_date = 38938.0 python_date = datetime.date(1900, 1, 1) + datetime.timedelta(days=excel_date) python_date datetime.date(2006, 8, 11) Err, that's the wrong answer, isn't it? Perhaps it shoud be datetime.date(1900, 1, 29)? Actually was about to post same solution and got same results. (BTW Simon, the OP date is Aug 9th, 2006). Scratched head and googled for excel date calculations... found this bug where it treats 1900 as leap year incorrectly: http://www.ozgrid.com/Excel/ExcelDateandTimes.htm Plus it treats 1 jan 1900 as day 1, not 0 so just subtract 2 in the calc: python_date = datetime.date(1900, 1, 1) + datetime.timedelta(days=excel_date - 2) python_date datetime.date(2006, 8, 9) ... and 2006-08-09 is only the correct answer if the spreadsheet was, when last saved, using the 1900 (Windows) date system, not the 1904 (Macintosh) date system. All the OP needs to do is to read the documentation that comes with the xlrd package. It describes the problems with Excel dates, and offers functions for conversion between the Excel date numbers and (year, month, day, hour, minute, second) tuples which of course are interoperable with Python's datetime module and with mx.DateTime. | import xlrd | xlrd.xldate_as_tuple(38938.0, 0) | (2006, 8, 9, 0, 0, 0) | xlrd.xldate_as_tuple(38938.0, 1) | (2010, 8, 10, 0, 0, 0) | Cheers, John Hi, import xlrd book = xlrd.open_workbook(testbook1.xls) sh = book.sheet_by_index(0) sh.cell_value(rowx=1,colx=0) 38938.0 type(sh.cell_value(rowx=1,colx=0)) type 'unicode' xlrd.xldate_as_tuple( sh.cell_value( rowx = 1,colx= 0 ), 0 ) Traceback (most recent call last): File D:\Python23\Testing area\Python and Excel\xlrdRead.py, line 30, in ? temp=xlrd.xldate_as_tuple(sh.cell_value(rowx=r,colx=c),0) File D:\PYTHON23\Lib\site-packages\xlrd\xldate.py, line 61, in xldate_as_tuple xldays = int(xldate) ValueError: invalid literal for int(): Date because xlrd.xldate_as_tuple() function expects first argument to be an integer. How do I convert an unicode character to integer, so that I could get the date using xlrd.xldate_as_tuple() function. Thank you, sudhir. -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
Antoon Pardon wrote: IMO this is a very natural thought process for a python programmer. So a python programmer seeing the first will tend to expect that last call to work. on the other hand, if a Python programmer *writes* some code instead; say, a trivial function like: def calculate(a, b): # approximate; gonna have to fix this later return a + b * 1.2 chances are that he did *not* intend this to be called as calculate(a=1, b=2) or, for that matter, calculate(b=2, a=1) or calculate(1, b=2) just because the Python calling machinery currently happens to allow that. And chances are that he did *not* expect to be stuck with those argument names for the foreseeable future, just because someone else decided to interpret things in the most literal way they possibly could. Python 2.X doesn't provide convenient support for distinguishing between accidental and intentional argument names when you implement a function; that's a wart, not a feature, and it may be addressed in 3.X. /F -- http://mail.python.org/mailman/listinfo/python-list
RE: OT Request
This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. It is the responsibility of the recipient to check this email for the presence of viruses. Digica accepts no liability for any damage caused by any virus transmitted by this email. Pardon, but is there any possibility you can disable this rather long block? I'm presuming you are accessing via the mailing list, but hat mailing list is gatewayed to a Usenet news group (and unless you've anaged to embed an X-noarchive header in email, Google Groups is going o have the message available in perpetuity). There is no single intended recipient -- the messages are being sent to anyone in the orld interested in reading comp.lang.python, so all this overhead is eaningless. No problem, and thanks for pointing it out. It gets silently added on its way through, and i just hadnt noticed it in my posts. Posting this time through google groups :) -- http://mail.python.org/mailman/listinfo/python-list
Re: OT Request
Matthew Warren wrote: No problem, and thanks for pointing it out. It gets silently added on its way through, and i just hadnt noticed it in my posts. oh, no need to apologize. and it did make a certain sense in some of your posts: Okok, I'm silly. This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. -- http://mail.python.org/mailman/listinfo/python-list
how to convert UNICODE to integer in Python?
Hi, import xlrd book = xlrd.open_workbook(testbook1.xls) sh = book.sheet_by_index(0) sh.cell_value(rowx=1,colx=0) 38938.0 type(sh.cell_value(rowx=1,colx=0)) type 'unicode' xlrd.xldate_as_tuple( sh.cell_value( rowx = 1,colx= 0 ), 0 ) Traceback (most recent call last): File D:\Python23\Testing area\Python and Excel\xlrdRead.py, line 30, in ? temp=xlrd.xldate_as_tuple(sh.cell_value(rowx=r,colx=c),0) File D:\PYTHON23\Lib\site-packages\xlrd\xldate.py, line 61, in xldate_as_tuple xldays = int(xldate) ValueError: invalid literal for int(): Date because xlrd.xldate_as_tuple() function expects first argument to be an integer. How do I convert an unicode character to integer, so that I could get the date using xlrd.xldate_as_tuple() function. Thank you, kath. -- http://mail.python.org/mailman/listinfo/python-list
Re: OT Request
Funniest bit of my day so far :) Fredrik Lundh wrote: Matthew Warren wrote: No problem, and thanks for pointing it out. It gets silently added on its way through, and i just hadnt noticed it in my posts. oh, no need to apologize. and it did make a certain sense in some of your posts: Okok, I'm silly. This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete the email from your computer. You should not copy the email, use it for any purpose or disclose its contents to any other person. Please note that any views or opinions presented in this email may be personal to the author and do not necessarily represent the views or opinions of Digica. -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
hanumizzle schrieb: On 10/6/06, Diez B. Roggisch [EMAIL PROTECTED] wrote: This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. Where did you get these? You can buy them at HM, but unfortunately they aren't always in stock. But little skulls on thingies the have quite often - I don't wanna get into the details of my underwear :P Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: how to convert UNICODE to integer in Python?
kath wrote: xldays = int(xldate) ValueError: invalid literal for int(): Date because xlrd.xldate_as_tuple() function expects first argument to be an integer. How do I convert an unicode character to integer, so that I could get the date using xlrd.xldate_as_tuple() function. the error doesn't say anything about Unicode characters, it says that someone's passing the string Date to the int() function. int(Date) Traceback (most recent call last): File stdin, line 1, in ? ValueError: invalid literal for int(): Date /F -- http://mail.python.org/mailman/listinfo/python-list
Re: What value should be passed to make a function use the default argument value?
On 2006-10-06, Fredrik Lundh [EMAIL PROTECTED] wrote: Antoon Pardon wrote: IMO this is a very natural thought process for a python programmer. So a python programmer seeing the first will tend to expect that last call to work. on the other hand, if a Python programmer *writes* some code instead; say, a trivial function like: def calculate(a, b): # approximate; gonna have to fix this later return a + b * 1.2 chances are that he did *not* intend this to be called as calculate(a=1, b=2) or, for that matter, calculate(b=2, a=1) or calculate(1, b=2) Well maybe he didn't intend that, but how is the reader of the documentation to know that? The reader can only go by how things are documented. If those are not entirely consistent with the intend of the programmer, that is not the readers fault. just because the Python calling machinery currently happens to allow that. And chances are that he did *not* expect to be stuck with those argument names for the foreseeable future, just because someone else decided to interpret things in the most literal way they possibly could. And how it the reader of the documentation to know about the expectations of the programmer? It isn't the readers fault if those expectations aren't easily inferred from the documenation. Python 2.X doesn't provide convenient support for distinguishing between accidental and intentional argument names when you implement a function; that's a wart, not a feature, and it may be addressed in 3.X. Again that is not the fault of those that read the documentation. If this discinction can't be easily made in python 2.X, you can't fault the reader for coming to a conclusion that seems to follow rather naturally from how python currently works. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Paul Rubin schrieb: How often should a tracker freeze anyway? People with no technical knowledge at all run BBS systems that almost never freeze. Is a tracker somehow more failure-prone? It's just a special purpose BBS, I'd have thought. For whatever reason, the SF bug tracker is often down, or not responding. I'm uncertain why that is, but it's a matter of fact that this was one of the driving forces in moving away from SF (so it is a real problem). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do this?
On Fri, Oct 06, 2006 at 10:09:14AM +, Duncan Booth wrote: I hope you have a good reason why you don't do: cursor.execute(a_complex_select_sql, (id_foo, value_bar, ...)) instead. hehe. i was just trying to be didactic, simplifying the actual situation. (anyway, sometimes i had to print, or store, the sql statement, or to execute the same sql statement on different databases etc. etc..) regards, c. -- no, sono sempre io, non mi cambierete quel che ho dentro forse ho solo un'altra faccia ho più cicatrici di prima, sorrido un po' meno, forse penso di più. (Kina) -- http://mail.python.org/mailman/listinfo/python-list
Skullsocks to the rescue - was [irrelevant squabble of IL]
Fredrik Lundh schrieb: Diez B. Roggisch wrote: This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. are they perhaps red or green? and look something like the skulls on this: Due to the unexpected interest in my foot-garments, I here present an image of my current collection of skullsocks(tm) http://www.roggisch.de/img/skullsocks.jpg They can be bought at our friendly swedish clothes retailer, HM. Have a nice day :) Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: help on pickle tool
Hi, Yes, using python client we are able deserialize data using r = pickle.loads(result). where result is a response from the server and r is a dictionary after deserialization. For serialisation at the server written in python using pickle.dumps(result, 2) Now we are developing web based Client using java. So we are writing client in java. If server and client are in python we dont see any problems since we are using same serialisation tool pickle. Now we have seen problems because we are writing client in java. we did not find equivalent function on java for this tool pickle. If i use standard java desrialisation functions i am getting error as invalid header becasue of incompatibility between python and java. Please help me if you have any clue regards, - Virg hanumizzle wrote: On 6 Oct 2006 02:29:59 -0700, virg [EMAIL PROTECTED] wrote: Yes your are right. I will send a dictionary object from the server to the client. I already have client which is written in python. But we are migrating the python client which is a command line tool to Web UI client (java). Please explain 'Web UI'. Can Python perform an equivalent function? -- Theerasak -- http://mail.python.org/mailman/listinfo/python-list
Copying file descriptors
I am using the following code. It is used to spawn a new process (using popen) and to change the file handles so that subsequent writes to standard output with printf goes into this child process standard input. import os child_stdin = os.popen(cat -, w) old_stdout = os.dup(1) os.close(child_stdin.fileno()) print foo os.dup2(old_stdout, 1) os.close(old_stdout) It works. But the results is: close failed: [Errno 9] Bad file descriptor when I am using python 2.4. Note that python 2.3 did not output such an error. I am guessing that upon ending the script, python tries to close child_stdin file object, whereas the underlying file descriptor has already been closed. Thus the error. Does anyone knows what to do to avoir this error message? Thanks Didier -- http://mail.python.org/mailman/listinfo/python-list
Re: how to convert UNICODE to integer in Python?
Fredrik Lundh wrote: kath wrote: xldays = int(xldate) ValueError: invalid literal for int(): Date because xlrd.xldate_as_tuple() function expects first argument to be an integer. How do I convert an unicode character to integer, so that I could get the date using xlrd.xldate_as_tuple() function. the error doesn't say anything about Unicode characters, it says that someone's passing the string Date to the int() function. int(Date) Traceback (most recent call last): File stdin, line 1, in ? ValueError: invalid literal for int(): Date /F Hi, Thanks for reminding me. I was wrong. Regards, kath -- http://mail.python.org/mailman/listinfo/python-list
Re: HOST - Assembla Inc. Breakout - Copyright Violation by Mr. Andy Singleton
Richard Brodie schrieb: Diez B. Roggisch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This is on the same level of interest to the communities of python, ruby java as the color of my socks this morning - a deep black with cute little skulls imprinted. I did find Andy's claim that he expected contributors to sing a copyright transfer agreement somewhat unreasonable. It would depend on the tune though, I guess. There are lots of people out there how require such things, and it might even be for malicious reasons sometimes - not that I'm aware of that in the current case, mind you! There are plenty of good reasons to do so as well. The point here is: nobody is forced to sign such agreement, breakout is not an effort that has any importance for the python, let alone all three communities, and this is a totally private matter between two people. Maybe fellow co-developers are interested, but then there should be an email list. And as Illias has a history of postings that claim others post containing irrelevant stuff - either to him, or in general - he is on very thin ice here. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Martin v. Löwis wrote: For whatever reason, the SF bug tracker is often down, or not responding. I'm uncertain why that is, but it's a matter of fact that this was one of the driving forces in moving away from SF (so it is a real problem). As I asked before, did anyone look into asking large-scale users of the various considered products about their experiences with regard to reliability, scalability, and so on? Obviously, SourceForge is a special case since it's a closed service with a code base divergent from the last open source release (and possibly from commercial deployments of the code), whereas the other contenders except for Launchpad, along with non-considered but widely-deployed products, presumably contribute to a certain amount of public experience that can be drawn upon. Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Skullsocks to the rescue - was [irrelevant squabble of IL]
Diez B. Roggisch wrote: Due to the unexpected interest in my foot-garments, I here present an image of my current collection of skullsocks(tm) http://www.roggisch.de/img/skullsocks.jpg ah, pretty close, and the green color is absolutely the right one, but my socks has the skulls drawn on top of the crossbones. (no, I'm not going to fetch a camera. not right now, at least. and no, I haven't gotten around to buy a matching power drill, either. but it's tempting...) They can be bought at our friendly swedish clothes retailer, HM. all Python programmers should have at least pair, I think. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: [Linux] Detect a key press
Jia,Lu [EMAIL PROTECTED] writes: Hi all I write a program to detect key press,but , why there is a *space* before the character I typed.?? There is none. The output I see when I type 1 2 q is: -1 -2 -q If that is what you see, the problem is in your print -%s%ch statement. It implicitly outputs '\n' at the end, and when terminal is set in raw mode, this is not translated into '\r\n' as when terminal is in canonical mode. Try print -%s\r % ch or just sys.stdout.write(ch) -- Sergei. -- http://mail.python.org/mailman/listinfo/python-list
Re: CGI Tutorial
Sells, Fred wrote: content is great, my comments are editorial. I prefer PDF with bookmarks rather than HTML. clip If you choose to go the PDF route, I've found OpenOffice 2.0 pretty good at generating PDF with bookmarks. Just don't get too complex or OO may hose you. Since you replied to a person who replied to me and who mentioned it, I assume that you are talking about my text _Linear Algebra_ (I have another text up, _Number Theory_, that no one seems to know about so I assume you are not talking about it). If that's true then it is way off topic, not just for the thread but for the newsgroup. Please write me separately at the address given on the web page for the text. But, my book doesn't use any HTML. It also doesn't come from a word processor, since for mathematics the standard is LaTeX, so maybe you are talking about something entirely unrelated? But at all events it seems not to have to do with CGI. Jim -- http://mail.python.org/mailman/listinfo/python-list
TypeError: unsupported type for timedelta days component: unicode
Hi, the following shows the contents of datebook.xls Date 8/9/2006 8/9/2006 8/9/2006 8/9/2006 8/9/2006 # read_date.py import xlrd book = xlrd.open_workbook(datebook.xls) sh = book.sheet_by_index(0) ex_qdate=sh.cell_value(rowx=1,colx=0) pyd=datetime.date(1900,1,1)+datetime.timedelta(days=sh.cell_value(rowx=1,colx=0)) print pyd for c in range(sh.ncols): for r in range(sh.nrows): print sh.cell_value(rowx=r,colx=c) print datetime.date(1900,1,1)+datetime.timedelta(days=sh.cell_value(rowx=r,colx=c)) Output 2006-08-11 Date Traceback (most recent call last): File D:/Python23/Testing area/Python and Excel/read_date.py, line 12, in ? print datetime.date(1900,1,1)+datetime.timedelta(days=sh.cell_value(rowx=r,colx=c)) TypeError: unsupported type for timedelta days component: unicode The first print statement gives me desired output. Whats wrong with second print statement? When I give the discriptor or index explicitly its giving the correct answer. Why not in the loop? Am I wrong some where? Please help me. Thank you, Sudhir. -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to static members from inside a method decorator?
no need for all that,i wrote a basic Ajax framework for cherrypy that features a Ajax.Net feature,exposing functions to JavaScript via attributes(or in python via decorators),here is a decorator that run one time(i.e. before running the actual code) and get the name of the class [code] def AddFunction(func): stack=inspect.stack() ClsName=stack[1][3]#get the class name from the stack #now you both have the ClassName and the func object,so you can populate your list return func#return the decorated function [/code] it use the module inspect,to inspect the stack. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to run in background?
I'm sorry. I tried with windows=myscript.py but it doesn't seem to work. I really don't know where find this information that's extremely important for me. I googled a lot but I didn't found a solution for my problem. :-\ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python to use a non open source bug tracker?
Paul Boddie schrieb: As I asked before, did anyone look into asking large-scale users of the various considered products about their experiences with regard to reliability, scalability, and so on? I didn't ask anyone, primarily because of lack of time. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: How to run in background?
billie wrote: I'm sorry. I tried with windows=myscript.py but it doesn't seem to work. it does work, so you've probably made some simple mistake. figuring out what that is is a bit hard if you don't provide more information, though. can you perhaps post (the relevant portions of) your setup.py file ? /F -- http://mail.python.org/mailman/listinfo/python-list
Re: extract certain values from file with re
Hi Fabian, I'm still a youngster in Python but I think I can help with the extracting data from the log file part. As I'm seeing it right now, the only character separating the numbers below is the space character. You could try splitting all the lines by that character starting from the NO Column. The starting point of the split function could easily be defined by regexes. Using this regex : \s+\d+\s{1,2}[\d\w\.-]*\s+ ... I was able to extract the 2 first columns of every row. And since the while document is structured like a table, you could define a particular index for each of the columns of the split result. I sincerely hope this can help in any way :) -- http://mail.python.org/mailman/listinfo/python-list