Re: [Python-Dev] Global Python Sprint Weekends: May 10th-11th and June 21st-22nd.

2008-04-16 Thread Thomas Lee
Anyone in Melbourne, Australia keen for the first sprint? I'm not sure if I'll be available, but if I can it'd be great to work with some others. Failing that, it's red bull and pizza in my lounge room :) I've been working on some neat code for an AST optimizer. If I'm free that weekend, I'll p

Re: is file open in system ? - other than lsof

2008-04-17 Thread Thomas Guettler
'fd') for file in os.listdir(fd_dir): try: link=os.readlink(os.path.join(fd_dir, file)) except OSError: continue print pid, link -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Global Python Sprint Weekends: May 10th-11th and June 21st-22nd.

2008-04-17 Thread Thomas Lee
Anybody in Melbourne keen for this? Not sure if I'll be able to make it myself, but I'd be interested to know if there's anybody in the area keen to do the sprint. Cheers, T Tarek Ziadé wrote: > On Wed, Apr 16, 2008 at 8:40 PM, Michael Foord > <[EMAIL PROTECTED]> wrote: > >> Trent Nelson wro

Re: Python 2.5 adoption

2008-04-18 Thread Thomas Bellman
e using. And RHEL/CentOS 4 is still quite common, so if you want to reach a large "customer base", make sure that your Python programs work with Python 2.3. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden "Don't tell me I'm burning the candle

How to get inner exception traceback

2008-04-24 Thread Thomas Guettler
y the real error is hard to find. Sometimes I help myself and change (in this example) ImportError to e.g. IOError and then I can see the real root of the problem. But maybe there is a way to get the inner exception and its traceback. This could be displayed in the debug view. Thomas -- Thomas Guet

Re: Issue with regular expressions

2008-04-29 Thread harvey . thomas
On Apr 29, 2:46 pm, Julien <[EMAIL PROTECTED]> wrote: > Hi, > > I'm fairly new in Python and I haven't used the regular expressions > enough to be able to achieve what I want. > I'd like to select terms in a string, so I can then do a search in my > database. > > query = '   "  some words"  with an

MatplotLib errors

2008-04-29 Thread Thomas Philips
an unusual way. Please contact the application's support team for more information. I'm running Python 2.5.2 under Windows XP. Any thoughts on what what may be causing the problem? Thanks in advance Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe Icon Resources

2008-04-30 Thread Thomas Heller
o the icon itself, nothing seems to work!! > > how do you access the other icons generated from py2exe, or how do you > set the registry up so that i looks for the icon correctly, > There was a problem in the icon resources code in py2exe which was recently fixed in CVS but there is n

Re: Learning question...

2008-05-07 Thread Thomas Woelz
On 7 maio, 09:25, [EMAIL PROTECTED] wrote: > Any idea why the following program does not work? I was learning IO on > Python and the following generates a TypeError: range() integer end > argument expected, got str. > I am a beginner. > > > # print input name (str k

xml.etree Syntax of path?

2008-05-09 Thread Thomas Guettler
documented what 'path' should look like to. [1] http://docs.python.org/lib/elementtree-elementtree-objects.html -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: xml.etree Syntax of path?

2008-05-09 Thread Thomas Guettler
Stefan Behnel schrieb: Thomas Guettler wrote: I think the documentation of xml.etree is missing something[1]. {{{ find(path) Finds the first toplevel element with given tag. Same as getroot().find(path). path is the element to look for. }}} According to the source etree has limited

Re: How to kill Python interpreter from the command line?

2008-05-10 Thread Thomas Bellman
Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >(Ctrl+Z which sends SIGSTOP and _cannot_ be masked > or otherwise ignored) Bzzt! Ctrl-Z causes a SIGTSTP to be sent, not SIGSTOP, and SIGTSTP can be both caught, ignored and masked. -- Thomas Bellman, Lysator C

Re: Good python equivalent to C goto

