Re: parametrizing a sqlite query

2010-02-24 Thread Jon Clements
On Feb 24, 5:07 pm, Sebastian Bassi wrote: > c.execute("SELECT bin FROM bins WHERE qtl LIKE '%:keys%'",{'keys':keywords}) > > This query returns empty. When it is executed, keywords = 'harvest'. > To check it, I do it on the command line and it works as expected: > > sqlite> SELECT bin FROM bins W

Re: parametrizing a sqlite query

2010-02-24 Thread Jon Clements
On Feb 24, 5:21 pm, Jon Clements wrote: > On Feb 24, 5:07 pm, Sebastian Bassi wrote: > > > c.execute("SELECT bin FROM bins WHERE qtl LIKE '%:keys%'",{'keys':keywords}) > > > This query returns empty. When it is executed, keywords = 'harve

Re: AOP decorator?

2010-03-01 Thread Jon Clements
On Mar 1, 4:22 pm, gentlestone wrote: > Hi, > > suppose my source code looks like: > >   import aspect_xy >   class Basic(object, aspect_xy.Basic): >     pass # basic attributes and methods ... > > and the source code of aspect_xy.p

Re: building a dict

2010-03-13 Thread Jon Clements
On 13 Mar, 15:05, vsoler wrote: > Say that "m" is a tuple of 2-tuples > > m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6)) > > and I need to build a "d" dict where each key has an associated list > whose first element is the count, and the second is the sum. If a 2- > tuple contains a None

Re: building a dict

2010-03-13 Thread Jon Clements
On 13 Mar, 15:28, Patrick Maupin wrote: > On Mar 13, 9:05 am, vsoler wrote: > > > Say that "m" is a tuple of 2-tuples > > > m=(('as',3), ('ab',5), (None, 1), ('as',None), ('as',6)) > > > and I need to build a "d" dict where each key has an associated list > > whose first element is the count, and

Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
This is semi-experimental and I'd appreciate opinions of whether it's the correct design approach or not. It seems like a good idea, but it doesn't mean it is. I have a class 'A', this provides standard support functions and exception handling. I have 'B' and 'C' which specialise upon 'A' What I'

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
On 13 Mar, 16:26, Patrick Maupin wrote: > On Mar 13, 10:19 am, Jon Clements wrote: > > > What I'd like to achieve is something similar to: > > > @inject(B): > >  def some_function(a, b): > >      pass # something useful > > So, just typing at the keybo

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
On 13 Mar, 16:42, Jack Diederich wrote: > On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements wrote: > > This is semi-experimental and I'd appreciate opinions of whether it's > > the correct design approach or not. It seems like a good idea, but it > > doesn't

Re: Decorator to inject function into __call__ of a class

2010-03-13 Thread Jon Clements
On 13 Mar, 17:42, Jack Diederich wrote: > On Sat, Mar 13, 2010 at 12:10 PM, Jon Clements wrote: > > On 13 Mar, 16:42, Jack Diederich wrote: > >> On Sat, Mar 13, 2010 at 11:19 AM, Jon Clements > >> wrote: > >> > This is semi-experimental and I'd ap

Re: Clearing memory (namespace) before running code

2010-03-21 Thread Jon Clements
On 21 Mar, 15:02, vsoler wrote: > Hi, > > Is there a way to erase/delete/clear memory before a piece of code is > run? > > Otherwise, the objects of the previous run are re-usable, and may > bring confusion to the tester. > > Thank you I'm guessing you're using some sort of IDE? For instance, in

Re: Advice needed on parallel processing in python

2010-03-24 Thread Jon Clements
On 24 Mar, 15:27, Glazner wrote: > Hi! > > I need to replace an app that does number crunching over a local > network. > it have about 50 computers as slaves > each computer needs to run COM that will do the "job" > right now the system uses MFC threads and DCOM to distribute the load. > > as i sa

Re: Python database of plain text editable by notepad or vi

2010-03-25 Thread Jon Clements
On 25 Mar, 22:40, James Harris wrote: > I am looking to store named pieces of text in a form that can be > edited by a standard editor such as notepad (under Windows) or vi > (under Unix) and then pulled into Python as needed. The usual record > locking and transactions of databases are not requir

Re: Python database of plain text editable by notepad or vi

