Re: finding element by tag in xml

2010-02-20 Thread Dj Gilcrease
On Sat, Feb 20, 2010 at 9:27 AM, sWrath swrath wrote: > from xml.dom.minidom import parse > from xml.etree.ElementTree import* > > file1="book.xml" > tmptree=ElementTree() > tmptree.parse(file1) > items=root.getiterator() > > > dom = parse(file1) > > > #Find tag names > for node in items : >    if

Re: list vs tuple for a dict key- why aren't both hashable?

2009-11-08 Thread Dj Gilcrease
On Sun, Nov 8, 2009 at 11:15 AM, Wells wrote: > I'm not quite understanding why a tuple is hashable but a list is not. > Any pointers? Thanks! tuple is hashable because it is immutable whereas a list is mutable. -- http://mail.python.org/mailman/listinfo/python-list

Re: Are min() and max() thread-safe?

2009-09-16 Thread Dj Gilcrease
I dont see anything wrong with it and it works for me on a sequence of 5000 -- http://mail.python.org/mailman/listinfo/python-list

Re: Application Packages

2009-09-15 Thread Dj Gilcrease
when looking up namespace-packages I found pkgutil which lets me add a myapp.user package with the following in its __init__.py and nothing else import os, os.path from pkgutil import extend_path homedir = os.environ.get('HOME') or os.environ.get('USERPROFILE') __path__ = extend_path([os.path.abs

Application Packages

2009-09-15 Thread Dj Gilcrease
*" or better yet map it to myapp.user? Dj Gilcrease OpenRPG Developer ~~http://www.openrpg.com -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Mercurial migration: help needed

2009-08-18 Thread Dj Gilcrease
On Tue, Aug 18, 2009 at 2:12 AM, "Martin v. Löwis" wrote: > The second item is line conversion hooks. Dj Gilcrease has posted a > solution which he considers a hack himself. Mark Hammond has also > volunteered, but it seems some volunteer needs to be "in charge",

Re: ValueError: I/O operation on closed file

2009-04-13 Thread dj
On Apr 11, 12:30 am, Dennis Lee Bieber wrote: > On Fri, 10 Apr 2009 13:25:25 -0700 (PDT), dj > declaimed the following in gmane.comp.python.general: > > > > > I have a handler which I use with a set of log levels for the pyth

ValueError: I/O operation on closed file

2009-04-10 Thread dj
I have a handler which I use with a set of log levels for the python logging module. --- myhandler.py import logging.handlers # create my handler class class MyHandler(logging.handlers.RotatingFileHandler):

Re: create a log level for python logging module

2009-03-31 Thread dj
On Mar 31, 4:01 pm, MRAB wrote: > dj wrote: > > On Mar 31, 12:58 pm, MRAB wrote: > >> dj wrote: > >>> On Mar 30, 4:18 pm, Vinay Sajip wrote: > >>>> On Mar 30, 4:13 pm, dj wrote: > >>>>> I am trying to create a log level called user

Re: create a log level for python logging module

2009-03-31 Thread dj
On Mar 31, 12:58 pm, MRAB wrote: > dj wrote: > > On Mar 30, 4:18 pm, Vinay Sajip wrote: > >> On Mar 30, 4:13 pm, dj wrote: > > >>> I am trying to create a log level called userinfo for the pythonlogging. > >>> I read the source code and tried to reg

Re: custom handler does not write to log file

2009-03-31 Thread dj
On Mar 31, 1:13 pm, dj wrote: > It seems that you can create custom handlers and add them to the > logging.handlers namespace(http://mail.python.org/pipermail/python- > list/2008-May/493826.html.) > But for reasons beyond my understanding my log file (test.log) is not

custom handler does not write to log file

2009-03-31 Thread dj
It seems that you can create custom handlers and add them to the logging.handlers namespace(http://mail.python.org/pipermail/python- list/2008-May/493826.html.) But for reasons beyond my understanding my log file (test.log) is not written to. my handler class

Re: create a log level for python logging module

2009-03-31 Thread dj
On Mar 30, 4:18 pm, Vinay Sajip wrote: > On Mar 30, 4:13 pm, dj wrote: > > > > > I am trying to create a log level called userinfo for the pythonlogging. I > > read the source code and tried to register the level to theloggingnamespace >

create a log level for python logging module

2009-03-30 Thread dj
I am trying to create a log level called userinfo for the python logging. I read the source code and tried to register the level to the logging namespace with the following source: from logging import Logger # create the custom log level

Pyodbc and minimock with doctest

2008-10-31 Thread dj
Hello, I have just started working with minimock in doctest. I want to create a mock pyodbc object which returns a string value when the method execute is called. Here is my doctest: >>> from minimock import Mock >>> import pyodbc >>> def database_response() ... ServerName = 'test_server'

Re: time module methods give an am or pm value ?

2008-06-09 Thread dj
On Jun 7, 9:40 am, Scott David Daniels <[EMAIL PROTECTED]> wrote: > dj wrote: > > Hello again, > > > Does anyone know which method in the time module will generate and am > > or pm ? > > If none of the method will do this for me. Can I produce the value

Re: time module methods give an am or pm value ?

2008-06-09 Thread dj
On Jun 7, 9:24 am, "Mark Tolonen" <[EMAIL PROTECTED]> wrote: > "dj" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Hello again, > > > Does anyone know which method in the time module will generate and am >

Re: time module methods give an am or pm value ?

2008-06-07 Thread dj
Hello again, Does anyone know which method in the time module will generate and am or pm ? If none of the method will do this for me. Can I produce the value on my own ? Any suggestions ? -- http://mail.python.org/mailman/listinfo/python-list

Has a file been opened by another program ?

2008-05-30 Thread dj
Hello All, First, Is there a python library, method or module that will tell you if a file has been opened by another program (i.e: Word, PowerPoint, IE etc.), the methods I have found in the standard library will only work with the python open method. Second, I want to take the time to thank eac

Re: Using os.walk to return files in subdirectories

2008-05-22 Thread dj
Hello All, I am attempting to us os.walk to populate two lists with values from a directory. The first list contains all the files in the directory and subdirectories. The second list contains only the files in the subdirectories. Here is the code: import os # list of matching files allfiles =

Using file objects with elementtree

2008-05-14 Thread dj
Hello, Rather then holding my XML document in memory before writing it to disk, I want to create a file object that elementtree will write each element to has it is created. Does any one know how to do that ? Here is my code so, far: fd = open("page.xml", "w") tree.write( fd, encoding="iso-8859-

Re: Using the indent method

2008-05-14 Thread dj
Hello All, I am using elementtree to write an XML document and I am having a hard time adding the correct indentation. I have tried using the indent method, but I can not figure out how to use it. Any suggestions. -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for Fredrik Lundh; documentation and code examples for elementtree

2008-05-07 Thread dj
method. I have tried a couple times, but I can not figure it out. Thank you so very much. DJ -- http://mail.python.org/mailman/listinfo/python-list

Gmail Error using smtplib

2007-07-20 Thread DJ Fadereu
Hello, can anyone help me with this? What am I doing wrong here? (I've changed private info to /xx) I'm getting an authentication error while using a standard script Gmail: --SCRIPT- import smtplib from email.MIMEText import MIMEText ms

Re: Help with PySMS

2007-05-27 Thread DJ Fadereu
On May 28, 1:53 am, Petr Jakes <[EMAIL PROTECTED]> wrote: > Maybe you can try python binding for gammu, which works great for me. > HTH > Petr Jakes > > http://cihar.com/gammu/python/ I'm going to try and setup Gammu today. I'm using a DKU-2 cable connection. The Gammu guide says that:"Before you

Re: ten small Python programs

2007-05-27 Thread DJ Fadereu
> > You could try this wiki page: > > http://rosettacode.org/wiki/Main_Page > > It has a fair amount of Python examples as well as many more other > languages (doing the same algorithm). > > Hope this helps. > > Adonis THIS IS GREAT :) Thanx! -- http://mail.python.org/mailman/listinfo/python-l

Help with PySMS

2007-05-27 Thread DJ Fadereu
omatic responder. This system will be part of a multiplayer game that lots of people can play using SMS. cheers, DJ Fadereu http://www.algomantra.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Any "consumer review generators" available?

2007-04-02 Thread DJ Stunks
On Mar 30, 1:46 am, nullified <[EMAIL PROTECTED]> wrote: > On 29 Mar 2007 20:34:26 -0700, "Evil Otto" <[EMAIL PROTECTED]> wrote: > > >On Mar 29, 2:19 pm, [EMAIL PROTECTED] wrote: > >> I am looking for a fake consumer review generator that could generate > >> realistic looking reviews for any produ

Re: The Semicolon Wars as a software industry and human condition

2006-08-17 Thread DJ Stunks
Xah Lee wrote: > Of interest: > > · The Semicolon Wars, by Brian Hayes. 2006. > http://www.americanscientist.org/template/AssetDetail/assetid/51982 > > in conjunction to this article, i recommend: > > · Software Needs Philosophers, by Steve Yegge, 2006 > http://xahlee.org/Periodic_dosage_dir/_p/so