2008-08-16 Thread Thomas Mlynarczyk
loopCondition: if not( cond1 or cond2 or cond3 ): stmt1 stmt2 stmt3 stmt4 Not tested. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Resolver One 1.2 released

2008-08-19 Thread Giles Thomas
m. The big problem is that we'll have to change (or even recode) our grid component. Best regards, Giles -- Giles Thomas MD & CTO, Resolver Systems Ltd. [EMAIL PROTECTED] +44 (0) 20 7253 6372 Try out Resolver One! <http://www.resolversystems.com/get-it/> 17a Clerkenwell Road,

logging - how to use in a library?

2008-08-26 Thread Thomas Heller
lt level of ERROR even if unconfigured, and why does it insist to output something even if no handler is defined? I assume it would not be a good idea to configure logging in the library itself, possibly overwriting explicit configuration that the user has done... I don't get it. Thomas --

Re: logging - how to use in a library?

2008-08-27 Thread Thomas Heller
ce under most circumstances we're > particularly interested in warnings and errors. (A level of WARNING > catches ERROR and CRITICAL events, too, of course.) Sure - mistake on my side. Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes version mismatch

2008-08-29 Thread Thomas Heller
7;Version number mismatch', '1.0.2', '1.0.3') > }}} > > I just updated from python 2.5.1 to 2.5.2, and wxPython 2.8.7.1 to > 2.8.8.1. The issue is only in the py2exe-built app, not when running the > script from the command line. I guess you should remove t

Re: logging - how to use in a library?

2008-08-29 Thread Thomas Heller
Vinay Sajip schrieb: > On Aug 27, 11:28 am, Thomas Heller <[EMAIL PROTECTED]> wrote: >> >> I came up with a workaround that seems to do what I want. I add a NULL >> handler >> to my top-level logger which is not the root logger but a logger named >>

Re: max(), sum(), next()

2008-09-04 Thread Thomas Bellman
ad) does return NULL for a sum over the empty sequence, so you could argue that that would be the correct behaviour for the Python sum() function as well, but you can't argue that because a sum *involving* a NULL value returns NULL. -- Thomas Bellman, Lysator Computer Club, Linköping U

Re: max(), sum(), next()

2008-09-04 Thread Thomas Bellman
t an illogical stance to take. It's just a totally different issue from encountering a non-numeric element in the sequence. In some cases it might actually make sense to treat the empty sequence as an error, but just ignore non-numeric elements (i.e, treat them as if they were zero).

Re: ctypes error on Windows

2008-09-05 Thread Thomas Heller
rts" on the > DLL to check that it really exports the symbols the binding expects. > Or use dependencywalker (google for it). Thomas -- http://mail.python.org/mailman/listinfo/python-list

Catching subprocess stdout stream

2008-09-08 Thread Thomas Jansson
"rb"),bufsize=1024,shell=False, stdout=subprocess.PIPE) while p.poll() is None: #Check if child process has terminated. o = p.stdout.readline() ofile.writelines(o) print o, ofile.close Kind regards Thomas Jansson -- http://mail.python.org/mailman/listinfo/python-list

Better error message on recursive import

2008-09-11 Thread Thomas Guettler
Hi, why does Python only raise ImportError if it fails caused by a recursive import? I know what's wrong. But I guess many beginner don't know what's wrong. I don't want much, just "RecursiveImportError" instead of "ImportError". Is this possi

Re: Better error message on recursive import

2008-09-12 Thread Thomas Guettler
ost recent call last): File "one.py", line 1, in from two import testtwo File "/mnt/home/tguettler/tmp/rec/two.py", line 1, in import one File "/mnt/home/tguettler/tmp/rec/one.py", line 1, in from two import testtwo ImportError: cannot import name tes

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread Thomas Heller
t == "exception": pdb.set_trace() return tracefunc sys.settrace(tracefunc) def test(arg): if arg > 20: raise ValueError(arg) return test(arg+1) test(0) Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Generating test data from an XML Schema