2010-03-26 Thread Jon Clements
On 26 Mar, 09:49, James Harris wrote: > On 25 Mar, 22:56, Jon Clements wrote: > > > > > On 25 Mar, 22:40, James Harris wrote: > > > > I am looking to store named pieces of text in a form that can be > > > edited by a standard editor such as notepad (unde

Re: Classes as namespaces?

2010-03-26 Thread Jon Clements
On 26 Mar, 14:49, kj wrote: > What's the word on using "classes as namespaces"?  E.g. > > class _cfg(object): >     spam = 1 >     jambon = 3 >     huevos = 2 > > breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) > > Granted, this is not the "intended use" for classes, and therefore > could be vie

Re: OT: Meaning of "monkey"

2010-03-26 Thread Jon Clements
On 26 Mar, 15:45, Grant Edwards wrote: > On 2010-03-26, Luis M  Gonz?lez wrote: > > > Webmonkey, Greasemonkey, monkey-patching, Tracemonkey, J?germonkey, > > Spidermonkey, Mono (monkey in spanish), codemonkey, etc, etc, etc... > > > Monkeys everywhere. > > Sorry for the off topic question, but wh

Re: Q: We have *args and **kwargs. Woud ***allargs be useful?

2010-04-01 Thread Jon Clements
On 1 Apr, 10:57, Jonathan Fine wrote: > The idioms >      def f(*args, **kwargs): >          # Do something. > and >      args = (1, 2, 3) >      kwargs = dict(a=4, b=5) >      g(*args, **kwargs) > are often useful in Python. > > I'm finding myself picking up /all/ the arguments and storing them f

Re: Parsing markup.

2010-11-26 Thread Jon Clements
On Nov 26, 4:03 am, MRAB wrote: > On 26/11/2010 03:28, Joe Goldthwaite wrote: >  > I’m attempting to parse some basic tagged markup.  The output of the >  > TinyMCE editor returns a string that looks something like this; >  > >  > This is a paragraph with bold and italic elements in >  > itIt can

Re: Login using usrllib2

2010-12-01 Thread Jon Clements
On Dec 1, 10:16 am, Chris Rebert wrote: > On Wed, Dec 1, 2010 at 1:53 AM,   wrote: > > Hi All, > > > I'm using urllib2 module to login to an https server. However I'm unable to > > login as the password is not getting accepted. > > > Here is the code: > > > import urllib2, urllib > > values={'User

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 8:56 pm, "kirby.ur...@gmail.com" wrote: > >http://packages.python.org/dbf/ > > > So how *do* you get source code from such a web place?  I'm not > > finding > > a tar ball or installer.  Sorry if I'm missing something obvious, like > > a link > > to Sourceforge. > > Thanks to very quick

Re: Packages at Python.org

2010-12-01 Thread Jon Clements
On Dec 1, 10:32 pm, Ethan Furman wrote: > kirby.ur...@gmail.com wrote: > > > With Microsoft abandoning Visual FoxPro come 2015, we have 100K > > developers > > jumping ship (rough guess), perhaps to dot NET, but not necessarily.** > > > This page is potentially getting a lot of hits (I'm not privy

Re: Case Sensitive Section names configparser

2010-12-08 Thread Jon Clements
On Dec 8, 10:32 am, RedBaron wrote: > Is there any way by which configParser's get() function can be made > case insensitive? I would probably subclass dict to create a string specific, case insensitive version, and supply it as the dict_type. See http://docs.python.org/library/configparser.html#

Re: Modifying an existing excel spreadsheet

2010-12-21 Thread Jon Clements
On Dec 20, 9:56 pm, Ed Keith wrote: > I have a user supplied 'template' Excel spreadsheet. I need to create a new > excel spreadsheet based on the supplied template, with data filled in. > > I found the tools > herehttp://www.python-excel.org/, andhttp://sourceforge.net/projects/pyexcelerator/.

Re: help with link parsing?

2010-12-21 Thread Jon Clements
On Dec 20, 7:14 pm, "Littlefield, Tyler" wrote: > Hello all, > I have a question. I guess this worked pre 2.6; I don't remember the > last time I used it, but it was a while ago, and now it's failing. > Anyone mind looking at it and telling me what's going wrong? Also, is > there a quick way to ma

Re: Scanning directories for new files?

2010-12-21 Thread Jon Clements
On Dec 21, 7:17 pm, Matty Sarro wrote: > Hey everyone. > I'm in the midst of writing a parser to clean up incoming files, > remove extra data that isn't needed, normalize some values, etc. The > base files will be uploaded via FTP. > How does one go about scanning a directory for new files? For no

Specialisation / Interests

2010-12-21 Thread Jon Clements
Hi all, Was thinking tonight (now this morning my time): What would we consider the "long time" posters on c.l.p consider what they respond to and offer serious advice on. For instance: - Raymond Hettinger for algo's in collections and itertools - MRAB for regex's (never seen him duck a post whe

Re: help with link parsing?

2010-12-22 Thread Jon Clements
On Dec 22, 4:24 pm, "Colin J. Williams" wrote: > On 21-Dec-10 12:22 PM, Jon Clements wrote: > > > import lxml > > from urlparse import urlsplit > > > doc = lxml.html.parse('http://www.google.com') > > print map(urlsplit, doc.xpath(&

Re: Hosting a Python based TCP server

2010-12-23 Thread Jon Clements
On Dec 23, 12:01 pm, Oltmans wrote: > Hi all, > > I'm writing a very small TCP server(written in Python) and now I want > to host it on some ISP so that it can be accessed anywhere from the > Internet. I've never done that before so I thought I should ask for > some advice. Do you guys know any go

Re: Partition Recursive

2010-12-23 Thread Jon Clements
On Dec 23, 5:26 pm, macm wrote: > Hi Folks > > I have this: > > url = 'http://docs.python.org/dev/library/stdtypes.html? > highlight=partition#str.partition' > > So I want convert to > > myList = > ['http',':','//','docs','.','python','.','org','/','dev','/','library','/','stdtypes','.','html','?'

Re: Building sys.path at run-time?

2010-12-30 Thread Jon Clements
On Dec 30, 4:24 am, Roy Smith wrote: > In article <87k4irhpoa@benfinney.id.au>, >  Ben Finney wrote: > > > Roy Smith writes: > > > > I've got a problem that I'm sure many people have solved many times. > > > > Our project has a bunch of python scripts > > > A very common problem. The solutio

Re: Career path - where next?

2011-01-12 Thread Jon Clements
On Jan 12, 4:37 pm, Alan Harris-Reid wrote: > Hi there, I wonder if any Python folk out there can help me. > > For many years I was a contractor developing desktop and web > applications using Visual Foxpro as my main language, with Foxpro, > SQL-server and Oracle as back-end databases.  Unfortuna

Re: Developing a program to make a family tree.

2011-01-14 Thread Jon Clements
On Jan 14, 7:39 pm, Ata Jafari wrote: > Hi there. > I'm trying to develop a program like family tree maker. I have all > information, so there is no need to search on the net. This must be > something like trees. Can someone help me? I'm at the beginning. > Thanks. > > -- > Ata J. Tabrizi > atae.t

Re: statement level resumable exception

2011-01-21 Thread Jon Clements
On Jan 21, 8:41 am, ilejn wrote: > Arnaud, > > it looks like a solution. > Perhaps it is better than plain try/accept and than proxy class with > __getattr__. > It is not for free, e.g. because syntax check such as parentheses > matching is lazy too, though looks > very interesting. > > Thanks a l

Re: how to tell if cursor is sqlite.Cursor or psycopg2.Cursor

2011-01-24 Thread Jon Clements
On Jan 24, 7:44 pm, dmaziuk wrote: > Hi everyone, > > I've wrapper class around some sql statements and I'm trying to add a > method that does: >   if my_cursor is a sqlite cursor, then run "select > last_insert_rowid()" >   else if it's a psycopg2 cursor, then run "select > currval( 'my_sequence'

Re: Converting getCSS Count Code from java to python

2011-02-02 Thread Jon Clements
On Feb 1, 4:23 am, SMERSH009 wrote: > Hi, I'd love some help converting this code to the python equivalent: > > private int getCSSCount(String aCSSLocator){ >     String jsScript = "var cssMatches = eval_css(\"%s\", > window.document);cssMatches.length;"; >     return Integer.parseInt(selenium.get

Re: Arrays/List, filters, Pytho, Ruby

2011-02-11 Thread Jon Clements
On Feb 11, 9:24 pm, "LL.Snark" wrote: > Hi, > > I'm looking for a pythonic way to translate this short Ruby code : > t=[6,7,8,6,7,9,8,4,3,6,7] > i=t.index {|x| x > If you don't know Ruby, the second line means : > What is the index, in array t, of the first element x such that x > If can write it

Re: For loop comprehensions

2011-02-11 Thread Jon Clements
On Feb 11, 11:10 pm, Benjamin S Wolf wrote: > It occurred to me as I was writing a for loop that I would like to > write it in generator comprehension syntax, eg. > >   for a in b if c: > > rather than using one of the more verbose but allowable syntaxes: > >   for a in (x for x in b if c): > >  

Re: regex help: splitting string gets weird groups

2010-04-08 Thread Jon Clements
On 8 Apr, 19:49, gry wrote: > [ python3.1.1, re.__version__='2.2.1' ] > I'm trying to use re to split a string into (any number of) pieces of > these kinds: > 1) contiguous runs of letters > 2) contiguous runs of digits > 3) single other characters > > e.g.   555tHe-rain.in#=1234   should give:  

Re: regex help: splitting string gets weird groups

2010-04-08 Thread Jon Clements
On 8 Apr, 19:49, gry wrote: > [ python3.1.1, re.__version__='2.2.1' ] > I'm trying to use re to split a string into (any number of) pieces of > these kinds: > 1) contiguous runs of letters > 2) contiguous runs of digits > 3) single other characters > > e.g.   555tHe-rain.in#=1234   should give:  

Re: Open Source Pivot table (OLAP cube?)

2010-04-27 Thread Jon Clements
On 27 Apr, 10:10, Laszlo Nagy wrote: >   Hi All, > > I'm planning to create a new visual component for wxPython, for > designing, creating and printing pivot tables. Also known as: decision > cube, OLAP cube. I was searching on the internet for something similar, > but I could not find any open so

Re: Open Source Pivot table (OLAP cube?)

2010-04-27 Thread Jon Clements
On 27 Apr, 12:16, Laszlo Nagy wrote: > > Please note: this is not a direct answer to your question. > > > I would personally go for a client-server model; not worrying what the > > server is written in or how it works. For some reason I have a scary > > thought of your widget pulling in 100million

Re: Python compiled modules are too big in size (even after strip)

2010-04-27 Thread Jon Clements
On 27 Apr, 10:43, King wrote: > Hi, > > I have just compiled python 2.6.5 from sources on ubuntu "hardy" 8.04. > I have used a simple script to do everything in one go: > > ./configure --enable-shared > make > make install > > Python is compiled and installed successfully. However the > modules(_s

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Jon Clements
On 4 May, 11:10, Nico Schlömer wrote: > Hi, > > I ran into a bit of an unexpected issue here with itertools, and I > need to say that I discovered itertools only recently, so maybe my way > of approaching the problem is "not what I want to do". > > Anyway, the problem is the following: > I have a

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Jon Clements
my_list.sort( key=itemgetter('a','b','c') ) > for a, a_iter in groupby(my_list, itemgetter('a')): >    print 'New A', a >    inner_list =  list( groupby(a_iter, itemgetter('b')) ) >    for pass in ['first pass', 'se

Re: ConfigParser.get() defaults?

2010-05-07 Thread Jon Clements
On 7 May, 21:05, Tim Chase wrote: > With a normal dictionary, I can specify a default fallback value > in the event the requested key isn't present: > >    d = {} >    print d.get(42, 'Some default goes here') > > However, with the ConfigParser object, there doesn't seem to be > any way to do a si

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread Jon Clements
On 8 May, 15:08, Alex Hall wrote: > Hi all, > I am sorry if this is the second message about this you get; I typed > this and hit send (on gmail website) but I got a 404 error, so I am > not sure if the previous message made it out or not. > Anyway, I have about fifteen vars in a function which ha

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread Jon Clements
On 8 May, 16:03, Alex Hall wrote: > On 5/8/10, Jon Clements wrote: > > > On 8 May, 15:08, Alex Hall wrote: > >> Hi all, > >> I am sorry if this is the second message about this you get; I typed > >> this and hit send (on gmail website) but I got a

Re: Regular expression

2010-05-18 Thread Jon Clements
On 18 May, 15:32, Back9 wrote: > On May 18, 10:09 am, ilvecchio wrote: > > > > > On May 18, 3:48 pm, Back9 wrote: > > > >  Hi, > > > > I have a string like this: > > > 0x340x5A0x9B0xBA > > > I want to extract 0x from the string but the first one. > > > > How I can use re for this case? > > > > T

Re: Omit the headers from XML message

2010-05-28 Thread Jon Clements
On 28 May, 16:24, "kak...@gmail.com" wrote: > Hi i have the following xml message i want to omit the headers, any > hints? > > POST /test/pcp/Listener HTTP/1.1 > User-Agent: Jakarta Commons-HttpClient/3.1 > Host: 127.0.0.1:50002 > Content-Length: 547 > > http://demo.com/demo";> >   >     >      

Re: TypeError: list indices must be integers

2010-06-01 Thread Jon Clements
On 1 June, 23:06, Terry Reedy wrote: > I got this error twice today > while creating lists of lists > of complicated stuff. > The first time I was puzzled, > but the second time I knew > that I had just forgotten a comma. > If you google this, you will too. > > Reduced example >  >>> [[1,2,3] # fo

Re: regarding the dimensions in gui

2010-06-10 Thread Jon Clements
On 10 June, 10:40, Jean-Michel Pichavant wrote: > Chris Rebert wrote: > > On Thu, Jun 10, 2010 at 1:27 AM, Andreas Waldenburger > > wrote: > > >> On Thu, 10 Jun 2010 08:37:21 +0100 Simon Brunning > >> wrote: > > >>> On 10 June 2010 08:19, Shashwat Anand > >>> wrote: > > And please stop usi

Re: The inverse of .join

2010-06-18 Thread Jon Clements
On 17 June, 21:03, Neil Cerutti wrote: > On 2010-06-17, Robert Kern wrote: > > > On 6/17/10 2:08 PM, Neil Cerutti wrote: > >> On 2010-06-17, Ian Kelly  wrote: > >>> On Thu, Jun 17, 2010 at 11:45 AM, Neil Cerutti > >>>  wrote: > What's the best way to do the inverse operation of the .join >

Re: catching my own exception

2010-06-18 Thread Jon Clements
On 18 June, 18:08, nick wrote: > I have a problem with catching my own exception. Here is the > code:http://fly.srk.fer.hr/~nick/travapi/blame.php?repname=Travian+API&pat... > > Line 252 calls a method, which on line 207 raises a > SomethingBeingBuiltError exception. On line 253 I catch that > ex

Re: let optionparse.Optionparser ignore unknown command line switches.

2010-08-01 Thread Jon Clements
On 1 Aug, 16:43, News123 wrote: > On 08/01/2010 05:34 PM, Steven W. Orr wrote: > > > > > On 08/01/10 07:27, quoth News123: > >> On 08/01/2010 01:08 PM, News123 wrote: > >>> I wondered, whether there's a simple/standard way to let > >>> the Optionparser just ignore unknown command line switches. >

Re: parsing a c project

2010-08-04 Thread Jon Clements
On 4 Aug, 12:33, Aitor Garcia wrote: > Hi, > > I need to know the memory locations of all variables in a C project including > variables allocated inside structs. Pray tell us why? > > What I want to do in to expand the structs into its basic elements (floats, > int16 and int8). > > In a  header

Re: new to python - trouble calling a function from another function

2010-08-05 Thread Jon Clements
On 5 Aug, 08:25, Brandon McCombs wrote: > Hello, > > I'm building an elevator simulator for a class assignment. I recently > ran into a roadblock and don't know how to fix it. For some reason, in > my checkQueue function below, the call to self.goUp() is never executed. > It is on the last line of

Re: new to python - trouble calling a function from another function

2010-08-06 Thread Jon Clements
On 5 Aug, 16:15, Brandon McCombs wrote: > Jon Clements wrote: > > On 5 Aug, 08:25, Brandon McCombs wrote: > >> Hello, > > >> I'm building an elevator simulator for a class assignment. I recently > >> ran into a roadblock and don't know how

Re: Using String Methods In Jump Tables

2010-08-23 Thread Jon Clements
On 20 Aug, 01:51, Tim Daneliuk wrote: > On 8/19/2010 7:23 PM, Steven D'Aprano wrote: > > > On Thu, 19 Aug 2010 18:27:11 -0500, Tim Daneliuk wrote: > > >> Problem: > > >>   Given tuples in the form (key, string), use 'key' to determine what > >>   string method to apply to the string: > > tabl

Re: Using String Methods In Jump Tables

2010-08-23 Thread Jon Clements
On 23 Aug, 16:57, Tim Daneliuk wrote: > On 8/23/2010 10:35 AM, Jon Clements wrote: > > > > > On 20 Aug, 01:51, Tim Daneliuk wrote: > >> On 8/19/2010 7:23 PM, Steven D'Aprano wrote: > > >>> On Thu, 19 Aug 2010 18:27:11 -0500, Tim Daneliuk wrote: &

Re: sqlite3, OperationalError: no such column, shouldn't that ne a ProgrammingError?

2009-06-16 Thread Jon Clements
On Jun 16, 4:41 pm, Gabriel Rossetti wrote: > Hello everyone, > > I get an OperationalError with sqlite3 if I put the wrong column name, > but shouldn't that be a ProgrammingError instead? I read PEP 249 and it > says : > > "        OperationalError > >             Exception raised for errors that

Re: generator expression works in shell, NameError in script

2009-06-17 Thread Jon Clements
On Jun 17, 11:19 pm, ssc wrote: > Hello, > > I am trying to generate this list of tuples: > [(0, ''), (1, 'Dr'), (2, 'Miss'), (3, 'Mr'), (4, 'Mrs'), (5, 'Ms')] > > My code works fine in the Python shell: > > >>> titles = ['Dr', 'Miss', 'Mr', 'Mrs', 'Ms',] > >>> title_choices = [(0, '')] + list((ti

Re: Paramiko Help

2009-06-24 Thread Jon Clements
On Jun 24, 10:01 pm, Frank Ruiz wrote: > Apologies.. Python newb here.. switching from perl to python.. so > please forgive if this is a dumb question. > > I am using the paramiko module and have some global variables defined. > > i.e. > > hostname = ' 10.10.10.10' > sshport = '22' > > I am then t

Re: Paramiko help - processing multiple commands

2009-06-24 Thread Jon Clements
On Jun 24, 11:22 pm, Frank Ruiz wrote: > Greetings, > > I am trying to process multiple commands using paramiko. I have > searched other threads, and I think my use case is a little different. > I am trying to login to a storage node that has a special shell, and > as such I cant execute a script

Re: Generator Expressions and CSV

2009-07-17 Thread Jon Clements
On 17 July, 21:08, Zaki wrote: > On Jul 17, 2:49 pm, MRAB wrote: > > > > > Zaki wrote: > > > Hey all, > > > > I'm really new to Python and this may seem like a really dumb > > > question, but basically, I wrote a script to do the following, however > > > the processing time/memory usage is not wh

Re: Generator Expressions and CSV

2009-07-17 Thread Jon Clements
On 17 July, 23:57, Zaki wrote: > On Jul 17, 6:40 pm, Jon Clements wrote: > > > > > On 17 July, 21:08, Zaki wrote: > > > > On Jul 17, 2:49 pm, MRAB wrote: > > > > > Zaki wrote: > > > > > Hey all, > > > > > > I'

Re: time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-21 Thread Jon Clements
On 21 July, 22:00, davidj411 wrote: > I am using a recursive function to print the time and a few other > things on each pass. ( the function calculates size of file that is > being transferred and if not 100 % copied, it waits 20 secs and checks > again). > > i would expect the time to be correct

Re: time.strftime('%m-%d-%Y %H:%m:%S') to log is out of order

2009-07-21 Thread Jon Clements
On 21 July, 22:38, Piet van Oostrum wrote: > > davidj411 (d) wrote: > >d> I am using a recursive function to print the time and a few other > >d> things on each pass. ( the function calculates size of file that is > >d> being transferred and if not 100 % copied, it waits 20 secs and checks >

Re: Regular exprssion for IRC messages

2009-07-22 Thread Jon Clements
On 22 July, 06:43, "Gabriel Genellina" wrote: > En Fri, 17 Jul 2009 13:59:47 -0300, nohics nohics   > escribió: > > > When an IRC client receive a messages, this message in in a special   > > format > > defined here: Message format in pseudo > > BNF

Re: Detect target name in descriptor __set__ method

2009-07-22 Thread Jon Clements
On 22 July, 06:02, "Gabriel Genellina" wrote: > I have a class attribute 'foo' which is a data descriptor. I create an   > instance of such class. When I say instance.foo = value, the descriptor   > __set__ method is called. Is there any way to obtain the name being   > assigned to? ('foo' in this

Re: How to read webpage

2009-08-01 Thread Jon Clements
On 1 Aug, 14:52, MRAB wrote: > tarun wrote: > > Dear All, > > I want to read a webpage and copy the contents of it in word file. I > > tried to write following code: > > > import urllib2 > > urllib2.urlopen("http://www.rediff.com/";) > > > *Error:-* > > >     urllib2.urlopen("http://www.icicibank.

Re: Newbie thwarted by sys.path on Vista

2009-08-01 Thread Jon Clements
On 1 Aug, 22:58, "Michael M Mason" wrote: > I'm running Python 3.1 on Vista and I can't figure out how to add my own > directory to  sys.path. > > The docs suggest that I can either add it to the PYTHONPATH environment > variable or to the PythonPath key in the registry.  However, PYTHONPATH > doe

Re: How to write replace string for object which will be substituted? [regexp]

2009-08-05 Thread Jon Clements
On 5 Aug, 07:53, ryniek wrote: > On 5 Sie, 00:55, MRAB wrote: > > > > > ryniek90 wrote: > > > Hi. > > > I started learning regexp, and some things goes well, but most of them > > > still not. > > > > I've got problem with some regexp. Better post code here: > > > > " > > >  >>> import re > > >  >

Re: Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Jon Clements
On 5 Aug, 13:17, Jonathan Fine wrote: > Hi > > I'm writing a talk that compares embed and extend, and wondered if > anyone here ever used the Python *embedded* in a database server. >      http://twistedmatrix.com/users/glyph/rant/extendit.html > > Web frameworks (such as Django) use extend, to im

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Jon Clements
On 5 Aug, 15:46, "Martin P. Hellwig" wrote: > Hi List, > > On several occasions I have needed (and build) a parser that reads a > binary piece of data with custom structure. For example (bogus one): > > BE > +-+-+-+-+--++ > | Version | Command |

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Jon Clements
On 5 Aug, 20:41, "Martin P. Hellwig" wrote: > Paul Rubin wrote: > > "Martin P. Hellwig" writes: > >> Is there an advantage using shifts and masks over my kitchen type solution? > > > Weren't you complaining about the 8-to-1 expansion from turning each bit > > to an ascii char? > > Yes you are (of

Re: Google sitemap generator in python gone?

2009-08-05 Thread Jon Clements
On 5 Aug, 22:44, Xah Lee wrote: > google used to have a sitemap generator written in python, at: >  https://www.google.com/webmasters/tools/docs/en/sitemap-generator.html > > but the url is gone. It seems the current version is moved > here:http://code.google.com/p/googlesitemapgenerator/ > and i

Re: pylucene installation problem on Ubuntu 9.04

2009-08-06 Thread Jon Clements
On 6 Aug, 19:49, KK wrote: > hi all, > I've trying to install pylucene on my linux box from last 2 days but > not able to do so. first i tried to install it using apt-get like > this, > kk-laptop$ sudo apt-get install pylucene > and it did install python2.5, python2.5-minimal and pylucene. I must

Re: Array of objects lost in unpickling

2009-09-13 Thread Jon Clements
On 13 Sep, 15:19, Bahadir wrote: > Hi, > > I have a class: > > class second: >     a = None >     b = None > > class first: >     array = [] > > I populate the array in first class with instances of second, then > save by: > > shelve = shelve.open(), > shelve["first"] = myfirst > shelve.close() >

Re: List comprehension vs generator expression memory allocation

2009-09-20 Thread Jon Clements
On 20 Sep, 14:35, candide wrote: > Let's code a function allowing access to the multiples of a given > integer (say m) in the range from a to b where a and b are two given > integers. For instance, with data input > > a,b,m=17, 42, 5 > > the function allows access to : > > 20 25 30 35 40 > > Each

Re: Evaluate coding and style

2009-09-24 Thread Jon Clements
On 24 Sep, 21:11, "Brown, Rodrick " wrote: > I recently started playing with Python about 3 days now (Ex Perl guy) and > wanted some input on style and structure of what I'm doing before I really > start picking up some bad habits here is a simple test tool I wrote to > validate home dirs on my

Re: urllib, can't seem to get form post right

2009-09-24 Thread Jon Clements
On 24 Sep, 22:18, "Adam W." wrote: > I'm trying to scrape some historical data from NOAA's website, but I > can't seem to feed it the right form values to get the data out of > it.  Heres the code: > > import urllib > import urllib2 > > ## The source pagehttp://www.erh.noaa.gov/bgm/climate/bgm.sht

Re: Format string with single quotes in it

2009-09-25 Thread Jon Clements
On 25 Sep, 13:42, Bahadir wrote: > Hi there, > > My question is simple, but I've been spending some hours over the web > and still struggling to get this right: How do I format a string that > contains single quotes in it? > > I am reading a file with lines of the form: > > CONT%d_VIRTMEM_REGIONS

Re: palindrome iteration

2010-08-28 Thread Jon Clements
On Aug 28, 11:55 am, Steven D'Aprano wrote: > On Sat, 28 Aug 2010 09:22:13 +0300, Jussi Piitulainen wrote: > > Terry Reedy writes: > >> On 8/27/2010 3:43 PM, Jussi Piitulainen wrote: > >> > Dave Angel writes: [snip] > Not everything needs to be a built-in method. There is already a standard > way

re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
Hi All, (I reckon this is probably a question for MRAB and is not really Python specific, but anyhow...) Absolutely basic example: re.sub(r'(\d+)', r'\1', 'string1') I've been searching around and I'm sure it'll be obvious when it's pointed out, but how do I use the above to replace 1 with 11? O

Re: re.sub: escaping capture group followed by numeric(s)

2010-09-17 Thread Jon Clements
On 17 Sep, 19:59, Peter Otten <__pete...@web.de> wrote: > Jon Clements wrote: > > (I reckon this is probably a question for MRAB and is not really > > Python specific, but anyhow...) > > > Absolutely basic example: re.sub(r'(\d+)', r'\1', '

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 16:10, Roy Smith wrote: > PEP 249 says about executemany(): > >         Prepare a database operation (query or command) and then >         execute it against all parameter sequences or mappings >         found in the sequence seq_of_parameters. > > are there any plans to update the api

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 18:32, Roy Smith wrote: > On Oct 12, 1:20 pm, Jon Clements wrote: > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > PEP 249 says about executemany(): > > > >         Prepare a database operation (query or command) and then > > >        

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-12 Thread Jon Clements
On 12 Oct, 18:53, Jon Clements wrote: > On 12 Oct, 18:32, Roy Smith wrote: > > > > > On Oct 12, 1:20 pm, Jon Clements wrote: > > > > On 12 Oct, 16:10, Roy Smith wrote: > > > > > PEP 249 says about executemany(): > > > > >    

Re: PEP 249 (database api) -- executemany() with iterable?

2010-10-13 Thread Jon Clements
On 12 Oct, 20:21, "J. Gerlach" wrote: > Am 12.10.2010 17:10, schrieb Roy Smith: > > > [A]re there any plans to update the api to allow an iterable instead of > > a sequence? > > sqlite3 (standard library, python 2.6.6., Windows 32Bit) does that already:: > > import sqlite3 as sql > > connection =

Re: Reading Outlook .msg file using Python

2010-10-21 Thread Jon Clements
On 20 Oct, 18:13, John Henry wrote: > On Oct 20, 9:01 am, John Henry wrote: > > > > > On Oct 20, 1:41 am, Tim Golden wrote: > > > > On 19/10/2010 22:48, John Henry wrote: > > > > > Looks like this flag is valid only if you are getting messages > > > > directly from Outlook.  When reading the msg

memory management - avoid swapping/paging

2010-10-21 Thread Jon Clements
Hi all, Is there a cross-platform way using Python to guarantee that an object will never be swapped/paged to disk? I'll be honest and say I'm really not sure if this is a particular language question or rather specific to an OS. Under linux it appears I could create a ramfs and mmap a file under

Re: memory management - avoid swapping/paging

2010-10-22 Thread Jon Clements
On 21 Oct, 16:45, Nobody wrote: > On Thu, 21 Oct 2010 02:34:15 -0700, Jon Clements wrote: > > I'm after something that says: "I want 512mb of physical RAM, I don't > > want you to page/swap it, if you can't do that, don't bother at all". > >

<    1   2   3