Writing elapsed time as a string

2008-05-05 Thread Simon Pickles
Hello. I'm sorry if this has been asked a thousand (million) times. Is there a nifty pythonesque way to produce a string representing an elapsed time period, in terms of years, months, days, hours, mins, seconds? I am storing times in a MySQL db, and would love to be able to write the time

Writing elapsed time as a string

2008-05-05 Thread Simon Pickles
Hello. I'm sorry if this has been asked a thousand (million) times. Is there a nifty pythonesque way to produce a string representing an elapsed time period, in terms of years, months, days, hours, mins, seconds? I am storing times in a MySQL db, and would love to be able to write the time

Re: Garbage collection

2008-02-19 Thread Simon Pickles
Ken wrote: What is your __del__ method doing? Actually, nothing but printing a message when the object is deleted, just morbid curiosity. I've yet to see one of the destructor messages, tho from sys import getrefcount print getrefcount(x) Perfect, thanks Simon --

Garbage collection

2008-02-18 Thread Simon Pickles
Hi, I'm building a server with python, but coming from a c++ background, garbage collection seems strange. For instance, I have a manager looking after many objects in a dict. When those objects are no longer needed, I use del manager[objectid], hoping to force the garbage collector to

Sudden pyexpat error with ElementTree

2008-02-09 Thread Simon Pickles
Hi, I've been using ElementTree for a few weeks without problem, with Stackless Python. Suddenly I have an error importing expat, in both application and console: [EMAIL PROTECTED]:~$ python Python 2.5.2a0 Stackless 3.1b3 060516 (release25-maint:60694M, Feb 9 2008, 13:21:41) [GCC 4.1.3

Events in Python

2008-01-30 Thread Simon Pickles
Hi, I have a stackless python app, using twisted in parts (.internet and .adbapi). I need a little help getting pythonic after years of c++ hell. I'd like to use a system of events and observers, like c++ boost.signal. I'd like to be able to subscribe multiple callbacks to a single function

refcount

2008-01-29 Thread Simon Pickles
Hi, Is is possible to access the refcount for an object? Ideally, I am looking to see if I have a refcount of 1 before calling del Thanks Simon -- Linux Counter: User# 424693 -- http://mail.python.org/mailman/listinfo/python-list

REALLY simple xml reader

2008-01-27 Thread Simon Pickles
Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc = xml.open(file.xml) element = xmlDoc.GetElement(foo/bar) ... to read the value of: foo bar42/bar /foo Thanks Simon -- Linux user #458601 - http://counter.li.org.

Hashable

2008-01-26 Thread Simon Pickles
Hi, The term 'hashable'. Am I right in thinking it means it can be indexed? like a string or a dict? Thanks Si -- Linux user #458601 - http://counter.li.org. -- http://mail.python.org/mailman/listinfo/python-list

del self?

2008-01-25 Thread Simon Pickles
Hi, Just curious... What are the implications of a class member calling: del self is that what the __del__ method calls anyway? Thanks Simon -- Linux user #458601 - http://counter.li.org. -- http://mail.python.org/mailman/listinfo/python-list

Pythonland documentation

2008-01-18 Thread Simon Pickles
Hi I am new to python (fairly) but can't stop pythonning. c++ seems so far away now from here it looks like a horrid scribble :) Anyway my question is really about doc tools. I've been used to doxygen in c++ land, and although it makes a reasonable stab with a python project in java

Re: Looking for a good Python environment

2007-11-14 Thread Simon Pickles
Well, I am recent Windows escapee, and was dismayed by lack of Pyscripter for Linux. Hold on... there is hope! Pyscripter works great using WINE. search http://groups.google.com/group/PyScripter?hl=en for Linux Enjoy! Paul Rudin wrote: jwelby [EMAIL PROTECTED] writes: This is a

Python IDE

2007-11-03 Thread Simon Pickles
Hi, I have recently moved from Windows XP to Ubuntu Gutsy. I need a Python IDE and debugger, but have yet to find one as good as Pyscripter for Windows. Can anyone recommend anything? What are you all using? Coming from a Visual Studio background, editing text files and using the terminal to

Re: Running another python interpreter

2007-10-20 Thread Simon Pickles
This is very nearly perfect. I have a second console window. Unfortunately, the first is waiting for the second to close. Is there anyway to specify the equivalent of os.P_NOWAIT? Gabriel Genellina wrote: --- Simon Pickles [EMAIL PROTECTED] escribió: os.spawnl(os.P_NOWAIT, sys.executable

Running another python interpreter

2007-10-18 Thread Simon Pickles
Hello, I have several servers which link to each other (and of course, to clients). At present, I am starting them in turn manually. Is there a way with python to say, open gateway.py in a new interpreter window? I looked at execv, etc, but they seem to replace the current process. Ah, maybe

Re: Running another python interpreter

2007-10-18 Thread Simon Pickles
Well, I tried: os.spawnv(os.P_NOWAIT, gateway.py, ()) and got: OSError: [Errno 8] Exec format Simon Pickles wrote: Hello, I have several servers which link to each other (and of course, to clients). At present, I am starting them in turn manually. Is there a way with python

Help a C++ escapee!

2007-06-07 Thread Simon Pickles
Hi, Can someone help me leave the murky c++ world and enter shiny pythonland? I have a problem with importing and global variables, here's my code: ##server.py #socket connections from socketManager import* network = CNetworkManager() network.Listen()