2008-09-17 Thread Mark Thomas
On Sep 17, 5:29 am, Jonathan Fine <[EMAIL PROTECTED]> wrote: > Hello > > I want to generate test data from an XML schema.  I've had a quick look > at existing tools (such as minixsv and amara) but from what I've seen > they don't seem to help. ... > A tool that provides a nice Python interface to n

Re: Directshow in Python

2008-09-18 Thread Thomas Heller
ter_builder.RenderFile("c:\\windows\\clock.avi", None) or filter_builder.RenderFile(u"c:\\windows\\clock.avi", None) If you pass a string, comtypes converts it to unicode using the "mbcs" codec; this can be changed by setting ctypes.conversion_mode. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Reading Windows CSV file with LCID entries under Linux.

2008-09-22 Thread Thomas Troeger
have to use for 1033 and 1031? Any help appreciated, Thomas. -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml question

2008-09-26 Thread Mark Thomas
On Sep 26, 11:19 am, Uwe Schmitt <[EMAIL PROTECTED]> wrote: > I have to parse some text which pretends to be XML. lxml does not want > to parse it, because it lacks a root element. > I think that this situation is not unusual, so: is there a way to > force lxml to parse it ? By "pretends to be XML

Re: r""

2008-09-30 Thread Mark Thomas
On Sep 30, 1:17 pm, Kyle Hayes <[EMAIL PROTECTED]> wrote: > Is there a way to use the 'r' in front of a variable instead of > directly in front of a string? Or do I need to use a function to get > all of the slashes automatically fixed? Is this what you're talking about? str = "foo/bar" re =

Re: Python script for tracert

2008-10-01 Thread Thomas Guettler
;www.microsoft.com' p = subprocess.Popen(["tracert", '-d', '-w', '100', host], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while True: line = p.stdout.readline() if not line: break print '-->',line, p.wait() -- Thomas Guettler,

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Thomas Guettler
I'm looking for alternatives. Please explain what you want to do. Maybe the spread toolkit can help you: http://www.spread.org/index.html HTH, Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivalent of Perl e flag with regular expression

2008-10-02 Thread Mark Thomas
On Oct 2, 4:03 pm, [EMAIL PROTECTED] wrote: >     Jason> With Perl I might do something like this: >     Jason> $line =~ s/(select)/uc($1)/e; >     ... >     Jason> How would I do this with Python? > > I'm sure there are plenty of ways to skin this particular cat, but how is > 's/.../.../e' differe

Re: how about adding ping's uuid module to the standard lib ?

2006-03-06 Thread Thomas Heller
. In getaddr(), what if windows is installed on the D: drive? Thomas -- http://mail.python.org/mailman/listinfo/python-list

mail.python.org disruption

2006-03-08 Thread Thomas Wouters
ssage like the one above, it's safe to re-send it now.Sorry for the inconvenience. -- Thomas Wouters <[EMAIL PROTECTED]>Hi! I'm a .signature virus! copy me into your .signature file to help me spread! -- http://mail.python.org/mailman/listinfo/python-list

Re: cgi problem

2006-03-08 Thread Thomas Guettler
destination) header="Status: 302 Moved Temporarily\nLocation: %s\n\n" % ( url) ReturnThis.__init__(self, header) Now you can 'raise Redirect("mylocation")' anywhere in your code. HTH, Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de Spam Catcher: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Extending embedded Python: Adding single methods

2006-03-08 Thread Thomas Heller
{"directory_created", DirectoryCreated, METH_VARARGS, NULL}, {"message_box", PyMessageBox, METH_VARARGS, NULL}, }; ... mod = PyImport_ImportModule("__builtin__"); if (mod) { int i; for (i = 0; i < DIM(meth); ++

Re: Extending embedded Python: Adding single methods

2006-03-08 Thread Thomas Heller
Torsten Bronger wrote: > Hallöchen! > > Thomas Heller <[EMAIL PROTECTED]> writes: > >> Torsten Bronger wrote: >> >>> [...] However, is there a way to avoid this dummy "pp3" module >>> and add the C++ functions directy to the main n

Re: cgi problem

2006-03-09 Thread Thomas Guettler
too: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1055159&group_id=5470 CGIHTTPServer writes "200" before the script gets executed! You can return this: """ """ Thomas -- Thomas Güttler, http://www.thomas-guettler.d

Re: Which GUI toolkit is THE best?

2006-03-10 Thread Thomas Guettler
tkinter. But it is big and there are too many layers: WxPython -> WxWidgets -> gtk I tried some examples, but it didn't "feel" good. Now I use pygtk. I code everything, I don't used glade or something like this. HTH, Thomas -- Thomas Güttler, http://www.thomas-guettl

Re: Python and C

2006-03-11 Thread Thomas Heller
Python. Possible > exercise for someone. > Alan Green apparently has got it to work with the free vctoolkit: http://cardboard.nu/blog/2005_07_14/ctypes_code_generator_for_chea.html Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Which GUI toolkit is THE best?

2006-03-13 Thread Thomas Guettler
Am Fri, 10 Mar 2006 16:10:09 +0100 schrieb Sybren Stuvel: > Thomas Guettler enlightened us with: >> The licence for QT is GPL, this means you cannot use it in >> commercial application. That is why I never looked at it. > > Ehmm... from their website: >From http://www.t

Re: Trace dynamically compiled code?

2006-03-14 Thread Thomas Heller
#x27; the source? I suppose I could write it all out to a bunch of > temp files, but that would be terribly messy. Are there any neater > solutions? You coud monkey-patch the getline function in the linecache module, so that it is able to find your dynamically generated code. IMO that is what pdb uses.c Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I use the subprocess module with mswindows?

2006-03-19 Thread Thomas Bellman
subprocess without deadlocking, you may be helped by using my asyncproc module, which you can download from http://www.lysator.liu.se/~bellman/download/asyncproc.py I suspect that it only works on Unix, though. -- Thomas Bellman, Lysator Computer Club, Linköping University, Sweden &q

Re: read a file line by line using readline()

2006-03-22 Thread Thomas Girod
If your code is exactly what you've copy-pasted, then you are not testing against an empty string but a "one blank space" string ... I've just tried with : while line != "": and it works very well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert Word .doc to Acrobat .pdf files

2006-03-23 Thread Thomas Guettler
I wrote a script which uses OpenOffice. It can convert and read a lot of formats. #!/usr/bin/env python #Old: !/optlocal/OpenOffice.org/program/python # (c) 2003-2006 Thomas Guettler http://www.tbz-pariv.de/ # OpenOffice1.1 comes with its own python interpreter. # This Script needs to be run

Find similar images using python

2006-03-29 Thread Thomas W
mages. Any hint/clue on this subject would be appreciated. Best regards, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes/libffi for Intel based Macintosh

2006-03-29 Thread Thomas Heller
to such a machine, I have now way to port ctypes myself (hint, hint ;-). OTOH, the current way to go would be to build universal binaries, but I have even less clue how to do *that*. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: How to debug python code?

2006-03-31 Thread Thomas Guettler
ertionError you can insert print statements or raise("var=%s var2=%s" % (var, var2)) to narrow down the problem. I never used pdb. HTH, Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de Spam Catcher: [EMAIL PROTECTED] -- http://mai

Re: Framework/module for generating HTML documentation

2006-04-04 Thread Thomas Guettler
: > E.g., I want to go from something like this: > Introduction > Some text > Getting Started > Some text > Installation > Some text. See Getting Started for details. > > To this: > [index.html] > Contents > 1. Introduction > 2. Getting Started > > 2

python on Mac

2006-04-05 Thread Thomas Nelson
I just purchased a new macbook (os 10.4.6), and I'm trying to install python 2.4 on it. I downloaded and ran the two installers recommended at http://www.python.org/download/mac/. Now I have IDLE, which runs 2.4.1, but typing "python" at a terminal still opens 2.3.5, because it points to /usr/bin

Re: python on Mac

2006-04-05 Thread Thomas Nelson
There is no 2.4 in my Versions folder, only 2.3 and current. Should one of the installers have created this directory? Which one? THN -- http://mail.python.org/mailman/listinfo/python-list

Re: python on Mac

2006-04-05 Thread Thomas Nelson
Thanks to you both. I downloaded the dmg suggested, and trustingly typed: sudo rm /usr/bin/python sudo ln -s /usr/local/bin/python2.4 /usr/bin/python And now my command line and scripts behave the way I expect. Thanks again. THN -- http://mail.python.org/mailman/listinfo/python-list

Re: python on Mac

2006-04-06 Thread Thomas Nelson
Well, as I stated in post, I've already replaced the link at /usr/bin/python. I'm not clear why that's unhealthy. Should I change it back to whatever it was before? I guess maybe it was /System/Library/Frameworks/Python.framework/Versions/Current/bin/python ? Thanks, THN -- http://mail.python.

Re: GUI issues in Python

2006-04-06 Thread Thomas Jollans
ets the coordinates and action -> does something -> draws something -> ... -- Thomas Jollans - http://jollybox.de/ GNU/Linux - freedom, functionality, power - what more do you want ? When in doubt, follow the penguins. -- http://mail.python.org/mailman/listinfo/python-list

Re: python on Mac

2006-04-06 Thread Thomas Nelson
Ok, I fixed my /usr/bin/python and added /usr/public/bin/ to my PATH in .profile. Everything seems ok now. Thanks again to everyone for their help. THN -- http://mail.python.org/mailman/listinfo/python-list

What does 'repair Python 2.5a1' do?

2006-04-07 Thread Thomas Heller
What does the repair command in the 2.5a1 msi installer do? Apparently it does not replace changed files, although it seems to replace deleted files. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: "The World's Most Maintainable Programming Language"

2006-04-09 Thread Thomas Nelson
I thought the paragraph about provability was interesting. Presumably the author refers to proofs in the spirit of "A Discipline of Programming" from Djikstra, 1976. Unfortunately, I don't think anyone has writting much about this since the 70s. I'd be interested to learn if anyone's tried to wr

Re: how relevant is C today?

2006-04-10 Thread Thomas Bellman
Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > "const" is in C89/C90. Although with slightly different semantics from in C++... For instance: static const int n = 5; double a[n]; is valid C++, but not valid C. -- Thomas Bellman, Lysator Computer Club

Re: Override on terminal

2006-04-11 Thread Thomas Bartkus
ada yada for various terminal types inside nice python functions And I'll be surprised if it doesn't default to VT-100 ;-) > And also: is it possible to override, from python code, something on a > unix(linux) terminal? I don't know what that means. If you meant overwrite (rather than

Python editing with emacs/wordstar key bindings.

2006-04-11 Thread Thomas Bartkus
r than the default that came with emacs? Any tips/hints appreciated. Thomas Bartkus -- http://mail.python.org/mailman/listinfo/python-list

Re: redirecting web page

2006-04-12 Thread Thomas Guettler
still didn't figure out how to do it. > Thank you very much Some days ago there was a similar question. It might help you: http://groups.google.com/group/comp.lang.python/browse_frm/thread/7d325df38293fe18/7b29f0d9f11474ba?lnk=st&q=guettler+redirect+python&rnum=1&hl=en#7b29f0d9f

new-style classes and len method

2006-04-13 Thread Thomas Girod
Hi there. I'm trying to use new-style classes, but there is something i'm obviously missing here it is : class Data(list): __slots__ = ["width", "height", "label"] def __init__(self,width,height,label=None): list.__init__(self) self.width = width self.height = he

Re: new-style classes and len method

2006-04-13 Thread Thomas Girod
Or maybe I'm mixing up what we call a "classmethod" with what we could call an "instance method" ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python editing with emacs/wordstar key bindings.

2006-04-13 Thread Thomas Bartkus
"Carl Banks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas Bartkus wrote: > > Does anyone use emacs together with both WordStar key bindings and python > > mode? I'm afraid that Wordstar editing key commands are burned R/O into my

Re: new-style classes and len method

2006-04-13 Thread Thomas Girod
It's alright I found where my mistake came from. I was misunderstanding the meaning of "classmethod", thinking of it as an instance method. -- http://mail.python.org/mailman/listinfo/python-list

create pixmap from data

2006-04-14 Thread Thomas Girod
about a way to display those informations ? cheers Thomas -- http://mail.python.org/mailman/listinfo/python-list

GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
Hi. No matter how I try, I just can't find this GdkColor class. I'm trying to convert some data into a pixmap in order to display it. Here is my code : import pygtk pygtk.require('2.0') import gtk xbm = """#define dump_width 4 #define dump_height 4 static unsigned char dump_bits[] = { 0xaa, 0x6c,

Re: GdkColor : the phantom class ?

2006-04-14 Thread Thomas Girod
I found an answer : color = gtk.gdk.Color() and then use color for fg et bg -- http://mail.python.org/mailman/listinfo/python-list

Re: nested functions

2006-04-14 Thread Thomas Bartkus
in control - building worlds according to your own design. Had it not been your intention to hide 'b' and 'c', you would not have isolated them in this manner inside of 'a' . I, for one, am so glad to have nested functions again ;-) Thomas Bartkus -- http://mail.python.org/mailman/listinfo/python-list

Re: HELP PLEASE: What is wrong with this?

2006-04-15 Thread Thomas Jollans
Ralph H. Stoos Jr. wrote: > File "autotp.py", line 21 > ready = raw_input("Ready to proceed ? TYPE (y)es or (n)o: ") > ^ please post the entire output and the surrounding code (as much as reasonable). It may well be some paranthesis error, as alreasy state

Re: test if an input string starts with a python expression

2009-12-07 Thread Richard Thomas
On Dec 8, 1:22 am, r0g wrote: > Torsten Mohr wrote: > > Hi, > > > i'd like to test if an input string starts with a python expression > > and also where that expression ends.  An example: > > > a_func(3*7, '''abc''') +5 pls some more > > > The first part until (inclusive) the 5 should be found as

Re: UnboundLocalError: local variable '_[1]' referenced before assignment

2009-12-09 Thread Richard Thomas
On Dec 9, 10:17 am, Gabriel Rossetti wrote: > Hello everyone, > > I get this error on python 2.6.1 on mac os x 10.6 : > > UnboundLocalError: local variable '_[1]' referenced before assignment > > here's the code that raises this: > > params = [ self.__formatData(paramProcFunc, query, p) for p in p

ANN: London Financial Python Users Group

2009-12-09 Thread Giles Thomas
e 222 Regent Street, London W1B 5TR We've got a couple of lightning talks lined up, but if you're interested in giving one yourself then drop Didrik Pinte a line at dpi...@enthought.com. There's a (very minimal) Wiki page about the Users Group here: Cheers, Giles -- Gi

Re: Variable class instantiation

2009-12-11 Thread Richard Thomas
On Dec 11, 9:26 am, Jan Mach wrote: > Hi everybody, > I am currently solving the following problem and I am stuck. I am trying > to create instance of the class of variable name. I know, that the > following works: > > if (something): >     classToUse = C1 > else: >     classToUse = C2 > > o = cla

Re: Line indexing in Python

2009-12-18 Thread Richard Thomas
On Dec 18, 3:42 pm, seafoid wrote: > Hi Guys, > > When python reads in a file, can lines be referred to via an index? > > Example: > > for line in file: >      if line[0] == '0': >          a.write(line) > > This works, however, I am unsure if line[0] refers only to the first line or > the first c

Using ZODB (or something else) for storing lots of metadata about RSS/Atom feeds and posts

2009-12-19 Thread Thomas Doggette
I'm working on (or rather, at this point, planning) a project that will involve keeping track of every post in a large number of Atom feeds, as well as a lot of metadata about how posts are linked and how users interact with them. The idea of having all of these be persistent objects is very appea

Re: ctypes: How to call unexported functions in a dll

2010-01-05 Thread Thomas Heller
t; addr = dll.GetProcAddress(dll._handle, "GetModuleHandleA") >>> print hex(addr) 0x7c80b741 >>> proto = WINFUNCTYPE(c_int, c_char_p) >>> func = proto(addr) >>> func >>> func(None) 486539264 >>> hex(func(None)) '0x1d00' >>> hex(func("python24.dll")) '0x1e00' >>> hex(func("python.exe")) '0x1d00' >>> Thomas -- http://mail.python.org/mailman/listinfo/python-list

SMTPException: No suitable authentication method found (Server: Microsoft ESMTP MAIL Service)

2010-01-14 Thread Thomas Guettler
50-8BITMIME 250-BINARYMIME 250 CHUNKING The same happens if I use TLS. Any hints? Thomas -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*) thomas-guettler + de -- http://mail.python.org/mailman/listinfo/python-list

Re: Object Integer mapping

2010-01-20 Thread Richard Thomas
On Jan 20, 4:43 pm, NighterNet wrote: > Need help on python version 3.1.x. I can't seem to know what going on > a bit. The code that I check that the hash is different every time. Is > there a way to make the hash the same? I using as to check the class > is the same variables but if it different

SimpleXMLRPCServer daemon

2010-01-29 Thread Thomas Allen
e if it were deleted reliably. Thomas Allen -- http://mail.python.org/mailman/listinfo/python-list

Timestamps for TCP packets?

2009-10-02 Thread Thomas Johnson
Is there any way to get kernel-level timestamps for TCP packets while still using the standard python sockets library for communication? I need to communicate over a TCP connection as easily as possible, but also record the timestamps of the incoming and outgoing timestamps at microsecond or nanose

Re: weak reference to bound method

2009-10-02 Thread Thomas Lehmann
> I am trying to use a weak reference to a bound method: > > class MyClass(object): > def myfunc(self): > pass > > o = MyClass() > print o.myfunc > > > > import weakref > r = weakref.ref(o.myfunc) > print r() > None > > This is what I do not understand. The object "o" is s

SAX: Short tag's ...

2009-10-05 Thread Thomas Lehmann
Hi! Is there a way to recognize short tags in a XML? I'm implementing a SAX handler... Problem: storing the XML code I would need this information in the startElement ... How can I handle this? any text -- http://mail.python.org/mailman/listinfo/python-list

ANN: Resolver One 1.7 released

2009-10-28 Thread Giles Thomas
that: <http://www.resolversystems.com/opensource/> Best regards, Giles -- Giles Thomas giles.tho...@resolversystems.com +44 (0) 20 7253 6372 17a Clerkenwell Road, London EC1M 5RD, UK VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329. Registered address: 84

Re: bootstrapping on machines without Python

2009-11-13 Thread Thomas Heller
;& if exist py_exe.exe (py_exe.exe -x %0 %* && goto exit) else (goto download) # The python script import sys print "Hi, this is Python", sys.version sys.exit() # rest of the batch file """ :download echo Simulating download... copy c:\python25\python.exe py_exe.exe echo Done. REM start the script again after downloading %0 %* :exit rem """ Thomas -- http://mail.python.org/mailman/listinfo/python-list

Minimally intrusive XML editing using Python

2009-11-18 Thread Thomas Lotze
and re-use that for writing the edited XML if the model wasn't modified by the program. Does a library exist that helps with this? Does any XML library at all allow structured access to the text representation of a tag with its attributes? Thank you very much. -- Thomas -- http://mai

Re: Minimally intrusive XML editing using Python

2009-11-18 Thread Thomas Lotze
o obey the rules of a process, but instead I want a process that respects the textual form my input happens to have. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Minimally intrusive XML editing using Python

2009-11-18 Thread Thomas Lotze
I guess I shouldn't be surprised if what I'm looking for doesn't exist. Still, it would be nice if it did... -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: parallel class structures for AST-based objects

2009-11-21 Thread Richard Thomas
On 22 Nov, 00:07, MRAB wrote: > Steve Howell wrote: > > I have been writing some code that parses a mini-language, and I am > > running into what I know is a pretty common design pattern problem, > > but I am wondering the most Pythonic way to solve it. > > > Basically, I have a bunch of really si

Re: Minimally intrusive XML editing using Python

2009-11-23 Thread Thomas Lotze
this example: --- foo.gpx 2009-05-30 19:45:45.0 +0200 +++ bar.gpx 2009-11-23 17:41:36.0 +0100 @@ -11,7 +11,7 @@ 0.792244 2d - + 508.30 2009-05-30T16:37:10Z 15.15 -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Read IDL save files into Python

2009-11-23 Thread Thomas Robitaille
, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Any elegant way to construct the complete $k$-partite graph in Python?

2009-11-23 Thread Richard Thomas
On Nov 24, 2:45 am, geremy condra wrote: > On Mon, Nov 23, 2009 at 9:10 PM, geremy condra wrote: > > On Mon, Nov 23, 2009 at 9:03 PM, geremy condra wrote: > >> On Mon, Nov 23, 2009 at 7:05 PM, Paul Miller > >> wrote: > >>> I was wondering if there were any neat tools (like for instance, > >>> s

'classmethod' object has only read-only attributes

2009-11-25 Thread Thomas Guettler
/tmp/t.py", line 1, in class Foo(object): File "/home/user/tmp/t.py", line 5, in Foo bar.myattr='test' TypeError: 'classmethod' object has only read-only attributes (assign to .myattr) -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettl

Re: Can't get sys.stdin.readlines() to work

2010-01-31 Thread Richard Thomas
On Jan 31, 6:15 pm, tinn...@isbd.co.uk wrote: > I'm trying to read some data from standard input, what I'm actually > trying to do is process some date pasted in using the mouse cut and > paste on a Linux box (xubuntu 9.10) in a terminal window. > > First attempts failed so I'm now trying the trivi

ANN: Resolver One 1.8 released

2010-02-06 Thread Giles Thomas
om/download/> If you want to use Resolver One in an Open Source project, we offer free licenses for that: <http://www.resolversystems.com/opensource/> Best regards, Giles -- Giles Thomas giles.tho...@resolversystems.com +44 (0) 20 7253 6372 17a Clerkenwell Road, London EC1M 5RD, UK

mac install

2010-02-09 Thread Thomas Nelson
I downloaded the 3.1.1 dmg from http://www.python.org/download/releases/3.1.1/ but when I run it I get the error "The folowing install step failed: run postflight script for python documentation." The bugs list has this bug at http://bugs.python.org/issue6934 but it's described as fixed. Is it on

Re: why (1, 2, 3) > [1, 2, 3] is true?

2010-02-25 Thread Richard Thomas
On Feb 25, 2:03 pm, fat bold cyclop wrote: > > Both are not equal, so the comparison returns an arbitrary result in Py2. > > Thanks, Stefan. If I understand you correctly the comparison is not > valid. > But I wonder if there is any logic behind this (in 2.x). > Is it possible to predict result of

Re: libc Sleep api performs a busy waiting

2010-03-09 Thread Thomas Heller
Joe Fox schrieb: > Hi, > > actually i have simplified my scenario a lot here , > > In my actual case , i have to call a C-api which blocks on c select , in a > separate thread. > > my thread is getting struck in that api , and thus blocking all the other > threads. > Can you point to something

Re: os.rename [Errno 31] Too many links

2010-03-10 Thread Thomas Guettler
ook at the open file descriptors of a running process like this: ls -l /proc/PID/fd/ But I guess it is a limitation of your filesystem. What do you use? I once had this problem with ext2. It has a low limit for subdirectories. With xfs the limits are much greater. Thomas -- Thomas Guettler, h

<    22   23   24   25   26   27   28   29   30   31   >